diff options
Diffstat (limited to 'drivers/pcmcia/ds.c')
-rw-r--r-- | drivers/pcmcia/ds.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index ae10d1eed65e..74b3124e8247 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c | |||
@@ -236,11 +236,11 @@ static void pcmcia_check_driver(struct pcmcia_driver *p_drv) | |||
236 | /** | 236 | /** |
237 | * pcmcia_load_firmware - load CIS from userspace if device-provided is broken | 237 | * pcmcia_load_firmware - load CIS from userspace if device-provided is broken |
238 | * @dev - the pcmcia device which needs a CIS override | 238 | * @dev - the pcmcia device which needs a CIS override |
239 | * @filename - requested filename in /lib/firmware/cis/ | 239 | * @filename - requested filename in /lib/firmware/ |
240 | * | 240 | * |
241 | * This uses the in-kernel firmware loading mechanism to use a "fake CIS" if | 241 | * This uses the in-kernel firmware loading mechanism to use a "fake CIS" if |
242 | * the one provided by the card is broken. The firmware files reside in | 242 | * the one provided by the card is broken. The firmware files reside in |
243 | * /lib/firmware/cis/ in userspace. | 243 | * /lib/firmware/ in userspace. |
244 | */ | 244 | */ |
245 | static int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename) | 245 | static int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename) |
246 | { | 246 | { |
@@ -298,9 +298,6 @@ static inline int pcmcia_load_firmware(struct pcmcia_device *dev, char * filenam | |||
298 | * | 298 | * |
299 | * Registers a PCMCIA driver with the PCMCIA bus core. | 299 | * Registers a PCMCIA driver with the PCMCIA bus core. |
300 | */ | 300 | */ |
301 | static int pcmcia_device_probe(struct device *dev); | ||
302 | static int pcmcia_device_remove(struct device * dev); | ||
303 | |||
304 | int pcmcia_register_driver(struct pcmcia_driver *driver) | 301 | int pcmcia_register_driver(struct pcmcia_driver *driver) |
305 | { | 302 | { |
306 | if (!driver) | 303 | if (!driver) |
@@ -400,7 +397,7 @@ static int pcmcia_device_probe(struct device * dev) | |||
400 | * call which will then check whether there are two | 397 | * call which will then check whether there are two |
401 | * pseudo devices, and if not, add the second one. | 398 | * pseudo devices, and if not, add the second one. |
402 | */ | 399 | */ |
403 | did = (struct pcmcia_device_id *) p_dev->dev.driver_data; | 400 | did = p_dev->dev.driver_data; |
404 | if (did && (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) && | 401 | if (did && (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) && |
405 | (p_dev->socket->device_count == 1) && (p_dev->device_no == 0)) | 402 | (p_dev->socket->device_count == 1) && (p_dev->device_no == 0)) |
406 | pcmcia_add_pseudo_device(p_dev->socket); | 403 | pcmcia_add_pseudo_device(p_dev->socket); |
@@ -448,7 +445,6 @@ static void pcmcia_card_remove(struct pcmcia_socket *s, struct pcmcia_device *le | |||
448 | return; | 445 | return; |
449 | } | 446 | } |
450 | 447 | ||
451 | |||
452 | static int pcmcia_device_remove(struct device * dev) | 448 | static int pcmcia_device_remove(struct device * dev) |
453 | { | 449 | { |
454 | struct pcmcia_device *p_dev; | 450 | struct pcmcia_device *p_dev; |
@@ -463,7 +459,7 @@ static int pcmcia_device_remove(struct device * dev) | |||
463 | * pseudo multi-function card, we need to unbind | 459 | * pseudo multi-function card, we need to unbind |
464 | * all devices | 460 | * all devices |
465 | */ | 461 | */ |
466 | did = (struct pcmcia_device_id *) p_dev->dev.driver_data; | 462 | did = p_dev->dev.driver_data; |
467 | if (did && (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) && | 463 | if (did && (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) && |
468 | (p_dev->socket->device_count != 0) && | 464 | (p_dev->socket->device_count != 0) && |
469 | (p_dev->device_no == 0)) | 465 | (p_dev->device_no == 0)) |
@@ -476,6 +472,8 @@ static int pcmcia_device_remove(struct device * dev) | |||
476 | if (p_drv->remove) | 472 | if (p_drv->remove) |
477 | p_drv->remove(p_dev); | 473 | p_drv->remove(p_dev); |
478 | 474 | ||
475 | p_dev->dev_node = NULL; | ||
476 | |||
479 | /* check for proper unloading */ | 477 | /* check for proper unloading */ |
480 | if (p_dev->_irq || p_dev->_io || p_dev->_locked) | 478 | if (p_dev->_irq || p_dev->_io || p_dev->_locked) |
481 | printk(KERN_INFO "pcmcia: driver %s did not release config properly\n", | 479 | printk(KERN_INFO "pcmcia: driver %s did not release config properly\n", |
@@ -628,7 +626,7 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f | |||
628 | } | 626 | } |
629 | 627 | ||
630 | /* Add to the list in pcmcia_bus_socket */ | 628 | /* Add to the list in pcmcia_bus_socket */ |
631 | list_add_tail(&p_dev->socket_device_list, &s->devices_list); | 629 | list_add(&p_dev->socket_device_list, &s->devices_list); |
632 | 630 | ||
633 | spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); | 631 | spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); |
634 | 632 | ||
@@ -1145,6 +1143,12 @@ static int ds_event(struct pcmcia_socket *skt, event_t event, int priority) | |||
1145 | { | 1143 | { |
1146 | struct pcmcia_socket *s = pcmcia_get_socket(skt); | 1144 | struct pcmcia_socket *s = pcmcia_get_socket(skt); |
1147 | 1145 | ||
1146 | if (!s) { | ||
1147 | printk(KERN_ERR "PCMCIA obtaining reference to socket %p " \ | ||
1148 | "failed, event 0x%x lost!\n", skt, event); | ||
1149 | return -ENODEV; | ||
1150 | } | ||
1151 | |||
1148 | ds_dbg(1, "ds_event(0x%06x, %d, 0x%p)\n", | 1152 | ds_dbg(1, "ds_event(0x%06x, %d, 0x%p)\n", |
1149 | event, priority, skt); | 1153 | event, priority, skt); |
1150 | 1154 | ||