diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-11-03 10:54:00 -0500 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-12-04 20:09:14 -0500 |
commit | 4ae1cbf17d14ba6fd316a94b290ea4e741cba15c (patch) | |
tree | 56c5f6939fd486b6041945497d2d541e76b0e1e6 | |
parent | 5eb5fc97d83ee1f8fcf3490bb81ad14a99fc544c (diff) |
[PATCH] pcmcia: start over after CIS override
When overriding the CIS, re-start the configuration of the card from
scratch. Reported and debugged by Fabrice Bellet <fabrice@bellet.info>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
-rw-r--r-- | drivers/pcmcia/cs_internal.h | 2 | ||||
-rw-r--r-- | drivers/pcmcia/ds.c | 12 | ||||
-rw-r--r-- | drivers/pcmcia/socket_sysfs.c | 4 |
3 files changed, 11 insertions, 7 deletions
diff --git a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h index d6164cd583fd..f573ea04db6f 100644 --- a/drivers/pcmcia/cs_internal.h +++ b/drivers/pcmcia/cs_internal.h | |||
@@ -135,7 +135,7 @@ int pccard_get_status(struct pcmcia_socket *s, struct pcmcia_device *p_dev, cs_s | |||
135 | struct pcmcia_callback{ | 135 | struct pcmcia_callback{ |
136 | struct module *owner; | 136 | struct module *owner; |
137 | int (*event) (struct pcmcia_socket *s, event_t event, int priority); | 137 | int (*event) (struct pcmcia_socket *s, event_t event, int priority); |
138 | void (*requery) (struct pcmcia_socket *s); | 138 | void (*requery) (struct pcmcia_socket *s, int new_cis); |
139 | int (*suspend) (struct pcmcia_socket *s); | 139 | int (*suspend) (struct pcmcia_socket *s); |
140 | int (*resume) (struct pcmcia_socket *s); | 140 | int (*resume) (struct pcmcia_socket *s); |
141 | }; | 141 | }; |
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 21d83a895b21..7f6e94cd067a 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c | |||
@@ -714,22 +714,26 @@ static int pcmcia_requery(struct device *dev, void * _data) | |||
714 | return 0; | 714 | return 0; |
715 | } | 715 | } |
716 | 716 | ||
717 | static void pcmcia_bus_rescan(struct pcmcia_socket *skt) | 717 | static void pcmcia_bus_rescan(struct pcmcia_socket *skt, int new_cis) |
718 | { | 718 | { |
719 | int no_devices=0; | 719 | int no_devices = 0; |
720 | int ret = 0; | 720 | int ret = 0; |
721 | unsigned long flags; | 721 | unsigned long flags; |
722 | 722 | ||
723 | /* must be called with skt_mutex held */ | 723 | /* must be called with skt_mutex held */ |
724 | spin_lock_irqsave(&pcmcia_dev_list_lock, flags); | 724 | spin_lock_irqsave(&pcmcia_dev_list_lock, flags); |
725 | if (list_empty(&skt->devices_list)) | 725 | if (list_empty(&skt->devices_list)) |
726 | no_devices=1; | 726 | no_devices = 1; |
727 | spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); | 727 | spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); |
728 | 728 | ||
729 | /* If this is because of a CIS override, start over */ | ||
730 | if (new_cis && !no_devices) | ||
731 | pcmcia_card_remove(skt, NULL); | ||
732 | |||
729 | /* if no devices were added for this socket yet because of | 733 | /* if no devices were added for this socket yet because of |
730 | * missing resource information or other trouble, we need to | 734 | * missing resource information or other trouble, we need to |
731 | * do this now. */ | 735 | * do this now. */ |
732 | if (no_devices) { | 736 | if (no_devices || new_cis) { |
733 | ret = pcmcia_card_add(skt); | 737 | ret = pcmcia_card_add(skt); |
734 | if (ret) | 738 | if (ret) |
735 | return; | 739 | return; |
diff --git a/drivers/pcmcia/socket_sysfs.c b/drivers/pcmcia/socket_sysfs.c index 933cd864a5c9..b005602d6b53 100644 --- a/drivers/pcmcia/socket_sysfs.c +++ b/drivers/pcmcia/socket_sysfs.c | |||
@@ -188,7 +188,7 @@ static ssize_t pccard_store_resource(struct class_device *dev, const char *buf, | |||
188 | (s->state & SOCKET_PRESENT) && | 188 | (s->state & SOCKET_PRESENT) && |
189 | !(s->state & SOCKET_CARDBUS)) { | 189 | !(s->state & SOCKET_CARDBUS)) { |
190 | if (try_module_get(s->callback->owner)) { | 190 | if (try_module_get(s->callback->owner)) { |
191 | s->callback->requery(s); | 191 | s->callback->requery(s, 0); |
192 | module_put(s->callback->owner); | 192 | module_put(s->callback->owner); |
193 | } | 193 | } |
194 | } | 194 | } |
@@ -325,7 +325,7 @@ static ssize_t pccard_store_cis(struct kobject *kobj, char *buf, loff_t off, siz | |||
325 | if ((s->callback) && (s->state & SOCKET_PRESENT) && | 325 | if ((s->callback) && (s->state & SOCKET_PRESENT) && |
326 | !(s->state & SOCKET_CARDBUS)) { | 326 | !(s->state & SOCKET_CARDBUS)) { |
327 | if (try_module_get(s->callback->owner)) { | 327 | if (try_module_get(s->callback->owner)) { |
328 | s->callback->requery(s); | 328 | s->callback->requery(s, 1); |
329 | module_put(s->callback->owner); | 329 | module_put(s->callback->owner); |
330 | } | 330 | } |
331 | } | 331 | } |