Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes...
[linux-2.6.git] / include / pcmcia / ss.h
index 9b4ac93..2e488b6 100644 (file)
@@ -90,14 +90,14 @@ typedef struct pccard_io_map {
        u_char  map;
        u_char  flags;
        u_short speed;
-       u_int   start, stop;
+       phys_addr_t start, stop;
 } pccard_io_map;
 
 typedef struct pccard_mem_map {
        u_char          map;
        u_char          flags;
        u_short         speed;
-       u_long          static_start;
+       phys_addr_t     static_start;
        u_int           card_start;
        struct resource *res;
 } pccard_mem_map;
@@ -107,15 +107,6 @@ typedef struct io_window_t {
        struct resource         *res;
 } io_window_t;
 
-#define WINDOW_MAGIC   0xB35C
-typedef struct window_t {
-       u_short                 magic;
-       u_short                 index;
-       struct pcmcia_device    *handle;
-       struct pcmcia_socket    *sock;
-       pccard_mem_map          ctl;
-} window_t;
-
 /* Maximum number of IO windows per socket */
 #define MAX_IO_WIN 2
 
@@ -143,9 +134,9 @@ struct pccard_operations {
 
 struct pcmcia_socket {
        struct module                   *owner;
-       spinlock_t                      lock;
        socket_state_t                  socket;
        u_int                           state;
+       u_int                           suspended_state;        /* state before suspend */
        u_short                         functions;
        u_short                         lock_count;
        pccard_mem_map                  cis_mem;
@@ -155,7 +146,7 @@ struct pcmcia_socket {
                u_int                   Config;
        } irq;
        io_window_t                     io[MAX_IO_WIN];
-       window_t                        win[MAX_WIN];
+       pccard_mem_map                  win[MAX_WIN];
        struct list_head                cis_cache;
        size_t                          fake_cis_len;
        u8                              *fake_cis;
@@ -163,7 +154,7 @@ struct pcmcia_socket {
        struct list_head                socket_list;
        struct completion               socket_released;
 
-       /* deprecated */
+       /* deprecated */
        unsigned int                    sock;           /* socket number */
 
 
@@ -172,8 +163,8 @@ struct pcmcia_socket {
        u_int                           irq_mask;
        u_int                           map_size;
        u_int                           io_offset;
-       u_char                          pci_irq;
-       struct pci_dev *                cb_dev;
+       u_int                           pci_irq;
+       struct pci_dev                  *cb_dev;
 
 
        /* socket setup is done so resources should be able to be allocated.
@@ -188,9 +179,9 @@ struct pcmcia_socket {
        u8                              reserved:5;
 
        /* socket operations */
-       struct pccard_operations *      ops;
-       struct pccard_resource_ops *    resource_ops;
-       void *                          resource_data;
+       struct pccard_operations        *ops;
+       struct pccard_resource_ops      *resource_ops;
+       void                            *resource_data;
 
        /* Zoom video behaviour is so chip specific its not worth adding
           this to _ops */
@@ -209,9 +200,14 @@ struct pcmcia_socket {
        struct task_struct              *thread;
        struct completion               thread_done;
        unsigned int                    thread_events;
-       /* protects socket h/w state */
+       unsigned int                    sysfs_events;
+
+       /* For the non-trivial interaction between these locks,
+        * see Documentation/pcmcia/locking.txt */
        struct mutex                    skt_mutex;
-       /* protects thread_events */
+       struct mutex                    ops_mutex;
+
+       /* protects thread_events and sysfs_events */
        spinlock_t                      thread_lock;
 
        /* pcmcia (16-bit) */
@@ -234,34 +230,25 @@ struct pcmcia_socket {
                u8                      busy:1;
                /* pcmcia module is being unloaded */
                u8                      dead:1;
-               /* a multifunction-device add event is pending */
-               u8                      device_add_pending:1;
-               /* the pending event adds a mfc (1) or pfc (0) */
-               u8                      mfc_pfc:1;
+               /* the PCMCIA card consists of two pseudo devices */
+               u8                      has_pfc:1;
 
-               u8                      reserved:3;
+               u8                      reserved:4;
        } pcmcia_state;
 
 
-       /* for adding further pseudo-multifunction devices */
-       struct work_struct              device_add;
-
 #ifdef CONFIG_PCMCIA_IOCTL
        struct user_info_t              *user;
        wait_queue_head_t               queue;
 #endif /* CONFIG_PCMCIA_IOCTL */
 #endif /* CONFIG_PCMCIA */
 
-       /* cardbus (32-bit) */
-#ifdef CONFIG_CARDBUS
-       struct resource *               cb_cis_res;
-       void __iomem                    *cb_cis_virt;
-#endif /* CONFIG_CARDBUS */
-
        /* socket device */
        struct device                   dev;
        /* data internal to the socket driver */
        void                            *driver_data;
+       /* status of the card during resume from a system sleep state */
+       int                             resume_status;
 };
 
 
@@ -270,17 +257,25 @@ struct pcmcia_socket {
  * - pccard_static_ops         iomem and ioport areas are assigned statically
  * - pccard_iodyn_ops          iomem areas is assigned statically, ioport
  *                             areas dynamically
+ *                             If this option is selected, use
+ *                             "select PCCARD_IODYN" in Kconfig.
  * - pccard_nonstatic_ops      iomem and ioport areas are assigned dynamically.
  *                             If this option is selected, use
  *                             "select PCCARD_NONSTATIC" in Kconfig.
+ *
  */
 extern struct pccard_resource_ops pccard_static_ops;
+#if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE)
 extern struct pccard_resource_ops pccard_iodyn_ops;
 extern struct pccard_resource_ops pccard_nonstatic_ops;
+#else
+/* If PCMCIA is not used, but only CARDBUS, these functions are not used
+ * at all. Therefore, do not use the large (240K!) rsrc_nonstatic module
+ */
+#define pccard_iodyn_ops pccard_static_ops
+#define pccard_nonstatic_ops pccard_static_ops
+#endif
 
-/* socket drivers are expected to use these callbacks in their .drv struct */
-extern int pcmcia_socket_dev_suspend(struct device *dev, pm_message_t state);
-extern int pcmcia_socket_dev_resume(struct device *dev);
 
 /* socket drivers use this callback in their IRQ handler */
 extern void pcmcia_parse_events(struct pcmcia_socket *socket,