diff options
author | Jeff Garzik <jeff@garzik.org> | 2006-10-20 17:44:23 -0400 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-10-25 21:59:46 -0400 |
commit | 4deb7c1ed2b622b565c5330b475adc5a6cea30da (patch) | |
tree | 0ba9b06a057224e602207e9e1079d7ad8cf4c646 | |
parent | 26aaa3c202fb3bec8d6c6619122442d476f55658 (diff) |
[PATCH] PCMCIA: handle sysfs, PCI errors
Handle sysfs and PCI errors correctly.
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
-rw-r--r-- | drivers/pcmcia/pcmcia_ioctl.c | 11 | ||||
-rw-r--r-- | drivers/pcmcia/yenta_socket.c | 16 |
2 files changed, 21 insertions, 6 deletions
diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c index 9ad18e62658d..310ede575caa 100644 --- a/drivers/pcmcia/pcmcia_ioctl.c +++ b/drivers/pcmcia/pcmcia_ioctl.c | |||
@@ -128,9 +128,12 @@ static int proc_read_drivers(char *buf, char **start, off_t pos, | |||
128 | int count, int *eof, void *data) | 128 | int count, int *eof, void *data) |
129 | { | 129 | { |
130 | char *p = buf; | 130 | char *p = buf; |
131 | int rc; | ||
131 | 132 | ||
132 | bus_for_each_drv(&pcmcia_bus_type, NULL, | 133 | rc = bus_for_each_drv(&pcmcia_bus_type, NULL, |
133 | (void *) &p, proc_read_drivers_callback); | 134 | (void *) &p, proc_read_drivers_callback); |
135 | if (rc < 0) | ||
136 | return rc; | ||
134 | 137 | ||
135 | return (p - buf); | 138 | return (p - buf); |
136 | } | 139 | } |
@@ -269,8 +272,10 @@ rescan: | |||
269 | * Prevent this racing with a card insertion. | 272 | * Prevent this racing with a card insertion. |
270 | */ | 273 | */ |
271 | mutex_lock(&s->skt_mutex); | 274 | mutex_lock(&s->skt_mutex); |
272 | bus_rescan_devices(&pcmcia_bus_type); | 275 | ret = bus_rescan_devices(&pcmcia_bus_type); |
273 | mutex_unlock(&s->skt_mutex); | 276 | mutex_unlock(&s->skt_mutex); |
277 | if (ret) | ||
278 | goto err_put_module; | ||
274 | 279 | ||
275 | /* check whether the driver indeed matched. I don't care if this | 280 | /* check whether the driver indeed matched. I don't care if this |
276 | * is racy or not, because it can only happen on cardmgr access | 281 | * is racy or not, because it can only happen on cardmgr access |
diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c index 9ced52ab7d14..da471bddc972 100644 --- a/drivers/pcmcia/yenta_socket.c +++ b/drivers/pcmcia/yenta_socket.c | |||
@@ -1197,8 +1197,12 @@ static int __devinit yenta_probe (struct pci_dev *dev, const struct pci_device_i | |||
1197 | ret = pcmcia_register_socket(&socket->socket); | 1197 | ret = pcmcia_register_socket(&socket->socket); |
1198 | if (ret == 0) { | 1198 | if (ret == 0) { |
1199 | /* Add the yenta register attributes */ | 1199 | /* Add the yenta register attributes */ |
1200 | device_create_file(&dev->dev, &dev_attr_yenta_registers); | 1200 | ret = device_create_file(&dev->dev, &dev_attr_yenta_registers); |
1201 | goto out; | 1201 | if (ret == 0) |
1202 | goto out; | ||
1203 | |||
1204 | /* error path... */ | ||
1205 | pcmcia_unregister_socket(&socket->socket); | ||
1202 | } | 1206 | } |
1203 | 1207 | ||
1204 | unmap: | 1208 | unmap: |
@@ -1248,12 +1252,18 @@ static int yenta_dev_resume (struct pci_dev *dev) | |||
1248 | struct yenta_socket *socket = pci_get_drvdata(dev); | 1252 | struct yenta_socket *socket = pci_get_drvdata(dev); |
1249 | 1253 | ||
1250 | if (socket) { | 1254 | if (socket) { |
1255 | int rc; | ||
1256 | |||
1251 | pci_set_power_state(dev, 0); | 1257 | pci_set_power_state(dev, 0); |
1252 | /* FIXME: pci_restore_state needs to have a better interface */ | 1258 | /* FIXME: pci_restore_state needs to have a better interface */ |
1253 | pci_restore_state(dev); | 1259 | pci_restore_state(dev); |
1254 | pci_write_config_dword(dev, 16*4, socket->saved_state[0]); | 1260 | pci_write_config_dword(dev, 16*4, socket->saved_state[0]); |
1255 | pci_write_config_dword(dev, 17*4, socket->saved_state[1]); | 1261 | pci_write_config_dword(dev, 17*4, socket->saved_state[1]); |
1256 | pci_enable_device(dev); | 1262 | |
1263 | rc = pci_enable_device(dev); | ||
1264 | if (rc) | ||
1265 | return rc; | ||
1266 | |||
1257 | pci_set_master(dev); | 1267 | pci_set_master(dev); |
1258 | 1268 | ||
1259 | if (socket->type && socket->type->restore_state) | 1269 | if (socket->type && socket->type->restore_state) |