diff options
Diffstat (limited to 'drivers/pcmcia/ds.c')
-rw-r--r-- | drivers/pcmcia/ds.c | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 74b3124e8247..21d83a895b21 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c | |||
@@ -717,6 +717,7 @@ static int pcmcia_requery(struct device *dev, void * _data) | |||
717 | static void pcmcia_bus_rescan(struct pcmcia_socket *skt) | 717 | static void pcmcia_bus_rescan(struct pcmcia_socket *skt) |
718 | { | 718 | { |
719 | int no_devices=0; | 719 | int no_devices=0; |
720 | int ret = 0; | ||
720 | unsigned long flags; | 721 | unsigned long flags; |
721 | 722 | ||
722 | /* must be called with skt_mutex held */ | 723 | /* must be called with skt_mutex held */ |
@@ -729,7 +730,7 @@ static void pcmcia_bus_rescan(struct pcmcia_socket *skt) | |||
729 | * missing resource information or other trouble, we need to | 730 | * missing resource information or other trouble, we need to |
730 | * do this now. */ | 731 | * do this now. */ |
731 | if (no_devices) { | 732 | if (no_devices) { |
732 | int ret = pcmcia_card_add(skt); | 733 | ret = pcmcia_card_add(skt); |
733 | if (ret) | 734 | if (ret) |
734 | return; | 735 | return; |
735 | } | 736 | } |
@@ -741,7 +742,9 @@ static void pcmcia_bus_rescan(struct pcmcia_socket *skt) | |||
741 | 742 | ||
742 | /* we re-scan all devices, not just the ones connected to this | 743 | /* we re-scan all devices, not just the ones connected to this |
743 | * socket. This does not matter, though. */ | 744 | * socket. This does not matter, though. */ |
744 | bus_rescan_devices(&pcmcia_bus_type); | 745 | ret = bus_rescan_devices(&pcmcia_bus_type); |
746 | if (ret) | ||
747 | printk(KERN_INFO "pcmcia: bus_rescan_devices failed\n"); | ||
745 | } | 748 | } |
746 | 749 | ||
747 | static inline int pcmcia_devmatch(struct pcmcia_device *dev, | 750 | static inline int pcmcia_devmatch(struct pcmcia_device *dev, |
@@ -1001,6 +1004,7 @@ static ssize_t pcmcia_store_allow_func_id_match(struct device *dev, | |||
1001 | struct device_attribute *attr, const char *buf, size_t count) | 1004 | struct device_attribute *attr, const char *buf, size_t count) |
1002 | { | 1005 | { |
1003 | struct pcmcia_device *p_dev = to_pcmcia_dev(dev); | 1006 | struct pcmcia_device *p_dev = to_pcmcia_dev(dev); |
1007 | int ret; | ||
1004 | 1008 | ||
1005 | if (!count) | 1009 | if (!count) |
1006 | return -EINVAL; | 1010 | return -EINVAL; |
@@ -1009,7 +1013,10 @@ static ssize_t pcmcia_store_allow_func_id_match(struct device *dev, | |||
1009 | p_dev->allow_func_id_match = 1; | 1013 | p_dev->allow_func_id_match = 1; |
1010 | mutex_unlock(&p_dev->socket->skt_mutex); | 1014 | mutex_unlock(&p_dev->socket->skt_mutex); |
1011 | 1015 | ||
1012 | bus_rescan_devices(&pcmcia_bus_type); | 1016 | ret = bus_rescan_devices(&pcmcia_bus_type); |
1017 | if (ret) | ||
1018 | printk(KERN_INFO "pcmcia: bus_rescan_devices failed after " | ||
1019 | "allowing func_id matches\n"); | ||
1013 | 1020 | ||
1014 | return count; | 1021 | return count; |
1015 | } | 1022 | } |
@@ -1264,6 +1271,11 @@ static void pcmcia_bus_remove_socket(struct class_device *class_dev, | |||
1264 | socket->pcmcia_state.dead = 1; | 1271 | socket->pcmcia_state.dead = 1; |
1265 | pccard_register_pcmcia(socket, NULL); | 1272 | pccard_register_pcmcia(socket, NULL); |
1266 | 1273 | ||
1274 | /* unregister any unbound devices */ | ||
1275 | mutex_lock(&socket->skt_mutex); | ||
1276 | pcmcia_card_remove(socket, NULL); | ||
1277 | mutex_unlock(&socket->skt_mutex); | ||
1278 | |||
1267 | pcmcia_put_socket(socket); | 1279 | pcmcia_put_socket(socket); |
1268 | 1280 | ||
1269 | return; | 1281 | return; |
@@ -1292,10 +1304,22 @@ struct bus_type pcmcia_bus_type = { | |||
1292 | 1304 | ||
1293 | static int __init init_pcmcia_bus(void) | 1305 | static int __init init_pcmcia_bus(void) |
1294 | { | 1306 | { |
1307 | int ret; | ||
1308 | |||
1295 | spin_lock_init(&pcmcia_dev_list_lock); | 1309 | spin_lock_init(&pcmcia_dev_list_lock); |
1296 | 1310 | ||
1297 | bus_register(&pcmcia_bus_type); | 1311 | ret = bus_register(&pcmcia_bus_type); |
1298 | class_interface_register(&pcmcia_bus_interface); | 1312 | if (ret < 0) { |
1313 | printk(KERN_WARNING "pcmcia: bus_register error: %d\n", ret); | ||
1314 | return ret; | ||
1315 | } | ||
1316 | ret = class_interface_register(&pcmcia_bus_interface); | ||
1317 | if (ret < 0) { | ||
1318 | printk(KERN_WARNING | ||
1319 | "pcmcia: class_interface_register error: %d\n", ret); | ||
1320 | bus_unregister(&pcmcia_bus_type); | ||
1321 | return ret; | ||
1322 | } | ||
1299 | 1323 | ||
1300 | pcmcia_setup_ioctl(); | 1324 | pcmcia_setup_ioctl(); |
1301 | 1325 | ||