diff options
author | Tejun Heo <tj@kernel.org> | 2014-02-03 14:03:04 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-02-07 18:42:41 -0500 |
commit | 0b60f9ead5d4816e7e3d6e28f4a0d22d4a1b2513 (patch) | |
tree | 2c46f7db6815641b51553b3c4bfa5a76e0ccd06d /arch | |
parent | ac0ece9174aca9aa895ce0accc54f1f8ff12d117 (diff) |
s390: use device_remove_file_self() instead of device_schedule_callback()
driver-core now supports synchrnous self-deletion of attributes and
the asynchrnous removal mechanism is scheduled for removal. Use it
instead of device_schedule_callback().
* Conversions in arch/s390/pci/pci_sysfs.c and
drivers/s390/block/dcssblk.c are straightforward.
* drivers/s390/cio/ccwgroup.c is a bit more tricky because
ccwgroup_notifier() was (ab)using device_schedule_callback() to
purely obtain a process context to kick off ungroup operation which
may block from a notifier callback.
Rename ccwgroup_ungroup_callback() to ccwgroup_ungroup() and make it
take ccwgroup_device * instead. The new function is now called
directly from ccwgroup_ungroup_store().
ccwgroup_notifier() chain is updated to explicitly bounce through
ccwgroup_device->ungroup_work. This also removes possible failure
from memory pressure.
Only compile-tested.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: linux390@de.ibm.com
Cc: linux-s390@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/s390/include/asm/ccwgroup.h | 1 | ||||
-rw-r--r-- | arch/s390/pci/pci_sysfs.c | 18 |
2 files changed, 9 insertions, 10 deletions
diff --git a/arch/s390/include/asm/ccwgroup.h b/arch/s390/include/asm/ccwgroup.h index 23723ce5ca7a..6e670f88d125 100644 --- a/arch/s390/include/asm/ccwgroup.h +++ b/arch/s390/include/asm/ccwgroup.h | |||
@@ -23,6 +23,7 @@ struct ccwgroup_device { | |||
23 | unsigned int count; | 23 | unsigned int count; |
24 | struct device dev; | 24 | struct device dev; |
25 | struct ccw_device *cdev[0]; | 25 | struct ccw_device *cdev[0]; |
26 | struct work_struct ungroup_work; | ||
26 | }; | 27 | }; |
27 | 28 | ||
28 | /** | 29 | /** |
diff --git a/arch/s390/pci/pci_sysfs.c b/arch/s390/pci/pci_sysfs.c index cf8a12ff733b..ab4a91393005 100644 --- a/arch/s390/pci/pci_sysfs.c +++ b/arch/s390/pci/pci_sysfs.c | |||
@@ -48,29 +48,27 @@ static ssize_t show_pfgid(struct device *dev, struct device_attribute *attr, | |||
48 | } | 48 | } |
49 | static DEVICE_ATTR(pfgid, S_IRUGO, show_pfgid, NULL); | 49 | static DEVICE_ATTR(pfgid, S_IRUGO, show_pfgid, NULL); |
50 | 50 | ||
51 | static void recover_callback(struct device *dev) | 51 | static ssize_t store_recover(struct device *dev, struct device_attribute *attr, |
52 | const char *buf, size_t count) | ||
52 | { | 53 | { |
53 | struct pci_dev *pdev = to_pci_dev(dev); | 54 | struct pci_dev *pdev = to_pci_dev(dev); |
54 | struct zpci_dev *zdev = get_zdev(pdev); | 55 | struct zpci_dev *zdev = get_zdev(pdev); |
55 | int ret; | 56 | int ret; |
56 | 57 | ||
58 | if (!device_remove_file_self(dev, attr)) | ||
59 | return count; | ||
60 | |||
57 | pci_stop_and_remove_bus_device(pdev); | 61 | pci_stop_and_remove_bus_device(pdev); |
58 | ret = zpci_disable_device(zdev); | 62 | ret = zpci_disable_device(zdev); |
59 | if (ret) | 63 | if (ret) |
60 | return; | 64 | return ret; |
61 | 65 | ||
62 | ret = zpci_enable_device(zdev); | 66 | ret = zpci_enable_device(zdev); |
63 | if (ret) | 67 | if (ret) |
64 | return; | 68 | return ret; |
65 | 69 | ||
66 | pci_rescan_bus(zdev->bus); | 70 | pci_rescan_bus(zdev->bus); |
67 | } | 71 | return count; |
68 | |||
69 | static ssize_t store_recover(struct device *dev, struct device_attribute *attr, | ||
70 | const char *buf, size_t count) | ||
71 | { | ||
72 | int rc = device_schedule_callback(dev, recover_callback); | ||
73 | return rc ? rc : count; | ||
74 | } | 72 | } |
75 | static DEVICE_ATTR(recover, S_IWUSR, NULL, store_recover); | 73 | static DEVICE_ATTR(recover, S_IWUSR, NULL, store_recover); |
76 | 74 | ||