Commit 4deb7c1e authored by Jeff Garzik's avatar Jeff Garzik Committed by Dominik Brodowski

[PATCH] PCMCIA: handle sysfs, PCI errors

Handle sysfs and PCI errors correctly.
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarDominik Brodowski <linux@dominikbrodowski.net>
parent 26aaa3c2
...@@ -128,9 +128,12 @@ static int proc_read_drivers(char *buf, char **start, off_t pos, ...@@ -128,9 +128,12 @@ static int proc_read_drivers(char *buf, char **start, off_t pos,
int count, int *eof, void *data) int count, int *eof, void *data)
{ {
char *p = buf; char *p = buf;
int rc;
bus_for_each_drv(&pcmcia_bus_type, NULL, rc = bus_for_each_drv(&pcmcia_bus_type, NULL,
(void *) &p, proc_read_drivers_callback); (void *) &p, proc_read_drivers_callback);
if (rc < 0)
return rc;
return (p - buf); return (p - buf);
} }
...@@ -269,8 +272,10 @@ rescan: ...@@ -269,8 +272,10 @@ rescan:
* Prevent this racing with a card insertion. * Prevent this racing with a card insertion.
*/ */
mutex_lock(&s->skt_mutex); mutex_lock(&s->skt_mutex);
bus_rescan_devices(&pcmcia_bus_type); ret = bus_rescan_devices(&pcmcia_bus_type);
mutex_unlock(&s->skt_mutex); mutex_unlock(&s->skt_mutex);
if (ret)
goto err_put_module;
/* check whether the driver indeed matched. I don't care if this /* check whether the driver indeed matched. I don't care if this
* is racy or not, because it can only happen on cardmgr access * is racy or not, because it can only happen on cardmgr access
......
...@@ -1197,8 +1197,12 @@ static int __devinit yenta_probe (struct pci_dev *dev, const struct pci_device_i ...@@ -1197,8 +1197,12 @@ static int __devinit yenta_probe (struct pci_dev *dev, const struct pci_device_i
ret = pcmcia_register_socket(&socket->socket); ret = pcmcia_register_socket(&socket->socket);
if (ret == 0) { if (ret == 0) {
/* Add the yenta register attributes */ /* Add the yenta register attributes */
device_create_file(&dev->dev, &dev_attr_yenta_registers); ret = device_create_file(&dev->dev, &dev_attr_yenta_registers);
if (ret == 0)
goto out; goto out;
/* error path... */
pcmcia_unregister_socket(&socket->socket);
} }
unmap: unmap:
...@@ -1248,12 +1252,18 @@ static int yenta_dev_resume (struct pci_dev *dev) ...@@ -1248,12 +1252,18 @@ static int yenta_dev_resume (struct pci_dev *dev)
struct yenta_socket *socket = pci_get_drvdata(dev); struct yenta_socket *socket = pci_get_drvdata(dev);
if (socket) { if (socket) {
int rc;
pci_set_power_state(dev, 0); pci_set_power_state(dev, 0);
/* FIXME: pci_restore_state needs to have a better interface */ /* FIXME: pci_restore_state needs to have a better interface */
pci_restore_state(dev); pci_restore_state(dev);
pci_write_config_dword(dev, 16*4, socket->saved_state[0]); pci_write_config_dword(dev, 16*4, socket->saved_state[0]);
pci_write_config_dword(dev, 17*4, socket->saved_state[1]); pci_write_config_dword(dev, 17*4, socket->saved_state[1]);
pci_enable_device(dev);
rc = pci_enable_device(dev);
if (rc)
return rc;
pci_set_master(dev); pci_set_master(dev);
if (socket->type && socket->type->restore_state) if (socket->type && socket->type->restore_state)
......
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