aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/pci-sysfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/pci-sysfs.c')
-rw-r--r--drivers/pci/pci-sysfs.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 276ef9c18802..4e0acefb7565 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -351,28 +351,17 @@ static struct device_attribute dev_rescan_attr = __ATTR(rescan,
351 (S_IWUSR|S_IWGRP), 351 (S_IWUSR|S_IWGRP),
352 NULL, dev_rescan_store); 352 NULL, dev_rescan_store);
353 353
354static void remove_callback(struct device *dev)
355{
356 pci_stop_and_remove_bus_device_locked(to_pci_dev(dev));
357}
358
359static ssize_t 354static ssize_t
360remove_store(struct device *dev, struct device_attribute *dummy, 355remove_store(struct device *dev, struct device_attribute *attr,
361 const char *buf, size_t count) 356 const char *buf, size_t count)
362{ 357{
363 int ret = 0;
364 unsigned long val; 358 unsigned long val;
365 359
366 if (kstrtoul(buf, 0, &val) < 0) 360 if (kstrtoul(buf, 0, &val) < 0)
367 return -EINVAL; 361 return -EINVAL;
368 362
369 /* An attribute cannot be unregistered by one of its own methods, 363 if (val && device_remove_file_self(dev, attr))
370 * so we have to use this roundabout approach. 364 pci_stop_and_remove_bus_device_locked(to_pci_dev(dev));
371 */
372 if (val)
373 ret = device_schedule_callback(dev, remove_callback);
374 if (ret)
375 count = ret;
376 return count; 365 return count;
377} 366}
378static struct device_attribute dev_remove_attr = __ATTR(remove, 367static struct device_attribute dev_remove_attr = __ATTR(remove,