diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-03-05 04:45:09 -0500 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-03-31 10:15:57 -0500 |
commit | fd238232cd0ff4840ae6946bb338502154096d88 (patch) | |
tree | d20e8f5871f7cff9d0867a84f6ba088fbffcbe28 /drivers/net/pcmcia/com20020_cs.c | |
parent | a78f4dd331a4f6a396eb5849656a4a72a70a56d7 (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/pcmcia/com20020_cs.c')
-rw-r--r-- | drivers/net/pcmcia/com20020_cs.c | 39 |
1 files changed, 15 insertions, 24 deletions
diff --git a/drivers/net/pcmcia/com20020_cs.c b/drivers/net/pcmcia/com20020_cs.c index e14d3d18b97d..44da01cdd26f 100644 --- a/drivers/net/pcmcia/com20020_cs.c +++ b/drivers/net/pcmcia/com20020_cs.c | |||
@@ -140,7 +140,6 @@ typedef struct com20020_dev_t { | |||
140 | 140 | ||
141 | static int com20020_attach(struct pcmcia_device *p_dev) | 141 | static int com20020_attach(struct pcmcia_device *p_dev) |
142 | { | 142 | { |
143 | dev_link_t *link; | ||
144 | com20020_dev_t *info; | 143 | com20020_dev_t *info; |
145 | struct net_device *dev; | 144 | struct net_device *dev; |
146 | struct arcnet_local *lp; | 145 | struct arcnet_local *lp; |
@@ -148,10 +147,6 @@ static int com20020_attach(struct pcmcia_device *p_dev) | |||
148 | DEBUG(0, "com20020_attach()\n"); | 147 | DEBUG(0, "com20020_attach()\n"); |
149 | 148 | ||
150 | /* Create new network device */ | 149 | /* Create new network device */ |
151 | link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL); | ||
152 | if (!link) | ||
153 | return -ENOMEM; | ||
154 | |||
155 | info = kmalloc(sizeof(struct com20020_dev_t), GFP_KERNEL); | 150 | info = kmalloc(sizeof(struct com20020_dev_t), GFP_KERNEL); |
156 | if (!info) | 151 | if (!info) |
157 | goto fail_alloc_info; | 152 | goto fail_alloc_info; |
@@ -161,7 +156,6 @@ static int com20020_attach(struct pcmcia_device *p_dev) | |||
161 | goto fail_alloc_dev; | 156 | goto fail_alloc_dev; |
162 | 157 | ||
163 | memset(info, 0, sizeof(struct com20020_dev_t)); | 158 | memset(info, 0, sizeof(struct com20020_dev_t)); |
164 | memset(link, 0, sizeof(struct dev_link_t)); | ||
165 | lp = dev->priv; | 159 | lp = dev->priv; |
166 | lp->timeout = timeout; | 160 | lp->timeout = timeout; |
167 | lp->backplane = backplane; | 161 | lp->backplane = backplane; |
@@ -172,27 +166,26 @@ static int com20020_attach(struct pcmcia_device *p_dev) | |||
172 | /* fill in our module parameters as defaults */ | 166 | /* fill in our module parameters as defaults */ |
173 | dev->dev_addr[0] = node; | 167 | dev->dev_addr[0] = node; |
174 | 168 | ||
175 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 169 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; |
176 | link->io.NumPorts1 = 16; | 170 | p_dev->io.NumPorts1 = 16; |
177 | link->io.IOAddrLines = 16; | 171 | p_dev->io.IOAddrLines = 16; |
178 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; | 172 | p_dev->irq.Attributes = IRQ_TYPE_EXCLUSIVE; |
179 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | 173 | p_dev->irq.IRQInfo1 = IRQ_LEVEL_ID; |
180 | link->conf.Attributes = CONF_ENABLE_IRQ; | 174 | p_dev->conf.Attributes = CONF_ENABLE_IRQ; |
181 | link->conf.IntType = INT_MEMORY_AND_IO; | 175 | p_dev->conf.IntType = INT_MEMORY_AND_IO; |
182 | link->conf.Present = PRESENT_OPTION; | 176 | p_dev->conf.Present = PRESENT_OPTION; |
183 | 177 | ||
184 | link->irq.Instance = info->dev = dev; | 178 | p_dev->irq.Instance = info->dev = dev; |
185 | link->priv = info; | 179 | p_dev->priv = info; |
186 | 180 | ||
187 | link->state |= DEV_PRESENT; | 181 | p_dev->state |= DEV_PRESENT; |
188 | com20020_config(link); | 182 | com20020_config(p_dev); |
189 | 183 | ||
190 | return 0; | 184 | return 0; |
191 | 185 | ||
192 | fail_alloc_dev: | 186 | fail_alloc_dev: |
193 | kfree(info); | 187 | kfree(info); |
194 | fail_alloc_info: | 188 | fail_alloc_info: |
195 | kfree(link); | ||
196 | return -ENOMEM; | 189 | return -ENOMEM; |
197 | } /* com20020_attach */ | 190 | } /* com20020_attach */ |
198 | 191 | ||
@@ -215,7 +208,7 @@ static void com20020_detach(struct pcmcia_device *p_dev) | |||
215 | 208 | ||
216 | DEBUG(0, "com20020_detach(0x%p)\n", link); | 209 | DEBUG(0, "com20020_detach(0x%p)\n", link); |
217 | 210 | ||
218 | if (link->dev) { | 211 | if (link->dev_node) { |
219 | DEBUG(1,"unregister...\n"); | 212 | DEBUG(1,"unregister...\n"); |
220 | 213 | ||
221 | unregister_netdev(dev); | 214 | unregister_netdev(dev); |
@@ -244,8 +237,6 @@ static void com20020_detach(struct pcmcia_device *p_dev) | |||
244 | DEBUG(1,"kfree2...\n"); | 237 | DEBUG(1,"kfree2...\n"); |
245 | kfree(info); | 238 | kfree(info); |
246 | } | 239 | } |
247 | DEBUG(1,"kfree3...\n"); | ||
248 | kfree(link); | ||
249 | 240 | ||
250 | } /* com20020_detach */ | 241 | } /* com20020_detach */ |
251 | 242 | ||
@@ -341,7 +332,7 @@ static void com20020_config(dev_link_t *link) | |||
341 | lp->card_name = "PCMCIA COM20020"; | 332 | lp->card_name = "PCMCIA COM20020"; |
342 | lp->card_flags = ARC_CAN_10MBIT; /* pretend all of them can 10Mbit */ | 333 | lp->card_flags = ARC_CAN_10MBIT; /* pretend all of them can 10Mbit */ |
343 | 334 | ||
344 | link->dev = &info->node; | 335 | link->dev_node = &info->node; |
345 | link->state &= ~DEV_CONFIG_PENDING; | 336 | link->state &= ~DEV_CONFIG_PENDING; |
346 | SET_NETDEV_DEV(dev, &handle_to_dev(handle)); | 337 | SET_NETDEV_DEV(dev, &handle_to_dev(handle)); |
347 | 338 | ||
@@ -349,7 +340,7 @@ static void com20020_config(dev_link_t *link) | |||
349 | 340 | ||
350 | if (i != 0) { | 341 | if (i != 0) { |
351 | DEBUG(1,KERN_NOTICE "com20020_cs: com20020_found() failed\n"); | 342 | DEBUG(1,KERN_NOTICE "com20020_cs: com20020_found() failed\n"); |
352 | link->dev = NULL; | 343 | link->dev_node = NULL; |
353 | goto failed; | 344 | goto failed; |
354 | } | 345 | } |
355 | 346 | ||