Skip to content

Commit b2ebd9d

Browse files
committed
driver core: Split device_platform_notify()
Split device_platform_notify_remove) out of device_platform_notify() and call the latter on device addition and the former on device removal. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <[email protected]> Reviewed-by: Greg Kroah-Hartman <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]>
1 parent 384f5a8 commit b2ebd9d

File tree

1 file changed

+16
-19
lines changed

1 file changed

+16
-19
lines changed

drivers/base/core.c

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2000,24 +2000,24 @@ static inline int device_is_not_partition(struct device *dev)
20002000
}
20012001
#endif
20022002

2003-
static int
2004-
device_platform_notify(struct device *dev, enum kobject_action action)
2003+
static void device_platform_notify(struct device *dev)
20052004
{
2006-
if (action == KOBJ_ADD)
2007-
acpi_device_notify(dev);
2008-
else if (action == KOBJ_REMOVE)
2009-
acpi_device_notify_remove(dev);
2005+
acpi_device_notify(dev);
20102006

2011-
if (action == KOBJ_ADD)
2012-
software_node_notify(dev);
2013-
else if (action == KOBJ_REMOVE)
2014-
software_node_notify_remove(dev);
2007+
software_node_notify(dev);
20152008

2016-
if (platform_notify && action == KOBJ_ADD)
2009+
if (platform_notify)
20172010
platform_notify(dev);
2018-
else if (platform_notify_remove && action == KOBJ_REMOVE)
2011+
}
2012+
2013+
static void device_platform_notify_remove(struct device *dev)
2014+
{
2015+
acpi_device_notify_remove(dev);
2016+
2017+
software_node_notify_remove(dev);
2018+
2019+
if (platform_notify_remove)
20192020
platform_notify_remove(dev);
2020-
return 0;
20212021
}
20222022

20232023
/**
@@ -3289,9 +3289,7 @@ int device_add(struct device *dev)
32893289
}
32903290

32913291
/* notify platform of device entry */
3292-
error = device_platform_notify(dev, KOBJ_ADD);
3293-
if (error)
3294-
goto platform_error;
3292+
device_platform_notify(dev);
32953293

32963294
error = device_create_file(dev, &dev_attr_uevent);
32973295
if (error)
@@ -3394,8 +3392,7 @@ int device_add(struct device *dev)
33943392
SymlinkError:
33953393
device_remove_file(dev, &dev_attr_uevent);
33963394
attrError:
3397-
device_platform_notify(dev, KOBJ_REMOVE);
3398-
platform_error:
3395+
device_platform_notify_remove(dev);
33993396
kobject_uevent(&dev->kobj, KOBJ_REMOVE);
34003397
glue_dir = get_glue_dir(dev);
34013398
kobject_del(&dev->kobj);
@@ -3540,7 +3537,7 @@ void device_del(struct device *dev)
35403537
bus_remove_device(dev);
35413538
device_pm_remove(dev);
35423539
driver_deferred_probe_del(dev);
3543-
device_platform_notify(dev, KOBJ_REMOVE);
3540+
device_platform_notify_remove(dev);
35443541
device_remove_properties(dev);
35453542
device_links_purge(dev);
35463543

0 commit comments

Comments
 (0)