diff options
author | Michał Mirosław <mirq-linux@rere.qmqm.pl> | 2013-02-01 14:40:17 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-02-06 15:18:56 -0500 |
commit | 9f3b795a626ee79574595e06d1437fe0c7d51d29 (patch) | |
tree | 1952cb2ac880c0e66f291916815c2a36b4ceb300 /drivers/power | |
parent | 807be03cae191cb88e2f267adcd49aba785c658b (diff) |
driver-core: constify data for class_find_device()
All in-kernel users of class_find_device() don't really need mutable
data for match callback.
In two places (kernel/power/suspend_test.c, drivers/scsi/osd/osd_uld.c)
this patch changes match callbacks to use const search data.
The const is propagated to rtc_class_open() and power_supply_get_by_name()
parameters.
Note that there's a dev reference leak in suspend_test.c that's not
touched in this patch.
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/power')
-rw-r--r-- | drivers/power/power_supply_core.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/power/power_supply_core.c b/drivers/power/power_supply_core.c index 8a7cfb3cc166..5deac432e2ae 100644 --- a/drivers/power/power_supply_core.c +++ b/drivers/power/power_supply_core.c | |||
@@ -141,7 +141,7 @@ int power_supply_set_battery_charged(struct power_supply *psy) | |||
141 | } | 141 | } |
142 | EXPORT_SYMBOL_GPL(power_supply_set_battery_charged); | 142 | EXPORT_SYMBOL_GPL(power_supply_set_battery_charged); |
143 | 143 | ||
144 | static int power_supply_match_device_by_name(struct device *dev, void *data) | 144 | static int power_supply_match_device_by_name(struct device *dev, const void *data) |
145 | { | 145 | { |
146 | const char *name = data; | 146 | const char *name = data; |
147 | struct power_supply *psy = dev_get_drvdata(dev); | 147 | struct power_supply *psy = dev_get_drvdata(dev); |
@@ -149,7 +149,7 @@ static int power_supply_match_device_by_name(struct device *dev, void *data) | |||
149 | return strcmp(psy->name, name) == 0; | 149 | return strcmp(psy->name, name) == 0; |
150 | } | 150 | } |
151 | 151 | ||
152 | struct power_supply *power_supply_get_by_name(char *name) | 152 | struct power_supply *power_supply_get_by_name(const char *name) |
153 | { | 153 | { |
154 | struct device *dev = class_find_device(power_supply_class, NULL, name, | 154 | struct device *dev = class_find_device(power_supply_class, NULL, name, |
155 | power_supply_match_device_by_name); | 155 | power_supply_match_device_by_name); |