diff options
author | Jaroslav Kysela <perex@hera.kernel.org> | 2005-06-21 10:39:41 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@hera.kernel.org> | 2005-06-21 10:39:41 -0400 |
commit | fae6ec69c84d71b1d5bda9ede1a262c1681684aa (patch) | |
tree | eb4aff9a5c2b7d04ce09a3717bb1dd4a79fe7595 /drivers/pci/pci-driver.c | |
parent | bbc0274e9bb2e3f1d724d445a2bd32566b9b66f7 (diff) | |
parent | 1d345dac1f30af1cd9f3a1faa12f9f18f17f236e (diff) |
Merge with /pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Diffstat (limited to 'drivers/pci/pci-driver.c')
-rw-r--r-- | drivers/pci/pci-driver.c | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index fe98553c978f..e65bf2b395aa 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c | |||
@@ -335,13 +335,14 @@ pci_driver_attr_show(struct kobject * kobj, struct attribute *attr, char *buf) | |||
335 | { | 335 | { |
336 | struct device_driver *driver = kobj_to_pci_driver(kobj); | 336 | struct device_driver *driver = kobj_to_pci_driver(kobj); |
337 | struct driver_attribute *dattr = attr_to_driver_attribute(attr); | 337 | struct driver_attribute *dattr = attr_to_driver_attribute(attr); |
338 | ssize_t ret = 0; | 338 | ssize_t ret; |
339 | 339 | ||
340 | if (get_driver(driver)) { | 340 | if (!get_driver(driver)) |
341 | if (dattr->show) | 341 | return -ENODEV; |
342 | ret = dattr->show(driver, buf); | 342 | |
343 | put_driver(driver); | 343 | ret = dattr->show ? dattr->show(driver, buf) : -EIO; |
344 | } | 344 | |
345 | put_driver(driver); | ||
345 | return ret; | 346 | return ret; |
346 | } | 347 | } |
347 | 348 | ||
@@ -351,13 +352,14 @@ pci_driver_attr_store(struct kobject * kobj, struct attribute *attr, | |||
351 | { | 352 | { |
352 | struct device_driver *driver = kobj_to_pci_driver(kobj); | 353 | struct device_driver *driver = kobj_to_pci_driver(kobj); |
353 | struct driver_attribute *dattr = attr_to_driver_attribute(attr); | 354 | struct driver_attribute *dattr = attr_to_driver_attribute(attr); |
354 | ssize_t ret = 0; | 355 | ssize_t ret; |
355 | 356 | ||
356 | if (get_driver(driver)) { | 357 | if (!get_driver(driver)) |
357 | if (dattr->store) | 358 | return -ENODEV; |
358 | ret = dattr->store(driver, buf, count); | 359 | |
359 | put_driver(driver); | 360 | ret = dattr->store ? dattr->store(driver, buf, count) : -EIO; |
360 | } | 361 | |
362 | put_driver(driver); | ||
361 | return ret; | 363 | return ret; |
362 | } | 364 | } |
363 | 365 | ||
@@ -393,7 +395,10 @@ int pci_register_driver(struct pci_driver *drv) | |||
393 | drv->driver.bus = &pci_bus_type; | 395 | drv->driver.bus = &pci_bus_type; |
394 | drv->driver.probe = pci_device_probe; | 396 | drv->driver.probe = pci_device_probe; |
395 | drv->driver.remove = pci_device_remove; | 397 | drv->driver.remove = pci_device_remove; |
396 | drv->driver.shutdown = pci_device_shutdown, | 398 | /* FIXME, once all of the existing PCI drivers have been fixed to set |
399 | * the pci shutdown function, this test can go away. */ | ||
400 | if (!drv->driver.shutdown) | ||
401 | drv->driver.shutdown = pci_device_shutdown; | ||
397 | drv->driver.owner = drv->owner; | 402 | drv->driver.owner = drv->owner; |
398 | drv->driver.kobj.ktype = &pci_driver_kobj_type; | 403 | drv->driver.kobj.ktype = &pci_driver_kobj_type; |
399 | pci_init_dynids(&drv->dynids); | 404 | pci_init_dynids(&drv->dynids); |