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 | |
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>
-rw-r--r-- | drivers/base/class.c | 4 | ||||
-rw-r--r-- | drivers/base/core.c | 4 | ||||
-rw-r--r-- | drivers/gpio/gpiolib.c | 2 | ||||
-rw-r--r-- | drivers/isdn/mISDN/core.c | 4 | ||||
-rw-r--r-- | drivers/net/phy/mdio_bus.c | 2 | ||||
-rw-r--r-- | drivers/power/power_supply_core.c | 4 | ||||
-rw-r--r-- | drivers/rtc/interface.c | 6 | ||||
-rw-r--r-- | drivers/scsi/hosts.c | 4 | ||||
-rw-r--r-- | drivers/scsi/osd/osd_uld.c | 26 | ||||
-rw-r--r-- | drivers/scsi/scsi_transport_iscsi.c | 4 | ||||
-rw-r--r-- | drivers/spi/spi.c | 4 | ||||
-rw-r--r-- | drivers/uwb/lc-rc.c | 21 | ||||
-rw-r--r-- | include/linux/device.h | 4 | ||||
-rw-r--r-- | include/linux/power_supply.h | 2 | ||||
-rw-r--r-- | include/linux/rtc.h | 2 | ||||
-rw-r--r-- | init/do_mounts.c | 4 | ||||
-rw-r--r-- | kernel/power/suspend_test.c | 11 | ||||
-rw-r--r-- | net/ieee802154/wpan-class.c | 5 | ||||
-rw-r--r-- | net/nfc/core.c | 4 |
19 files changed, 53 insertions, 64 deletions
diff --git a/drivers/base/class.c b/drivers/base/class.c index 03243d4002fd..3ce845471327 100644 --- a/drivers/base/class.c +++ b/drivers/base/class.c | |||
@@ -420,8 +420,8 @@ EXPORT_SYMBOL_GPL(class_for_each_device); | |||
420 | * code. There's no locking restriction. | 420 | * code. There's no locking restriction. |
421 | */ | 421 | */ |
422 | struct device *class_find_device(struct class *class, struct device *start, | 422 | struct device *class_find_device(struct class *class, struct device *start, |
423 | void *data, | 423 | const void *data, |
424 | int (*match)(struct device *, void *)) | 424 | int (*match)(struct device *, const void *)) |
425 | { | 425 | { |
426 | struct class_dev_iter iter; | 426 | struct class_dev_iter iter; |
427 | struct device *dev; | 427 | struct device *dev; |
diff --git a/drivers/base/core.c b/drivers/base/core.c index 27603a6c0a93..56536f4b0f6b 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -1617,9 +1617,9 @@ struct device *device_create(struct class *class, struct device *parent, | |||
1617 | } | 1617 | } |
1618 | EXPORT_SYMBOL_GPL(device_create); | 1618 | EXPORT_SYMBOL_GPL(device_create); |
1619 | 1619 | ||
1620 | static int __match_devt(struct device *dev, void *data) | 1620 | static int __match_devt(struct device *dev, const void *data) |
1621 | { | 1621 | { |
1622 | dev_t *devt = data; | 1622 | const dev_t *devt = data; |
1623 | 1623 | ||
1624 | return dev->devt == *devt; | 1624 | return dev->devt == *devt; |
1625 | } | 1625 | } |
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 199fca15f270..5359ca78130f 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
@@ -806,7 +806,7 @@ fail_unlock: | |||
806 | } | 806 | } |
807 | EXPORT_SYMBOL_GPL(gpio_export); | 807 | EXPORT_SYMBOL_GPL(gpio_export); |
808 | 808 | ||
809 | static int match_export(struct device *dev, void *data) | 809 | static int match_export(struct device *dev, const void *data) |
810 | { | 810 | { |
811 | return dev_get_drvdata(dev) == data; | 811 | return dev_get_drvdata(dev) == data; |
812 | } | 812 | } |
diff --git a/drivers/isdn/mISDN/core.c b/drivers/isdn/mISDN/core.c index 3e245712bba7..da30c5cb9609 100644 --- a/drivers/isdn/mISDN/core.c +++ b/drivers/isdn/mISDN/core.c | |||
@@ -168,13 +168,13 @@ static struct class mISDN_class = { | |||
168 | }; | 168 | }; |
169 | 169 | ||
170 | static int | 170 | static int |
171 | _get_mdevice(struct device *dev, void *id) | 171 | _get_mdevice(struct device *dev, const void *id) |
172 | { | 172 | { |
173 | struct mISDNdevice *mdev = dev_to_mISDN(dev); | 173 | struct mISDNdevice *mdev = dev_to_mISDN(dev); |
174 | 174 | ||
175 | if (!mdev) | 175 | if (!mdev) |
176 | return 0; | 176 | return 0; |
177 | if (mdev->id != *(u_int *)id) | 177 | if (mdev->id != *(const u_int *)id) |
178 | return 0; | 178 | return 0; |
179 | return 1; | 179 | return 1; |
180 | } | 180 | } |
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index 044b5326459f..dc920974204e 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c | |||
@@ -95,7 +95,7 @@ static struct class mdio_bus_class = { | |||
95 | 95 | ||
96 | #if IS_ENABLED(CONFIG_OF_MDIO) | 96 | #if IS_ENABLED(CONFIG_OF_MDIO) |
97 | /* Helper function for of_mdio_find_bus */ | 97 | /* Helper function for of_mdio_find_bus */ |
98 | static int of_mdio_bus_match(struct device *dev, void *mdio_bus_np) | 98 | static int of_mdio_bus_match(struct device *dev, const void *mdio_bus_np) |
99 | { | 99 | { |
100 | return dev->of_node == mdio_bus_np; | 100 | return dev->of_node == mdio_bus_np; |
101 | } | 101 | } |
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); |
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c index 9592b936b71b..42bd57da239d 100644 --- a/drivers/rtc/interface.c +++ b/drivers/rtc/interface.c | |||
@@ -587,16 +587,16 @@ void rtc_update_irq(struct rtc_device *rtc, | |||
587 | } | 587 | } |
588 | EXPORT_SYMBOL_GPL(rtc_update_irq); | 588 | EXPORT_SYMBOL_GPL(rtc_update_irq); |
589 | 589 | ||
590 | static int __rtc_match(struct device *dev, void *data) | 590 | static int __rtc_match(struct device *dev, const void *data) |
591 | { | 591 | { |
592 | char *name = (char *)data; | 592 | const char *name = data; |
593 | 593 | ||
594 | if (strcmp(dev_name(dev), name) == 0) | 594 | if (strcmp(dev_name(dev), name) == 0) |
595 | return 1; | 595 | return 1; |
596 | return 0; | 596 | return 0; |
597 | } | 597 | } |
598 | 598 | ||
599 | struct rtc_device *rtc_class_open(char *name) | 599 | struct rtc_device *rtc_class_open(const char *name) |
600 | { | 600 | { |
601 | struct device *dev; | 601 | struct device *dev; |
602 | struct rtc_device *rtc = NULL; | 602 | struct rtc_device *rtc = NULL; |
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index 593085a52275..df0c3c71ea43 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c | |||
@@ -468,10 +468,10 @@ void scsi_unregister(struct Scsi_Host *shost) | |||
468 | } | 468 | } |
469 | EXPORT_SYMBOL(scsi_unregister); | 469 | EXPORT_SYMBOL(scsi_unregister); |
470 | 470 | ||
471 | static int __scsi_host_match(struct device *dev, void *data) | 471 | static int __scsi_host_match(struct device *dev, const void *data) |
472 | { | 472 | { |
473 | struct Scsi_Host *p; | 473 | struct Scsi_Host *p; |
474 | unsigned short *hostnum = (unsigned short *)data; | 474 | const unsigned short *hostnum = data; |
475 | 475 | ||
476 | p = class_to_shost(dev); | 476 | p = class_to_shost(dev); |
477 | return p->host_no == *hostnum; | 477 | return p->host_no == *hostnum; |
diff --git a/drivers/scsi/osd/osd_uld.c b/drivers/scsi/osd/osd_uld.c index 43754176a7b7..0fab6b5c7b82 100644 --- a/drivers/scsi/osd/osd_uld.c +++ b/drivers/scsi/osd/osd_uld.c | |||
@@ -268,18 +268,11 @@ static inline bool _the_same_or_null(const u8 *a1, unsigned a1_len, | |||
268 | return 0 == memcmp(a1, a2, a1_len); | 268 | return 0 == memcmp(a1, a2, a1_len); |
269 | } | 269 | } |
270 | 270 | ||
271 | struct find_oud_t { | 271 | static int _match_odi(struct device *dev, const void *find_data) |
272 | const struct osd_dev_info *odi; | ||
273 | struct device *dev; | ||
274 | struct osd_uld_device *oud; | ||
275 | } ; | ||
276 | |||
277 | int _mach_odi(struct device *dev, void *find_data) | ||
278 | { | 272 | { |
279 | struct osd_uld_device *oud = container_of(dev, struct osd_uld_device, | 273 | struct osd_uld_device *oud = container_of(dev, struct osd_uld_device, |
280 | class_dev); | 274 | class_dev); |
281 | struct find_oud_t *fot = find_data; | 275 | const struct osd_dev_info *odi = find_data; |
282 | const struct osd_dev_info *odi = fot->odi; | ||
283 | 276 | ||
284 | if (_the_same_or_null(oud->odi.systemid, oud->odi.systemid_len, | 277 | if (_the_same_or_null(oud->odi.systemid, oud->odi.systemid_len, |
285 | odi->systemid, odi->systemid_len) && | 278 | odi->systemid, odi->systemid_len) && |
@@ -287,7 +280,6 @@ int _mach_odi(struct device *dev, void *find_data) | |||
287 | odi->osdname, odi->osdname_len)) { | 280 | odi->osdname, odi->osdname_len)) { |
288 | OSD_DEBUG("found device sysid_len=%d osdname=%d\n", | 281 | OSD_DEBUG("found device sysid_len=%d osdname=%d\n", |
289 | odi->systemid_len, odi->osdname_len); | 282 | odi->systemid_len, odi->osdname_len); |
290 | fot->oud = oud; | ||
291 | return 1; | 283 | return 1; |
292 | } else { | 284 | } else { |
293 | return 0; | 285 | return 0; |
@@ -301,19 +293,19 @@ int _mach_odi(struct device *dev, void *find_data) | |||
301 | */ | 293 | */ |
302 | struct osd_dev *osduld_info_lookup(const struct osd_dev_info *odi) | 294 | struct osd_dev *osduld_info_lookup(const struct osd_dev_info *odi) |
303 | { | 295 | { |
304 | struct find_oud_t find = {.odi = odi}; | 296 | struct device *dev = class_find_device(&osd_uld_class, NULL, odi, _match_odi); |
305 | 297 | if (likely(dev)) { | |
306 | find.dev = class_find_device(&osd_uld_class, NULL, &find, _mach_odi); | ||
307 | if (likely(find.dev)) { | ||
308 | struct osd_dev_handle *odh = kzalloc(sizeof(*odh), GFP_KERNEL); | 298 | struct osd_dev_handle *odh = kzalloc(sizeof(*odh), GFP_KERNEL); |
299 | struct osd_uld_device *oud = container_of(dev, | ||
300 | struct osd_uld_device, class_dev); | ||
309 | 301 | ||
310 | if (unlikely(!odh)) { | 302 | if (unlikely(!odh)) { |
311 | put_device(find.dev); | 303 | put_device(dev); |
312 | return ERR_PTR(-ENOMEM); | 304 | return ERR_PTR(-ENOMEM); |
313 | } | 305 | } |
314 | 306 | ||
315 | odh->od = find.oud->od; | 307 | odh->od = oud->od; |
316 | odh->oud = find.oud; | 308 | odh->oud = oud; |
317 | 309 | ||
318 | return &odh->od; | 310 | return &odh->od; |
319 | } | 311 | } |
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index 31969f2e13ce..59d427bf08e2 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c | |||
@@ -183,10 +183,10 @@ static struct attribute_group iscsi_endpoint_group = { | |||
183 | 183 | ||
184 | #define ISCSI_MAX_EPID -1 | 184 | #define ISCSI_MAX_EPID -1 |
185 | 185 | ||
186 | static int iscsi_match_epid(struct device *dev, void *data) | 186 | static int iscsi_match_epid(struct device *dev, const void *data) |
187 | { | 187 | { |
188 | struct iscsi_endpoint *ep = iscsi_dev_to_endpoint(dev); | 188 | struct iscsi_endpoint *ep = iscsi_dev_to_endpoint(dev); |
189 | uint64_t *epid = (uint64_t *) data; | 189 | const uint64_t *epid = data; |
190 | 190 | ||
191 | return *epid == ep->id; | 191 | return *epid == ep->id; |
192 | } | 192 | } |
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 19ee901577da..493ce4a71717 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
@@ -1248,10 +1248,10 @@ int spi_master_resume(struct spi_master *master) | |||
1248 | } | 1248 | } |
1249 | EXPORT_SYMBOL_GPL(spi_master_resume); | 1249 | EXPORT_SYMBOL_GPL(spi_master_resume); |
1250 | 1250 | ||
1251 | static int __spi_master_match(struct device *dev, void *data) | 1251 | static int __spi_master_match(struct device *dev, const void *data) |
1252 | { | 1252 | { |
1253 | struct spi_master *m; | 1253 | struct spi_master *m; |
1254 | u16 *bus_num = data; | 1254 | const u16 *bus_num = data; |
1255 | 1255 | ||
1256 | m = container_of(dev, struct spi_master, dev); | 1256 | m = container_of(dev, struct spi_master, dev); |
1257 | return m->bus_num == *bus_num; | 1257 | return m->bus_num == *bus_num; |
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 | ||
diff --git a/include/linux/device.h b/include/linux/device.h index 251f33b21ef9..a089676084a5 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -395,8 +395,8 @@ extern int class_for_each_device(struct class *class, struct device *start, | |||
395 | void *data, | 395 | void *data, |
396 | int (*fn)(struct device *dev, void *data)); | 396 | int (*fn)(struct device *dev, void *data)); |
397 | extern struct device *class_find_device(struct class *class, | 397 | extern struct device *class_find_device(struct class *class, |
398 | struct device *start, void *data, | 398 | struct device *start, const void *data, |
399 | int (*match)(struct device *, void *)); | 399 | int (*match)(struct device *, const void *)); |
400 | 400 | ||
401 | struct class_attribute { | 401 | struct class_attribute { |
402 | struct attribute attr; | 402 | struct attribute attr; |
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h index 1f0ab90aff00..86ecaa679ded 100644 --- a/include/linux/power_supply.h +++ b/include/linux/power_supply.h | |||
@@ -224,7 +224,7 @@ struct power_supply_info { | |||
224 | int use_for_apm; | 224 | int use_for_apm; |
225 | }; | 225 | }; |
226 | 226 | ||
227 | extern struct power_supply *power_supply_get_by_name(char *name); | 227 | extern struct power_supply *power_supply_get_by_name(const char *name); |
228 | extern void power_supply_changed(struct power_supply *psy); | 228 | extern void power_supply_changed(struct power_supply *psy); |
229 | extern int power_supply_am_i_supplied(struct power_supply *psy); | 229 | extern int power_supply_am_i_supplied(struct power_supply *psy); |
230 | extern int power_supply_set_battery_charged(struct power_supply *psy); | 230 | extern int power_supply_set_battery_charged(struct power_supply *psy); |
diff --git a/include/linux/rtc.h b/include/linux/rtc.h index 9531845c419f..445fe6e7c629 100644 --- a/include/linux/rtc.h +++ b/include/linux/rtc.h | |||
@@ -148,7 +148,7 @@ extern int rtc_initialize_alarm(struct rtc_device *rtc, | |||
148 | extern void rtc_update_irq(struct rtc_device *rtc, | 148 | extern void rtc_update_irq(struct rtc_device *rtc, |
149 | unsigned long num, unsigned long events); | 149 | unsigned long num, unsigned long events); |
150 | 150 | ||
151 | extern struct rtc_device *rtc_class_open(char *name); | 151 | extern struct rtc_device *rtc_class_open(const char *name); |
152 | extern void rtc_class_close(struct rtc_device *rtc); | 152 | extern void rtc_class_close(struct rtc_device *rtc); |
153 | 153 | ||
154 | extern int rtc_irq_register(struct rtc_device *rtc, | 154 | extern int rtc_irq_register(struct rtc_device *rtc, |
diff --git a/init/do_mounts.c b/init/do_mounts.c index 1d1b6348f903..a2b49f2c1bd8 100644 --- a/init/do_mounts.c +++ b/init/do_mounts.c | |||
@@ -81,9 +81,9 @@ struct uuidcmp { | |||
81 | * | 81 | * |
82 | * Returns 1 if the device matches, and 0 otherwise. | 82 | * Returns 1 if the device matches, and 0 otherwise. |
83 | */ | 83 | */ |
84 | static int match_dev_by_uuid(struct device *dev, void *data) | 84 | static int match_dev_by_uuid(struct device *dev, const void *data) |
85 | { | 85 | { |
86 | struct uuidcmp *cmp = data; | 86 | const struct uuidcmp *cmp = data; |
87 | struct hd_struct *part = dev_to_part(dev); | 87 | struct hd_struct *part = dev_to_part(dev); |
88 | 88 | ||
89 | if (!part->info) | 89 | if (!part->info) |
diff --git a/kernel/power/suspend_test.c b/kernel/power/suspend_test.c index 25596e450ac7..9b2a1d58558d 100644 --- a/kernel/power/suspend_test.c +++ b/kernel/power/suspend_test.c | |||
@@ -112,7 +112,7 @@ static void __init test_wakealarm(struct rtc_device *rtc, suspend_state_t state) | |||
112 | rtc_set_alarm(rtc, &alm); | 112 | rtc_set_alarm(rtc, &alm); |
113 | } | 113 | } |
114 | 114 | ||
115 | static int __init has_wakealarm(struct device *dev, void *name_ptr) | 115 | static int __init has_wakealarm(struct device *dev, const void *data) |
116 | { | 116 | { |
117 | struct rtc_device *candidate = to_rtc_device(dev); | 117 | struct rtc_device *candidate = to_rtc_device(dev); |
118 | 118 | ||
@@ -121,7 +121,6 @@ static int __init has_wakealarm(struct device *dev, void *name_ptr) | |||
121 | if (!device_may_wakeup(candidate->dev.parent)) | 121 | if (!device_may_wakeup(candidate->dev.parent)) |
122 | return 0; | 122 | return 0; |
123 | 123 | ||
124 | *(const char **)name_ptr = dev_name(dev); | ||
125 | return 1; | 124 | return 1; |
126 | } | 125 | } |
127 | 126 | ||
@@ -159,8 +158,8 @@ static int __init test_suspend(void) | |||
159 | static char warn_no_rtc[] __initdata = | 158 | static char warn_no_rtc[] __initdata = |
160 | KERN_WARNING "PM: no wakealarm-capable RTC driver is ready\n"; | 159 | KERN_WARNING "PM: no wakealarm-capable RTC driver is ready\n"; |
161 | 160 | ||
162 | char *pony = NULL; | ||
163 | struct rtc_device *rtc = NULL; | 161 | struct rtc_device *rtc = NULL; |
162 | struct device *dev; | ||
164 | 163 | ||
165 | /* PM is initialized by now; is that state testable? */ | 164 | /* PM is initialized by now; is that state testable? */ |
166 | if (test_state == PM_SUSPEND_ON) | 165 | if (test_state == PM_SUSPEND_ON) |
@@ -171,9 +170,9 @@ static int __init test_suspend(void) | |||
171 | } | 170 | } |
172 | 171 | ||
173 | /* RTCs have initialized by now too ... can we use one? */ | 172 | /* RTCs have initialized by now too ... can we use one? */ |
174 | class_find_device(rtc_class, NULL, &pony, has_wakealarm); | 173 | dev = class_find_device(rtc_class, NULL, NULL, has_wakealarm); |
175 | if (pony) | 174 | if (dev) |
176 | rtc = rtc_class_open(pony); | 175 | rtc = rtc_class_open(dev_name(dev)); |
177 | if (!rtc) { | 176 | if (!rtc) { |
178 | printk(warn_no_rtc); | 177 | printk(warn_no_rtc); |
179 | goto done; | 178 | goto done; |
diff --git a/net/ieee802154/wpan-class.c b/net/ieee802154/wpan-class.c index 1627ef2e8522..13571eae6bae 100644 --- a/net/ieee802154/wpan-class.c +++ b/net/ieee802154/wpan-class.c | |||
@@ -91,7 +91,7 @@ static struct class wpan_phy_class = { | |||
91 | static DEFINE_MUTEX(wpan_phy_mutex); | 91 | static DEFINE_MUTEX(wpan_phy_mutex); |
92 | static int wpan_phy_idx; | 92 | static int wpan_phy_idx; |
93 | 93 | ||
94 | static int wpan_phy_match(struct device *dev, void *data) | 94 | static int wpan_phy_match(struct device *dev, const void *data) |
95 | { | 95 | { |
96 | return !strcmp(dev_name(dev), (const char *)data); | 96 | return !strcmp(dev_name(dev), (const char *)data); |
97 | } | 97 | } |
@@ -103,8 +103,7 @@ struct wpan_phy *wpan_phy_find(const char *str) | |||
103 | if (WARN_ON(!str)) | 103 | if (WARN_ON(!str)) |
104 | return NULL; | 104 | return NULL; |
105 | 105 | ||
106 | dev = class_find_device(&wpan_phy_class, NULL, | 106 | dev = class_find_device(&wpan_phy_class, NULL, str, wpan_phy_match); |
107 | (void *)str, wpan_phy_match); | ||
108 | if (!dev) | 107 | if (!dev) |
109 | return NULL; | 108 | return NULL; |
110 | 109 | ||
diff --git a/net/nfc/core.c b/net/nfc/core.c index aa64ea441676..0f4a6de6f161 100644 --- a/net/nfc/core.c +++ b/net/nfc/core.c | |||
@@ -734,10 +734,10 @@ struct class nfc_class = { | |||
734 | }; | 734 | }; |
735 | EXPORT_SYMBOL(nfc_class); | 735 | EXPORT_SYMBOL(nfc_class); |
736 | 736 | ||
737 | static int match_idx(struct device *d, void *data) | 737 | static int match_idx(struct device *d, const void *data) |
738 | { | 738 | { |
739 | struct nfc_dev *dev = to_nfc_dev(d); | 739 | struct nfc_dev *dev = to_nfc_dev(d); |
740 | unsigned int *idx = data; | 740 | const unsigned int *idx = data; |
741 | 741 | ||
742 | return dev->idx == *idx; | 742 | return dev->idx == *idx; |
743 | } | 743 | } |