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/uwb/lc-rc.c | |
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/uwb/lc-rc.c')
-rw-r--r-- | drivers/uwb/lc-rc.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/drivers/uwb/lc-rc.c b/drivers/uwb/lc-rc.c index 4d688c750801..3eca6ceb9844 100644 --- a/drivers/uwb/lc-rc.c +++ b/drivers/uwb/lc-rc.c | |||
@@ -40,9 +40,9 @@ | |||
40 | 40 | ||
41 | #include "uwb-internal.h" | 41 | #include "uwb-internal.h" |
42 | 42 | ||
43 | static int uwb_rc_index_match(struct device *dev, void *data) | 43 | static int uwb_rc_index_match(struct device *dev, const void *data) |
44 | { | 44 | { |
45 | int *index = data; | 45 | const int *index = data; |
46 | struct uwb_rc *rc = dev_get_drvdata(dev); | 46 | struct uwb_rc *rc = dev_get_drvdata(dev); |
47 | 47 | ||
48 | if (rc->index == *index) | 48 | if (rc->index == *index) |
@@ -334,9 +334,9 @@ void uwb_rc_rm(struct uwb_rc *rc) | |||
334 | } | 334 | } |
335 | EXPORT_SYMBOL_GPL(uwb_rc_rm); | 335 | EXPORT_SYMBOL_GPL(uwb_rc_rm); |
336 | 336 | ||
337 | static int find_rc_try_get(struct device *dev, void *data) | 337 | static int find_rc_try_get(struct device *dev, const void *data) |
338 | { | 338 | { |
339 | struct uwb_rc *target_rc = data; | 339 | const struct uwb_rc *target_rc = data; |
340 | struct uwb_rc *rc = dev_get_drvdata(dev); | 340 | struct uwb_rc *rc = dev_get_drvdata(dev); |
341 | 341 | ||
342 | if (rc == NULL) { | 342 | if (rc == NULL) { |
@@ -386,9 +386,9 @@ static inline struct uwb_rc *uwb_rc_get(struct uwb_rc *rc) | |||
386 | return rc; | 386 | return rc; |
387 | } | 387 | } |
388 | 388 | ||
389 | static int find_rc_grandpa(struct device *dev, void *data) | 389 | static int find_rc_grandpa(struct device *dev, const void *data) |
390 | { | 390 | { |
391 | struct device *grandpa_dev = data; | 391 | const struct device *grandpa_dev = data; |
392 | struct uwb_rc *rc = dev_get_drvdata(dev); | 392 | struct uwb_rc *rc = dev_get_drvdata(dev); |
393 | 393 | ||
394 | if (rc->uwb_dev.dev.parent->parent == grandpa_dev) { | 394 | if (rc->uwb_dev.dev.parent->parent == grandpa_dev) { |
@@ -419,7 +419,7 @@ struct uwb_rc *uwb_rc_get_by_grandpa(const struct device *grandpa_dev) | |||
419 | struct device *dev; | 419 | struct device *dev; |
420 | struct uwb_rc *rc = NULL; | 420 | struct uwb_rc *rc = NULL; |
421 | 421 | ||
422 | dev = class_find_device(&uwb_rc_class, NULL, (void *)grandpa_dev, | 422 | dev = class_find_device(&uwb_rc_class, NULL, grandpa_dev, |
423 | find_rc_grandpa); | 423 | find_rc_grandpa); |
424 | if (dev) | 424 | if (dev) |
425 | rc = dev_get_drvdata(dev); | 425 | rc = dev_get_drvdata(dev); |
@@ -432,9 +432,9 @@ EXPORT_SYMBOL_GPL(uwb_rc_get_by_grandpa); | |||
432 | * | 432 | * |
433 | * @returns the pointer to the radio controller, properly referenced | 433 | * @returns the pointer to the radio controller, properly referenced |
434 | */ | 434 | */ |
435 | static int find_rc_dev(struct device *dev, void *data) | 435 | static int find_rc_dev(struct device *dev, const void *data) |
436 | { | 436 | { |
437 | struct uwb_dev_addr *addr = data; | 437 | const struct uwb_dev_addr *addr = data; |
438 | struct uwb_rc *rc = dev_get_drvdata(dev); | 438 | struct uwb_rc *rc = dev_get_drvdata(dev); |
439 | 439 | ||
440 | if (rc == NULL) { | 440 | if (rc == NULL) { |
@@ -453,8 +453,7 @@ struct uwb_rc *uwb_rc_get_by_dev(const struct uwb_dev_addr *addr) | |||
453 | struct device *dev; | 453 | struct device *dev; |
454 | struct uwb_rc *rc = NULL; | 454 | struct uwb_rc *rc = NULL; |
455 | 455 | ||
456 | dev = class_find_device(&uwb_rc_class, NULL, (void *)addr, | 456 | dev = class_find_device(&uwb_rc_class, NULL, addr, find_rc_dev); |
457 | find_rc_dev); | ||
458 | if (dev) | 457 | if (dev) |
459 | rc = dev_get_drvdata(dev); | 458 | rc = dev_get_drvdata(dev); |
460 | 459 | ||