aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/pcmcia/aha152x_stub.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2006-03-05 04:45:09 -0500
committerDominik Brodowski <linux@dominikbrodowski.net>2006-03-31 10:15:57 -0500
commitfd238232cd0ff4840ae6946bb338502154096d88 (patch)
treed20e8f5871f7cff9d0867a84f6ba088fbffcbe28 /drivers/scsi/pcmcia/aha152x_stub.c
parenta78f4dd331a4f6a396eb5849656a4a72a70a56d7 (diff)
[PATCH] pcmcia: embed dev_link_t into struct pcmcia_device
Embed dev_link_t into struct pcmcia_device(), as they basically address the same entity. The actual contents of dev_link_t will be cleaned up step by step. This patch includes a bugfix from and signed-off-by Andrew Morton. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/scsi/pcmcia/aha152x_stub.c')
-rw-r--r--drivers/scsi/pcmcia/aha152x_stub.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/drivers/scsi/pcmcia/aha152x_stub.c b/drivers/scsi/pcmcia/aha152x_stub.c
index 12ec94d6ef14..0c196fbb3121 100644
--- a/drivers/scsi/pcmcia/aha152x_stub.c
+++ b/drivers/scsi/pcmcia/aha152x_stub.c
@@ -89,7 +89,7 @@ MODULE_LICENSE("Dual MPL/GPL");
89/*====================================================================*/ 89/*====================================================================*/
90 90
91typedef struct scsi_info_t { 91typedef struct scsi_info_t {
92 dev_link_t link; 92 struct pcmcia_device *p_dev;
93 dev_node_t node; 93 dev_node_t node;
94 struct Scsi_Host *host; 94 struct Scsi_Host *host;
95} scsi_info_t; 95} scsi_info_t;
@@ -103,7 +103,7 @@ static dev_link_t *dev_list;
103static int aha152x_attach(struct pcmcia_device *p_dev) 103static int aha152x_attach(struct pcmcia_device *p_dev)
104{ 104{
105 scsi_info_t *info; 105 scsi_info_t *info;
106 dev_link_t *link; 106 dev_link_t *link = dev_to_instance(p_dev);
107 107
108 DEBUG(0, "aha152x_attach()\n"); 108 DEBUG(0, "aha152x_attach()\n");
109 109
@@ -111,7 +111,8 @@ static int aha152x_attach(struct pcmcia_device *p_dev)
111 info = kmalloc(sizeof(*info), GFP_KERNEL); 111 info = kmalloc(sizeof(*info), GFP_KERNEL);
112 if (!info) return -ENOMEM; 112 if (!info) return -ENOMEM;
113 memset(info, 0, sizeof(*info)); 113 memset(info, 0, sizeof(*info));
114 link = &info->link; link->priv = info; 114 info->p_dev = p_dev;
115 link->priv = info;
115 116
116 link->io.NumPorts1 = 0x20; 117 link->io.NumPorts1 = 0x20;
117 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 118 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
@@ -122,9 +123,6 @@ static int aha152x_attach(struct pcmcia_device *p_dev)
122 link->conf.IntType = INT_MEMORY_AND_IO; 123 link->conf.IntType = INT_MEMORY_AND_IO;
123 link->conf.Present = PRESENT_OPTION; 124 link->conf.Present = PRESENT_OPTION;
124 125
125 link->handle = p_dev;
126 p_dev->instance = link;
127
128 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 126 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
129 aha152x_config_cs(link); 127 aha152x_config_cs(link);
130 128
@@ -136,23 +134,14 @@ static int aha152x_attach(struct pcmcia_device *p_dev)
136static void aha152x_detach(struct pcmcia_device *p_dev) 134static void aha152x_detach(struct pcmcia_device *p_dev)
137{ 135{
138 dev_link_t *link = dev_to_instance(p_dev); 136 dev_link_t *link = dev_to_instance(p_dev);
139 dev_link_t **linkp;
140 137
141 DEBUG(0, "aha152x_detach(0x%p)\n", link); 138 DEBUG(0, "aha152x_detach(0x%p)\n", link);
142
143 /* Locate device structure */
144 for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
145 if (*linkp == link) break;
146 if (*linkp == NULL)
147 return;
148 139
149 if (link->state & DEV_CONFIG) 140 if (link->state & DEV_CONFIG)
150 aha152x_release_cs(link); 141 aha152x_release_cs(link);
151 142
152 /* Unlink device structure, free bits */ 143 /* Unlink device structure, free bits */
153 *linkp = link->next;
154 kfree(link->priv); 144 kfree(link->priv);
155
156} /* aha152x_detach */ 145} /* aha152x_detach */
157 146
158/*====================================================================*/ 147/*====================================================================*/
@@ -230,7 +219,7 @@ static void aha152x_config_cs(dev_link_t *link)
230 } 219 }
231 220
232 sprintf(info->node.dev_name, "scsi%d", host->host_no); 221 sprintf(info->node.dev_name, "scsi%d", host->host_no);
233 link->dev = &info->node; 222 link->dev_node = &info->node;
234 info->host = host; 223 info->host = host;
235 224
236 link->state &= ~DEV_CONFIG_PENDING; 225 link->state &= ~DEV_CONFIG_PENDING;