Commit 4ae1cbf1 authored by Dominik Brodowski's avatar Dominik Brodowski

[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: default avatarDominik Brodowski <linux@dominikbrodowski.net>
parent 5eb5fc97
...@@ -135,7 +135,7 @@ int pccard_get_status(struct pcmcia_socket *s, struct pcmcia_device *p_dev, cs_s ...@@ -135,7 +135,7 @@ int pccard_get_status(struct pcmcia_socket *s, struct pcmcia_device *p_dev, cs_s
struct pcmcia_callback{ struct pcmcia_callback{
struct module *owner; struct module *owner;
int (*event) (struct pcmcia_socket *s, event_t event, int priority); int (*event) (struct pcmcia_socket *s, event_t event, int priority);
void (*requery) (struct pcmcia_socket *s); void (*requery) (struct pcmcia_socket *s, int new_cis);
int (*suspend) (struct pcmcia_socket *s); int (*suspend) (struct pcmcia_socket *s);
int (*resume) (struct pcmcia_socket *s); int (*resume) (struct pcmcia_socket *s);
}; };
......
...@@ -714,22 +714,26 @@ static int pcmcia_requery(struct device *dev, void * _data) ...@@ -714,22 +714,26 @@ static int pcmcia_requery(struct device *dev, void * _data)
return 0; return 0;
} }
static void pcmcia_bus_rescan(struct pcmcia_socket *skt) static void pcmcia_bus_rescan(struct pcmcia_socket *skt, int new_cis)
{ {
int no_devices=0; int no_devices = 0;
int ret = 0; int ret = 0;
unsigned long flags; unsigned long flags;
/* must be called with skt_mutex held */ /* must be called with skt_mutex held */
spin_lock_irqsave(&pcmcia_dev_list_lock, flags); spin_lock_irqsave(&pcmcia_dev_list_lock, flags);
if (list_empty(&skt->devices_list)) if (list_empty(&skt->devices_list))
no_devices=1; no_devices = 1;
spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags);
/* If this is because of a CIS override, start over */
if (new_cis && !no_devices)
pcmcia_card_remove(skt, NULL);
/* if no devices were added for this socket yet because of /* if no devices were added for this socket yet because of
* missing resource information or other trouble, we need to * missing resource information or other trouble, we need to
* do this now. */ * do this now. */
if (no_devices) { if (no_devices || new_cis) {
ret = pcmcia_card_add(skt); ret = pcmcia_card_add(skt);
if (ret) if (ret)
return; return;
......
...@@ -188,7 +188,7 @@ static ssize_t pccard_store_resource(struct class_device *dev, const char *buf, ...@@ -188,7 +188,7 @@ static ssize_t pccard_store_resource(struct class_device *dev, const char *buf,
(s->state & SOCKET_PRESENT) && (s->state & SOCKET_PRESENT) &&
!(s->state & SOCKET_CARDBUS)) { !(s->state & SOCKET_CARDBUS)) {
if (try_module_get(s->callback->owner)) { if (try_module_get(s->callback->owner)) {
s->callback->requery(s); s->callback->requery(s, 0);
module_put(s->callback->owner); module_put(s->callback->owner);
} }
} }
...@@ -325,7 +325,7 @@ static ssize_t pccard_store_cis(struct kobject *kobj, char *buf, loff_t off, siz ...@@ -325,7 +325,7 @@ static ssize_t pccard_store_cis(struct kobject *kobj, char *buf, loff_t off, siz
if ((s->callback) && (s->state & SOCKET_PRESENT) && if ((s->callback) && (s->state & SOCKET_PRESENT) &&
!(s->state & SOCKET_CARDBUS)) { !(s->state & SOCKET_CARDBUS)) {
if (try_module_get(s->callback->owner)) { if (try_module_get(s->callback->owner)) {
s->callback->requery(s); s->callback->requery(s, 1);
module_put(s->callback->owner); module_put(s->callback->owner);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment