aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/atmel_cs.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/net/wireless/atmel_cs.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/net/wireless/atmel_cs.c')
-rw-r--r--drivers/net/wireless/atmel_cs.c33
1 files changed, 10 insertions, 23 deletions
diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c
index 53fdaa22226d..522bbed47a05 100644
--- a/drivers/net/wireless/atmel_cs.c
+++ b/drivers/net/wireless/atmel_cs.c
@@ -154,22 +154,14 @@ typedef struct local_info_t {
154 154
155static int atmel_attach(struct pcmcia_device *p_dev) 155static int atmel_attach(struct pcmcia_device *p_dev)
156{ 156{
157 dev_link_t *link;
158 local_info_t *local; 157 local_info_t *local;
159 158
160 DEBUG(0, "atmel_attach()\n"); 159 DEBUG(0, "atmel_attach()\n");
161 160
162 /* Initialize the dev_link_t structure */
163 link = kzalloc(sizeof(struct dev_link_t), GFP_KERNEL);
164 if (!link) {
165 printk(KERN_ERR "atmel_cs: no memory for new device\n");
166 return -ENOMEM;
167 }
168
169 /* Interrupt setup */ 161 /* Interrupt setup */
170 link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; 162 p_dev->irq.Attributes = IRQ_TYPE_EXCLUSIVE;
171 link->irq.IRQInfo1 = IRQ_LEVEL_ID; 163 p_dev->irq.IRQInfo1 = IRQ_LEVEL_ID;
172 link->irq.Handler = NULL; 164 p_dev->irq.Handler = NULL;
173 165
174 /* 166 /*
175 General socket configuration defaults can go here. In this 167 General socket configuration defaults can go here. In this
@@ -178,23 +170,19 @@ static int atmel_attach(struct pcmcia_device *p_dev)
178 and attributes of IO windows) are fixed by the nature of the 170 and attributes of IO windows) are fixed by the nature of the
179 device, and can be hard-wired here. 171 device, and can be hard-wired here.
180 */ 172 */
181 link->conf.Attributes = 0; 173 p_dev->conf.Attributes = 0;
182 link->conf.IntType = INT_MEMORY_AND_IO; 174 p_dev->conf.IntType = INT_MEMORY_AND_IO;
183 175
184 /* Allocate space for private device-specific data */ 176 /* Allocate space for private device-specific data */
185 local = kzalloc(sizeof(local_info_t), GFP_KERNEL); 177 local = kzalloc(sizeof(local_info_t), GFP_KERNEL);
186 if (!local) { 178 if (!local) {
187 printk(KERN_ERR "atmel_cs: no memory for new device\n"); 179 printk(KERN_ERR "atmel_cs: no memory for new device\n");
188 kfree (link);
189 return -ENOMEM; 180 return -ENOMEM;
190 } 181 }
191 link->priv = local; 182 p_dev->priv = local;
192
193 link->handle = p_dev;
194 p_dev->instance = link;
195 183
196 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 184 p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
197 atmel_config(link); 185 atmel_config(p_dev);
198 186
199 return 0; 187 return 0;
200} /* atmel_attach */ 188} /* atmel_attach */
@@ -218,7 +206,6 @@ static void atmel_detach(struct pcmcia_device *p_dev)
218 atmel_release(link); 206 atmel_release(link);
219 207
220 kfree(link->priv); 208 kfree(link->priv);
221 kfree(link);
222} 209}
223 210
224/*====================================================================== 211/*======================================================================
@@ -387,11 +374,11 @@ static void atmel_config(dev_link_t *link)
387 374
388 /* 375 /*
389 At this point, the dev_node_t structure(s) need to be 376 At this point, the dev_node_t structure(s) need to be
390 initialized and arranged in a linked list at link->dev. 377 initialized and arranged in a linked list at link->dev_node.
391 */ 378 */
392 strcpy(dev->node.dev_name, ((local_info_t*)link->priv)->eth_dev->name ); 379 strcpy(dev->node.dev_name, ((local_info_t*)link->priv)->eth_dev->name );
393 dev->node.major = dev->node.minor = 0; 380 dev->node.major = dev->node.minor = 0;
394 link->dev = &dev->node; 381 link->dev_node = &dev->node;
395 382
396 link->state &= ~DEV_CONFIG_PENDING; 383 link->state &= ~DEV_CONFIG_PENDING;
397 return; 384 return;