diff options
Diffstat (limited to 'drivers/pcmcia')
-rw-r--r-- | drivers/pcmcia/cs_internal.h | 3 | ||||
-rw-r--r-- | drivers/pcmcia/ds.c | 38 | ||||
-rw-r--r-- | drivers/pcmcia/socket_sysfs.c | 26 |
3 files changed, 47 insertions, 20 deletions
diff --git a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h index 211637390fbc..7830d7e42ea0 100644 --- a/drivers/pcmcia/cs_internal.h +++ b/drivers/pcmcia/cs_internal.h | |||
@@ -159,8 +159,7 @@ int pccard_access_configuration_register(struct pcmcia_socket *s, unsigned int f | |||
159 | struct pcmcia_callback{ | 159 | struct pcmcia_callback{ |
160 | struct module *owner; | 160 | struct module *owner; |
161 | int (*event) (struct pcmcia_socket *s, event_t event, int priority); | 161 | int (*event) (struct pcmcia_socket *s, event_t event, int priority); |
162 | int (*resources_done) (struct pcmcia_socket *s); | 162 | void (*requery) (struct pcmcia_socket *s); |
163 | void (*replace_cis) (void); | ||
164 | }; | 163 | }; |
165 | 164 | ||
166 | int pccard_register_pcmcia(struct pcmcia_socket *s, struct pcmcia_callback *c); | 165 | int pccard_register_pcmcia(struct pcmcia_socket *s, struct pcmcia_callback *c); |
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 0de0f2300457..bde9b0513d92 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c | |||
@@ -717,9 +717,42 @@ static inline void pcmcia_add_pseudo_device(struct pcmcia_bus_socket *s) | |||
717 | return; | 717 | return; |
718 | } | 718 | } |
719 | 719 | ||
720 | static void pcmcia_bus_rescan(void) | 720 | static int pcmcia_requery(struct device *dev, void * _data) |
721 | { | 721 | { |
722 | struct pcmcia_device *p_dev = to_pcmcia_dev(dev); | ||
723 | if (!p_dev->dev.driver) | ||
724 | pcmcia_device_query(p_dev); | ||
725 | |||
726 | return 0; | ||
727 | } | ||
728 | |||
729 | static void pcmcia_bus_rescan(struct pcmcia_socket *skt) | ||
730 | { | ||
731 | int no_devices=0; | ||
732 | unsigned long flags; | ||
733 | |||
722 | /* must be called with skt_sem held */ | 734 | /* must be called with skt_sem held */ |
735 | spin_lock_irqsave(&pcmcia_dev_list_lock, flags); | ||
736 | if (list_empty(&skt->pcmcia->devices_list)) | ||
737 | no_devices=1; | ||
738 | spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); | ||
739 | |||
740 | /* if no devices were added for this socket yet because of | ||
741 | * missing resource information or other trouble, we need to | ||
742 | * do this now. */ | ||
743 | if (no_devices) { | ||
744 | int ret = pcmcia_card_add(skt); | ||
745 | if (ret) | ||
746 | return; | ||
747 | } | ||
748 | |||
749 | /* some device information might have changed because of a CIS | ||
750 | * update or because we can finally read it correctly... so | ||
751 | * determine it again, overwriting old values if necessary. */ | ||
752 | bus_for_each_dev(&pcmcia_bus_type, NULL, NULL, pcmcia_requery); | ||
753 | |||
754 | /* we re-scan all devices, not just the ones connected to this | ||
755 | * socket. This does not matter, though. */ | ||
723 | bus_rescan_devices(&pcmcia_bus_type); | 756 | bus_rescan_devices(&pcmcia_bus_type); |
724 | } | 757 | } |
725 | 758 | ||
@@ -1861,8 +1894,7 @@ static int __devinit pcmcia_bus_add_socket(struct class_device *class_dev) | |||
1861 | /* Set up hotline to Card Services */ | 1894 | /* Set up hotline to Card Services */ |
1862 | s->callback.owner = THIS_MODULE; | 1895 | s->callback.owner = THIS_MODULE; |
1863 | s->callback.event = &ds_event; | 1896 | s->callback.event = &ds_event; |
1864 | s->callback.resources_done = &pcmcia_card_add; | 1897 | s->callback.requery = &pcmcia_bus_rescan; |
1865 | s->callback.replace_cis = &pcmcia_bus_rescan; | ||
1866 | socket->pcmcia = s; | 1898 | socket->pcmcia = s; |
1867 | 1899 | ||
1868 | ret = pccard_register_pcmcia(socket, &s->callback); | 1900 | ret = pccard_register_pcmcia(socket, &s->callback); |
diff --git a/drivers/pcmcia/socket_sysfs.c b/drivers/pcmcia/socket_sysfs.c index 8e66eeff672e..fcef54c1c2da 100644 --- a/drivers/pcmcia/socket_sysfs.c +++ b/drivers/pcmcia/socket_sysfs.c | |||
@@ -163,24 +163,20 @@ static ssize_t pccard_store_resource(struct class_device *dev, const char *buf, | |||
163 | return -EINVAL; | 163 | return -EINVAL; |
164 | 164 | ||
165 | spin_lock_irqsave(&s->lock, flags); | 165 | spin_lock_irqsave(&s->lock, flags); |
166 | if (!s->resource_setup_done) { | 166 | if (!s->resource_setup_done) |
167 | s->resource_setup_done = 1; | 167 | s->resource_setup_done = 1; |
168 | spin_unlock_irqrestore(&s->lock, flags); | 168 | spin_unlock_irqrestore(&s->lock, flags); |
169 | 169 | ||
170 | down(&s->skt_sem); | 170 | down(&s->skt_sem); |
171 | if ((s->callback) && | 171 | if ((s->callback) && |
172 | (s->state & SOCKET_PRESENT) && | 172 | (s->state & SOCKET_PRESENT) && |
173 | !(s->state & SOCKET_CARDBUS)) { | 173 | !(s->state & SOCKET_CARDBUS)) { |
174 | if (try_module_get(s->callback->owner)) { | 174 | if (try_module_get(s->callback->owner)) { |
175 | s->callback->resources_done(s); | 175 | s->callback->requery(s); |
176 | module_put(s->callback->owner); | 176 | module_put(s->callback->owner); |
177 | } | ||
178 | } | 177 | } |
179 | up(&s->skt_sem); | ||
180 | |||
181 | return count; | ||
182 | } | 178 | } |
183 | spin_unlock_irqrestore(&s->lock, flags); | 179 | up(&s->skt_sem); |
184 | 180 | ||
185 | return count; | 181 | return count; |
186 | } | 182 | } |
@@ -315,7 +311,7 @@ static ssize_t pccard_store_cis(struct kobject *kobj, char *buf, loff_t off, siz | |||
315 | if ((s->callback) && (s->state & SOCKET_PRESENT) && | 311 | if ((s->callback) && (s->state & SOCKET_PRESENT) && |
316 | !(s->state & SOCKET_CARDBUS)) { | 312 | !(s->state & SOCKET_CARDBUS)) { |
317 | if (try_module_get(s->callback->owner)) { | 313 | if (try_module_get(s->callback->owner)) { |
318 | s->callback->replace_cis(); | 314 | s->callback->requery(s); |
319 | module_put(s->callback->owner); | 315 | module_put(s->callback->owner); |
320 | } | 316 | } |
321 | } | 317 | } |