diff options
author | Suzuki K Poulose <suzuki.poulose@arm.com> | 2019-06-14 13:53:59 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-06-23 23:22:31 -0400 |
commit | 418e3ea157efb0eb2c6dd412a8d5f052477c7f5a (patch) | |
tree | 1c8412f0b9adce1c72806e3e2c61a84c26752a17 | |
parent | e6374f6b2e9c9f9a7cf5418157ad7f30f3abd70e (diff) |
bus_find_device: Unify the match callback with class_find_device
There is an arbitrary difference between the prototypes of
bus_find_device() and class_find_device() preventing their callers
from passing the same pair of data and match() arguments to both of
them, which is the const qualifier used in the prototype of
class_find_device(). If that qualifier is also used in the
bus_find_device() prototype, it will be possible to pass the same
match() callback function to both bus_find_device() and
class_find_device(), which will allow some optimizations to be made in
order to avoid code duplication going forward. Also with that, constify
the "data" parameter as it is passed as a const to the match function.
For this reason, change the prototype of bus_find_device() to match
the prototype of class_find_device() and adjust its callers to use the
const qualifier in accordance with the new prototype of it.
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Andreas Noever <andreas.noever@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Corey Minyard <minyard@acm.org>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: David Kershner <david.kershner@unisys.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: David Airlie <airlied@linux.ie>
Cc: Felipe Balbi <balbi@kernel.org>
Cc: Frank Rowand <frowand.list@gmail.com>
Cc: Grygorii Strashko <grygorii.strashko@ti.com>
Cc: Harald Freudenberger <freude@linux.ibm.com>
Cc: Hartmut Knaack <knaack.h@gmx.de>
Cc: Heiko Stuebner <heiko@sntech.de>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>
Cc: Len Brown <lenb@kernel.org>
Cc: Mark Brown <broonie@kernel.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Michael Jamet <michael.jamet@intel.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Peter Oberparleiter <oberpar@linux.ibm.com>
Cc: Sebastian Ott <sebott@linux.ibm.com>
Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Cc: Yehezkel Bernat <YehezkelShB@gmail.com>
Cc: rafael@kernel.org
Acked-by: Corey Minyard <minyard@acm.org>
Acked-by: David Kershner <david.kershner@unisys.com>
Acked-by: Mark Brown <broonie@kernel.org>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Acked-by: Wolfram Sang <wsa@the-dreams.de> # for the I2C parts
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
39 files changed, 67 insertions, 68 deletions
diff --git a/arch/powerpc/platforms/pseries/ibmebus.c b/arch/powerpc/platforms/pseries/ibmebus.c index 84e8ec4011ba..b91eb0929ed1 100644 --- a/arch/powerpc/platforms/pseries/ibmebus.c +++ b/arch/powerpc/platforms/pseries/ibmebus.c | |||
@@ -147,13 +147,13 @@ static const struct dma_map_ops ibmebus_dma_ops = { | |||
147 | .unmap_page = ibmebus_unmap_page, | 147 | .unmap_page = ibmebus_unmap_page, |
148 | }; | 148 | }; |
149 | 149 | ||
150 | static int ibmebus_match_path(struct device *dev, void *data) | 150 | static int ibmebus_match_path(struct device *dev, const void *data) |
151 | { | 151 | { |
152 | struct device_node *dn = to_platform_device(dev)->dev.of_node; | 152 | struct device_node *dn = to_platform_device(dev)->dev.of_node; |
153 | return (of_find_node_by_path(data) == dn); | 153 | return (of_find_node_by_path(data) == dn); |
154 | } | 154 | } |
155 | 155 | ||
156 | static int ibmebus_match_node(struct device *dev, void *data) | 156 | static int ibmebus_match_node(struct device *dev, const void *data) |
157 | { | 157 | { |
158 | return to_platform_device(dev)->dev.of_node == data; | 158 | return to_platform_device(dev)->dev.of_node == data; |
159 | } | 159 | } |
diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c index cf768608437e..dc2ca78748a2 100644 --- a/drivers/acpi/acpi_lpss.c +++ b/drivers/acpi/acpi_lpss.c | |||
@@ -511,10 +511,10 @@ struct hid_uid { | |||
511 | const char *uid; | 511 | const char *uid; |
512 | }; | 512 | }; |
513 | 513 | ||
514 | static int match_hid_uid(struct device *dev, void *data) | 514 | static int match_hid_uid(struct device *dev, const void *data) |
515 | { | 515 | { |
516 | struct acpi_device *adev = ACPI_COMPANION(dev); | 516 | struct acpi_device *adev = ACPI_COMPANION(dev); |
517 | struct hid_uid *id = data; | 517 | const struct hid_uid *id = data; |
518 | 518 | ||
519 | if (!adev) | 519 | if (!adev) |
520 | return 0; | 520 | return 0; |
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index a34deccd7317..fcf4386ecc78 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c | |||
@@ -454,7 +454,7 @@ static int acpi_pm_prepare(void) | |||
454 | return error; | 454 | return error; |
455 | } | 455 | } |
456 | 456 | ||
457 | static int find_powerf_dev(struct device *dev, void *data) | 457 | static int find_powerf_dev(struct device *dev, const void *data) |
458 | { | 458 | { |
459 | struct acpi_device *device = to_acpi_device(dev); | 459 | struct acpi_device *device = to_acpi_device(dev); |
460 | const char *hid = acpi_device_hid(device); | 460 | const char *hid = acpi_device_hid(device); |
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index 1391b63cadfd..e3974a8f8fd4 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c | |||
@@ -730,10 +730,10 @@ struct acpi_dev_match_info { | |||
730 | s64 hrv; | 730 | s64 hrv; |
731 | }; | 731 | }; |
732 | 732 | ||
733 | static int acpi_dev_match_cb(struct device *dev, void *data) | 733 | static int acpi_dev_match_cb(struct device *dev, const void *data) |
734 | { | 734 | { |
735 | struct acpi_device *adev = to_acpi_device(dev); | 735 | struct acpi_device *adev = to_acpi_device(dev); |
736 | struct acpi_dev_match_info *match = data; | 736 | const struct acpi_dev_match_info *match = data; |
737 | unsigned long long hrv; | 737 | unsigned long long hrv; |
738 | acpi_status status; | 738 | acpi_status status; |
739 | 739 | ||
diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 0a58e969f8b7..df3cac739813 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c | |||
@@ -323,8 +323,8 @@ EXPORT_SYMBOL_GPL(bus_for_each_dev); | |||
323 | * return to the caller and not iterate over any more devices. | 323 | * return to the caller and not iterate over any more devices. |
324 | */ | 324 | */ |
325 | struct device *bus_find_device(struct bus_type *bus, | 325 | struct device *bus_find_device(struct bus_type *bus, |
326 | struct device *start, void *data, | 326 | struct device *start, const void *data, |
327 | int (*match)(struct device *dev, void *data)) | 327 | int (*match)(struct device *dev, const void *data)) |
328 | { | 328 | { |
329 | struct klist_iter i; | 329 | struct klist_iter i; |
330 | struct device *dev; | 330 | struct device *dev; |
@@ -342,7 +342,7 @@ struct device *bus_find_device(struct bus_type *bus, | |||
342 | } | 342 | } |
343 | EXPORT_SYMBOL_GPL(bus_find_device); | 343 | EXPORT_SYMBOL_GPL(bus_find_device); |
344 | 344 | ||
345 | static int match_name(struct device *dev, void *data) | 345 | static int match_name(struct device *dev, const void *data) |
346 | { | 346 | { |
347 | const char *name = data; | 347 | const char *name = data; |
348 | 348 | ||
diff --git a/drivers/base/devcon.c b/drivers/base/devcon.c index 04db9ae235e4..ac026d5fc672 100644 --- a/drivers/base/devcon.c +++ b/drivers/base/devcon.c | |||
@@ -107,7 +107,7 @@ static struct bus_type *generic_match_buses[] = { | |||
107 | NULL, | 107 | NULL, |
108 | }; | 108 | }; |
109 | 109 | ||
110 | static int device_fwnode_match(struct device *dev, void *fwnode) | 110 | static int device_fwnode_match(struct device *dev, const void *fwnode) |
111 | { | 111 | { |
112 | return dev_fwnode(dev) == fwnode; | 112 | return dev_fwnode(dev) == fwnode; |
113 | } | 113 | } |
diff --git a/drivers/char/ipmi/ipmi_si_platform.c b/drivers/char/ipmi/ipmi_si_platform.c index f2a91c4d8cab..fd94c4238449 100644 --- a/drivers/char/ipmi/ipmi_si_platform.c +++ b/drivers/char/ipmi/ipmi_si_platform.c | |||
@@ -426,7 +426,7 @@ static int ipmi_remove(struct platform_device *pdev) | |||
426 | return ipmi_si_remove_by_dev(&pdev->dev); | 426 | return ipmi_si_remove_by_dev(&pdev->dev); |
427 | } | 427 | } |
428 | 428 | ||
429 | static int pdev_match_name(struct device *dev, void *data) | 429 | static int pdev_match_name(struct device *dev, const void *data) |
430 | { | 430 | { |
431 | struct platform_device *pdev = to_platform_device(dev); | 431 | struct platform_device *pdev = to_platform_device(dev); |
432 | const char *name = data; | 432 | const char *name = data; |
diff --git a/drivers/firmware/efi/dev-path-parser.c b/drivers/firmware/efi/dev-path-parser.c index 85ec99f97841..20123384271c 100644 --- a/drivers/firmware/efi/dev-path-parser.c +++ b/drivers/firmware/efi/dev-path-parser.c | |||
@@ -17,9 +17,9 @@ struct acpi_hid_uid { | |||
17 | char uid[11]; /* UINT_MAX + null byte */ | 17 | char uid[11]; /* UINT_MAX + null byte */ |
18 | }; | 18 | }; |
19 | 19 | ||
20 | static int __init match_acpi_dev(struct device *dev, void *data) | 20 | static int __init match_acpi_dev(struct device *dev, const void *data) |
21 | { | 21 | { |
22 | struct acpi_hid_uid hid_uid = *(struct acpi_hid_uid *)data; | 22 | struct acpi_hid_uid hid_uid = *(const struct acpi_hid_uid *)data; |
23 | struct acpi_device *adev = to_acpi_device(dev); | 23 | struct acpi_device *adev = to_acpi_device(dev); |
24 | 24 | ||
25 | if (acpi_match_device_ids(adev, hid_uid.hid)) | 25 | if (acpi_match_device_ids(adev, hid_uid.hid)) |
diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c index 80b75501f5c6..ad19df0686c9 100644 --- a/drivers/gpu/drm/drm_mipi_dsi.c +++ b/drivers/gpu/drm/drm_mipi_dsi.c | |||
@@ -93,7 +93,7 @@ static struct bus_type mipi_dsi_bus_type = { | |||
93 | .pm = &mipi_dsi_device_pm_ops, | 93 | .pm = &mipi_dsi_device_pm_ops, |
94 | }; | 94 | }; |
95 | 95 | ||
96 | static int of_device_match(struct device *dev, void *data) | 96 | static int of_device_match(struct device *dev, const void *data) |
97 | { | 97 | { |
98 | return dev->of_node == data; | 98 | return dev->of_node == data; |
99 | } | 99 | } |
diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c index 4b130281236a..b67ab6a09587 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c | |||
@@ -498,9 +498,9 @@ struct coresight_device *coresight_get_sink(struct list_head *path) | |||
498 | return csdev; | 498 | return csdev; |
499 | } | 499 | } |
500 | 500 | ||
501 | static int coresight_enabled_sink(struct device *dev, void *data) | 501 | static int coresight_enabled_sink(struct device *dev, const void *data) |
502 | { | 502 | { |
503 | bool *reset = data; | 503 | const bool *reset = data; |
504 | struct coresight_device *csdev = to_coresight_device(dev); | 504 | struct coresight_device *csdev = to_coresight_device(dev); |
505 | 505 | ||
506 | if ((csdev->type == CORESIGHT_DEV_TYPE_SINK || | 506 | if ((csdev->type == CORESIGHT_DEV_TYPE_SINK || |
@@ -544,7 +544,7 @@ struct coresight_device *coresight_get_enabled_sink(bool deactivate) | |||
544 | return dev ? to_coresight_device(dev) : NULL; | 544 | return dev ? to_coresight_device(dev) : NULL; |
545 | } | 545 | } |
546 | 546 | ||
547 | static int coresight_sink_by_id(struct device *dev, void *data) | 547 | static int coresight_sink_by_id(struct device *dev, const void *data) |
548 | { | 548 | { |
549 | struct coresight_device *csdev = to_coresight_device(dev); | 549 | struct coresight_device *csdev = to_coresight_device(dev); |
550 | unsigned long hash; | 550 | unsigned long hash; |
diff --git a/drivers/hwtracing/coresight/of_coresight.c b/drivers/hwtracing/coresight/of_coresight.c index 7045930fc958..3fc200ec1c03 100644 --- a/drivers/hwtracing/coresight/of_coresight.c +++ b/drivers/hwtracing/coresight/of_coresight.c | |||
@@ -18,7 +18,7 @@ | |||
18 | #include <asm/smp_plat.h> | 18 | #include <asm/smp_plat.h> |
19 | 19 | ||
20 | 20 | ||
21 | static int of_dev_node_match(struct device *dev, void *data) | 21 | static int of_dev_node_match(struct device *dev, const void *data) |
22 | { | 22 | { |
23 | return dev->of_node == data; | 23 | return dev->of_node == data; |
24 | } | 24 | } |
diff --git a/drivers/hwtracing/intel_th/core.c b/drivers/hwtracing/intel_th/core.c index 033dce563c99..55922896d862 100644 --- a/drivers/hwtracing/intel_th/core.c +++ b/drivers/hwtracing/intel_th/core.c | |||
@@ -789,10 +789,9 @@ static int intel_th_populate(struct intel_th *th) | |||
789 | return 0; | 789 | return 0; |
790 | } | 790 | } |
791 | 791 | ||
792 | static int match_devt(struct device *dev, void *data) | 792 | static int match_devt(struct device *dev, const void *data) |
793 | { | 793 | { |
794 | dev_t devt = (dev_t)(unsigned long)data; | 794 | dev_t devt = (dev_t)(unsigned long)(void *)data; |
795 | |||
796 | return dev->devt == devt; | 795 | return dev->devt == devt; |
797 | } | 796 | } |
798 | 797 | ||
diff --git a/drivers/i2c/i2c-core-acpi.c b/drivers/i2c/i2c-core-acpi.c index d84095591e45..8af35f114821 100644 --- a/drivers/i2c/i2c-core-acpi.c +++ b/drivers/i2c/i2c-core-acpi.c | |||
@@ -318,7 +318,7 @@ u32 i2c_acpi_find_bus_speed(struct device *dev) | |||
318 | } | 318 | } |
319 | EXPORT_SYMBOL_GPL(i2c_acpi_find_bus_speed); | 319 | EXPORT_SYMBOL_GPL(i2c_acpi_find_bus_speed); |
320 | 320 | ||
321 | static int i2c_acpi_find_match_adapter(struct device *dev, void *data) | 321 | static int i2c_acpi_find_match_adapter(struct device *dev, const void *data) |
322 | { | 322 | { |
323 | struct i2c_adapter *adapter = i2c_verify_adapter(dev); | 323 | struct i2c_adapter *adapter = i2c_verify_adapter(dev); |
324 | 324 | ||
@@ -328,7 +328,7 @@ static int i2c_acpi_find_match_adapter(struct device *dev, void *data) | |||
328 | return ACPI_HANDLE(dev) == (acpi_handle)data; | 328 | return ACPI_HANDLE(dev) == (acpi_handle)data; |
329 | } | 329 | } |
330 | 330 | ||
331 | static int i2c_acpi_find_match_device(struct device *dev, void *data) | 331 | static int i2c_acpi_find_match_device(struct device *dev, const void *data) |
332 | { | 332 | { |
333 | return ACPI_COMPANION(dev) == data; | 333 | return ACPI_COMPANION(dev) == data; |
334 | } | 334 | } |
diff --git a/drivers/i2c/i2c-core-of.c b/drivers/i2c/i2c-core-of.c index 406e5f695a7e..2eb59a260ad4 100644 --- a/drivers/i2c/i2c-core-of.c +++ b/drivers/i2c/i2c-core-of.c | |||
@@ -112,12 +112,12 @@ void of_i2c_register_devices(struct i2c_adapter *adap) | |||
112 | of_node_put(bus); | 112 | of_node_put(bus); |
113 | } | 113 | } |
114 | 114 | ||
115 | static int of_dev_node_match(struct device *dev, void *data) | 115 | static int of_dev_node_match(struct device *dev, const void *data) |
116 | { | 116 | { |
117 | return dev->of_node == data; | 117 | return dev->of_node == data; |
118 | } | 118 | } |
119 | 119 | ||
120 | static int of_dev_or_parent_node_match(struct device *dev, void *data) | 120 | static int of_dev_or_parent_node_match(struct device *dev, const void *data) |
121 | { | 121 | { |
122 | if (dev->of_node == data) | 122 | if (dev->of_node == data) |
123 | return 1; | 123 | return 1; |
diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c index 4a5eff3f18bc..c46fb59d92cb 100644 --- a/drivers/iio/inkern.c +++ b/drivers/iio/inkern.c | |||
@@ -93,7 +93,7 @@ static const struct iio_chan_spec | |||
93 | 93 | ||
94 | #ifdef CONFIG_OF | 94 | #ifdef CONFIG_OF |
95 | 95 | ||
96 | static int iio_dev_node_match(struct device *dev, void *data) | 96 | static int iio_dev_node_match(struct device *dev, const void *data) |
97 | { | 97 | { |
98 | return dev->of_node == data && dev->type == &iio_device_type; | 98 | return dev->of_node == data && dev->type == &iio_device_type; |
99 | } | 99 | } |
diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c index 4c5d0f160c10..fd90b05849c8 100644 --- a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c | |||
@@ -4497,7 +4497,7 @@ static const struct acpi_device_id hns_roce_acpi_match[] = { | |||
4497 | }; | 4497 | }; |
4498 | MODULE_DEVICE_TABLE(acpi, hns_roce_acpi_match); | 4498 | MODULE_DEVICE_TABLE(acpi, hns_roce_acpi_match); |
4499 | 4499 | ||
4500 | static int hns_roce_node_match(struct device *dev, void *fwnode) | 4500 | static int hns_roce_node_match(struct device *dev, const void *fwnode) |
4501 | { | 4501 | { |
4502 | return dev->fwnode == fwnode; | 4502 | return dev->fwnode == fwnode; |
4503 | } | 4503 | } |
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c index 09c16d88172e..bb6586d0e5af 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c | |||
@@ -754,7 +754,7 @@ struct dsaf_misc_op *hns_misc_op_get(struct dsaf_device *dsaf_dev) | |||
754 | return (void *)misc_op; | 754 | return (void *)misc_op; |
755 | } | 755 | } |
756 | 756 | ||
757 | static int hns_dsaf_dev_match(struct device *dev, void *fwnode) | 757 | static int hns_dsaf_dev_match(struct device *dev, const void *fwnode) |
758 | { | 758 | { |
759 | return dev->fwnode == fwnode; | 759 | return dev->fwnode == fwnode; |
760 | } | 760 | } |
diff --git a/drivers/net/ethernet/ti/cpsw-phy-sel.c b/drivers/net/ethernet/ti/cpsw-phy-sel.c index 48e0924259f5..4e184eecc8e1 100644 --- a/drivers/net/ethernet/ti/cpsw-phy-sel.c +++ b/drivers/net/ethernet/ti/cpsw-phy-sel.c | |||
@@ -151,9 +151,9 @@ static void cpsw_gmii_sel_dra7xx(struct cpsw_phy_sel_priv *priv, | |||
151 | } | 151 | } |
152 | 152 | ||
153 | static struct platform_driver cpsw_phy_sel_driver; | 153 | static struct platform_driver cpsw_phy_sel_driver; |
154 | static int match(struct device *dev, void *data) | 154 | static int match(struct device *dev, const void *data) |
155 | { | 155 | { |
156 | struct device_node *node = (struct device_node *)data; | 156 | const struct device_node *node = (const struct device_node *)data; |
157 | return dev->of_node == node && | 157 | return dev->of_node == node && |
158 | dev->driver == &cpsw_phy_sel_driver.driver; | 158 | dev->driver == &cpsw_phy_sel_driver.driver; |
159 | } | 159 | } |
diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c index 4bf65cab79e6..57d131a04db3 100644 --- a/drivers/net/ethernet/ti/davinci_emac.c +++ b/drivers/net/ethernet/ti/davinci_emac.c | |||
@@ -1371,7 +1371,7 @@ static int emac_devioctl(struct net_device *ndev, struct ifreq *ifrq, int cmd) | |||
1371 | return -EOPNOTSUPP; | 1371 | return -EOPNOTSUPP; |
1372 | } | 1372 | } |
1373 | 1373 | ||
1374 | static int match_first_device(struct device *dev, void *data) | 1374 | static int match_first_device(struct device *dev, const void *data) |
1375 | { | 1375 | { |
1376 | if (dev->parent && dev->parent->of_node) | 1376 | if (dev->parent && dev->parent->of_node) |
1377 | return of_device_is_compatible(dev->parent->of_node, | 1377 | return of_device_is_compatible(dev->parent->of_node, |
diff --git a/drivers/net/ethernet/toshiba/tc35815.c b/drivers/net/ethernet/toshiba/tc35815.c index c50a9772f4af..8479a440527b 100644 --- a/drivers/net/ethernet/toshiba/tc35815.c +++ b/drivers/net/ethernet/toshiba/tc35815.c | |||
@@ -694,10 +694,10 @@ err_out: | |||
694 | * should provide a "tc35815-mac" device with a MAC address in its | 694 | * should provide a "tc35815-mac" device with a MAC address in its |
695 | * platform_data. | 695 | * platform_data. |
696 | */ | 696 | */ |
697 | static int tc35815_mac_match(struct device *dev, void *data) | 697 | static int tc35815_mac_match(struct device *dev, const void *data) |
698 | { | 698 | { |
699 | struct platform_device *plat_dev = to_platform_device(dev); | 699 | struct platform_device *plat_dev = to_platform_device(dev); |
700 | struct pci_dev *pci_dev = data; | 700 | const struct pci_dev *pci_dev = data; |
701 | unsigned int id = pci_dev->irq; | 701 | unsigned int id = pci_dev->irq; |
702 | return !strcmp(plat_dev->name, "tc35815-mac") && plat_dev->id == id; | 702 | return !strcmp(plat_dev->name, "tc35815-mac") && plat_dev->id == id; |
703 | } | 703 | } |
diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index c7892c3da91f..ac5d945be88a 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c | |||
@@ -76,7 +76,7 @@ static struct bus_type nvmem_bus_type = { | |||
76 | .name = "nvmem", | 76 | .name = "nvmem", |
77 | }; | 77 | }; |
78 | 78 | ||
79 | static int of_nvmem_match(struct device *dev, void *nvmem_np) | 79 | static int of_nvmem_match(struct device *dev, const void *nvmem_np) |
80 | { | 80 | { |
81 | return dev->of_node == nvmem_np; | 81 | return dev->of_node == nvmem_np; |
82 | } | 82 | } |
diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c index de6157357e26..dfe12948c834 100644 --- a/drivers/of/of_mdio.c +++ b/drivers/of/of_mdio.c | |||
@@ -282,7 +282,7 @@ unregister: | |||
282 | EXPORT_SYMBOL(of_mdiobus_register); | 282 | EXPORT_SYMBOL(of_mdiobus_register); |
283 | 283 | ||
284 | /* Helper function for of_phy_find_device */ | 284 | /* Helper function for of_phy_find_device */ |
285 | static int of_phy_match(struct device *dev, void *phy_np) | 285 | static int of_phy_match(struct device *dev, const void *phy_np) |
286 | { | 286 | { |
287 | return dev->of_node == phy_np; | 287 | return dev->of_node == phy_np; |
288 | } | 288 | } |
diff --git a/drivers/of/platform.c b/drivers/of/platform.c index 04ad312fd85b..008d79e33c2d 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c | |||
@@ -37,7 +37,7 @@ static const struct of_device_id of_skipped_node_table[] = { | |||
37 | {} /* Empty terminated list */ | 37 | {} /* Empty terminated list */ |
38 | }; | 38 | }; |
39 | 39 | ||
40 | static int of_dev_node_match(struct device *dev, void *data) | 40 | static int of_dev_node_match(struct device *dev, const void *data) |
41 | { | 41 | { |
42 | return dev->of_node == data; | 42 | return dev->of_node == data; |
43 | } | 43 | } |
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 0e8e2c186f50..f9ef7ad3f75d 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -64,7 +64,7 @@ static struct resource *get_pci_domain_busn_res(int domain_nr) | |||
64 | return &r->res; | 64 | return &r->res; |
65 | } | 65 | } |
66 | 66 | ||
67 | static int find_anything(struct device *dev, void *data) | 67 | static int find_anything(struct device *dev, const void *data) |
68 | { | 68 | { |
69 | return 1; | 69 | return 1; |
70 | } | 70 | } |
diff --git a/drivers/pci/search.c b/drivers/pci/search.c index 5c7922612733..7f4e65872b8d 100644 --- a/drivers/pci/search.c +++ b/drivers/pci/search.c | |||
@@ -236,10 +236,10 @@ struct pci_dev *pci_get_domain_bus_and_slot(int domain, unsigned int bus, | |||
236 | } | 236 | } |
237 | EXPORT_SYMBOL(pci_get_domain_bus_and_slot); | 237 | EXPORT_SYMBOL(pci_get_domain_bus_and_slot); |
238 | 238 | ||
239 | static int match_pci_dev_by_id(struct device *dev, void *data) | 239 | static int match_pci_dev_by_id(struct device *dev, const void *data) |
240 | { | 240 | { |
241 | struct pci_dev *pdev = to_pci_dev(dev); | 241 | struct pci_dev *pdev = to_pci_dev(dev); |
242 | struct pci_device_id *id = data; | 242 | const struct pci_device_id *id = data; |
243 | 243 | ||
244 | if (pci_match_one_device(id, pdev)) | 244 | if (pci_match_one_device(id, pdev)) |
245 | return 1; | 245 | return 1; |
diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c index aea502922646..a2c97830efe0 100644 --- a/drivers/s390/cio/css.c +++ b/drivers/s390/cio/css.c | |||
@@ -434,10 +434,10 @@ static int css_probe_device(struct subchannel_id schid, struct schib *schib) | |||
434 | } | 434 | } |
435 | 435 | ||
436 | static int | 436 | static int |
437 | check_subchannel(struct device * dev, void * data) | 437 | check_subchannel(struct device *dev, const void *data) |
438 | { | 438 | { |
439 | struct subchannel *sch; | 439 | struct subchannel *sch; |
440 | struct subchannel_id *schid = data; | 440 | struct subchannel_id *schid = (void *)data; |
441 | 441 | ||
442 | sch = to_subchannel(dev); | 442 | sch = to_subchannel(dev); |
443 | return schid_equal(&sch->schid, schid); | 443 | return schid_equal(&sch->schid, schid); |
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index 1540229a37bb..d32f373e5bc7 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c | |||
@@ -642,10 +642,10 @@ static int ccw_device_add(struct ccw_device *cdev) | |||
642 | return device_add(dev); | 642 | return device_add(dev); |
643 | } | 643 | } |
644 | 644 | ||
645 | static int match_dev_id(struct device *dev, void *data) | 645 | static int match_dev_id(struct device *dev, const void *data) |
646 | { | 646 | { |
647 | struct ccw_device *cdev = to_ccwdev(dev); | 647 | struct ccw_device *cdev = to_ccwdev(dev); |
648 | struct ccw_dev_id *dev_id = data; | 648 | struct ccw_dev_id *dev_id = (void *)data; |
649 | 649 | ||
650 | return ccw_dev_id_is_equal(&cdev->private->dev_id, dev_id); | 650 | return ccw_dev_id_is_equal(&cdev->private->dev_id, dev_id); |
651 | } | 651 | } |
diff --git a/drivers/s390/cio/scm.c b/drivers/s390/cio/scm.c index 6bca1d5455d4..9f26d4310bb3 100644 --- a/drivers/s390/cio/scm.c +++ b/drivers/s390/cio/scm.c | |||
@@ -174,10 +174,10 @@ out: | |||
174 | kobject_uevent(&scmdev->dev.kobj, KOBJ_CHANGE); | 174 | kobject_uevent(&scmdev->dev.kobj, KOBJ_CHANGE); |
175 | } | 175 | } |
176 | 176 | ||
177 | static int check_address(struct device *dev, void *data) | 177 | static int check_address(struct device *dev, const void *data) |
178 | { | 178 | { |
179 | struct scm_device *scmdev = to_scm_dev(dev); | 179 | struct scm_device *scmdev = to_scm_dev(dev); |
180 | struct sale *sale = data; | 180 | const struct sale *sale = data; |
181 | 181 | ||
182 | return scmdev->address == sale->sa; | 182 | return scmdev->address == sale->sa; |
183 | } | 183 | } |
diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c index b9fc502c58c2..b7902b643ec8 100644 --- a/drivers/s390/crypto/ap_bus.c +++ b/drivers/s390/crypto/ap_bus.c | |||
@@ -1356,16 +1356,16 @@ static int ap_get_compatible_type(ap_qid_t qid, int rawtype, unsigned int func) | |||
1356 | * Helper function to be used with bus_find_dev | 1356 | * Helper function to be used with bus_find_dev |
1357 | * matches for the card device with the given id | 1357 | * matches for the card device with the given id |
1358 | */ | 1358 | */ |
1359 | static int __match_card_device_with_id(struct device *dev, void *data) | 1359 | static int __match_card_device_with_id(struct device *dev, const void *data) |
1360 | { | 1360 | { |
1361 | return is_card_dev(dev) && to_ap_card(dev)->id == (int)(long) data; | 1361 | return is_card_dev(dev) && to_ap_card(dev)->id == (int)(long)(void *) data; |
1362 | } | 1362 | } |
1363 | 1363 | ||
1364 | /* | 1364 | /* |
1365 | * Helper function to be used with bus_find_dev | 1365 | * Helper function to be used with bus_find_dev |
1366 | * matches for the queue device with a given qid | 1366 | * matches for the queue device with a given qid |
1367 | */ | 1367 | */ |
1368 | static int __match_queue_device_with_qid(struct device *dev, void *data) | 1368 | static int __match_queue_device_with_qid(struct device *dev, const void *data) |
1369 | { | 1369 | { |
1370 | return is_queue_dev(dev) && to_ap_queue(dev)->qid == (int)(long) data; | 1370 | return is_queue_dev(dev) && to_ap_queue(dev)->qid == (int)(long) data; |
1371 | } | 1371 | } |
@@ -1374,7 +1374,7 @@ static int __match_queue_device_with_qid(struct device *dev, void *data) | |||
1374 | * Helper function to be used with bus_find_dev | 1374 | * Helper function to be used with bus_find_dev |
1375 | * matches any queue device with given queue id | 1375 | * matches any queue device with given queue id |
1376 | */ | 1376 | */ |
1377 | static int __match_queue_device_with_queue_id(struct device *dev, void *data) | 1377 | static int __match_queue_device_with_queue_id(struct device *dev, const void *data) |
1378 | { | 1378 | { |
1379 | return is_queue_dev(dev) | 1379 | return is_queue_dev(dev) |
1380 | && AP_QID_QUEUE(to_ap_queue(dev)->qid) == (int)(long) data; | 1380 | && AP_QID_QUEUE(to_ap_queue(dev)->qid) == (int)(long) data; |
diff --git a/drivers/scsi/scsi_proc.c b/drivers/scsi/scsi_proc.c index 7f0ceb65c3f3..c074631086a4 100644 --- a/drivers/scsi/scsi_proc.c +++ b/drivers/scsi/scsi_proc.c | |||
@@ -372,7 +372,7 @@ static ssize_t proc_scsi_write(struct file *file, const char __user *buf, | |||
372 | return err; | 372 | return err; |
373 | } | 373 | } |
374 | 374 | ||
375 | static int always_match(struct device *dev, void *data) | 375 | static int always_match(struct device *dev, const void *data) |
376 | { | 376 | { |
377 | return 1; | 377 | return 1; |
378 | } | 378 | } |
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 5e75944ad5d1..3da1121f7572 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
@@ -3538,7 +3538,7 @@ EXPORT_SYMBOL_GPL(spi_write_then_read); | |||
3538 | /*-------------------------------------------------------------------------*/ | 3538 | /*-------------------------------------------------------------------------*/ |
3539 | 3539 | ||
3540 | #if IS_ENABLED(CONFIG_OF) | 3540 | #if IS_ENABLED(CONFIG_OF) |
3541 | static int __spi_of_device_match(struct device *dev, void *data) | 3541 | static int __spi_of_device_match(struct device *dev, const void *data) |
3542 | { | 3542 | { |
3543 | return dev->of_node == data; | 3543 | return dev->of_node == data; |
3544 | } | 3544 | } |
@@ -3639,7 +3639,7 @@ static int spi_acpi_controller_match(struct device *dev, const void *data) | |||
3639 | return ACPI_COMPANION(dev->parent) == data; | 3639 | return ACPI_COMPANION(dev->parent) == data; |
3640 | } | 3640 | } |
3641 | 3641 | ||
3642 | static int spi_acpi_device_match(struct device *dev, void *data) | 3642 | static int spi_acpi_device_match(struct device *dev, const void *data) |
3643 | { | 3643 | { |
3644 | return ACPI_COMPANION(dev) == data; | 3644 | return ACPI_COMPANION(dev) == data; |
3645 | } | 3645 | } |
diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c index c1b016574fb4..c9a7e4a779cd 100644 --- a/drivers/thunderbolt/switch.c +++ b/drivers/thunderbolt/switch.c | |||
@@ -1946,10 +1946,10 @@ struct tb_sw_lookup { | |||
1946 | u64 route; | 1946 | u64 route; |
1947 | }; | 1947 | }; |
1948 | 1948 | ||
1949 | static int tb_switch_match(struct device *dev, void *data) | 1949 | static int tb_switch_match(struct device *dev, const void *data) |
1950 | { | 1950 | { |
1951 | struct tb_switch *sw = tb_to_switch(dev); | 1951 | struct tb_switch *sw = tb_to_switch(dev); |
1952 | struct tb_sw_lookup *lookup = data; | 1952 | const struct tb_sw_lookup *lookup = data; |
1953 | 1953 | ||
1954 | if (!sw) | 1954 | if (!sw) |
1955 | return 0; | 1955 | return 0; |
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index fa783531ee88..7bd7de7273a3 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c | |||
@@ -947,9 +947,9 @@ error: | |||
947 | return ret; | 947 | return ret; |
948 | } | 948 | } |
949 | 949 | ||
950 | static int match_devt(struct device *dev, void *data) | 950 | static int match_devt(struct device *dev, const void *data) |
951 | { | 951 | { |
952 | return dev->devt == (dev_t) (unsigned long) data; | 952 | return dev->devt == (dev_t)(unsigned long)(void *)data; |
953 | } | 953 | } |
954 | 954 | ||
955 | static struct usb_device *usbdev_lookup_by_devt(dev_t devt) | 955 | static struct usb_device *usbdev_lookup_by_devt(dev_t devt) |
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index 7fcb9f782931..1678e305e037 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c | |||
@@ -325,9 +325,9 @@ struct find_interface_arg { | |||
325 | struct device_driver *drv; | 325 | struct device_driver *drv; |
326 | }; | 326 | }; |
327 | 327 | ||
328 | static int __find_interface(struct device *dev, void *data) | 328 | static int __find_interface(struct device *dev, const void *data) |
329 | { | 329 | { |
330 | struct find_interface_arg *arg = data; | 330 | const struct find_interface_arg *arg = data; |
331 | struct usb_interface *intf; | 331 | struct usb_interface *intf; |
332 | 332 | ||
333 | if (!is_usb_interface(dev)) | 333 | if (!is_usb_interface(dev)) |
diff --git a/drivers/usb/phy/phy-am335x-control.c b/drivers/usb/phy/phy-am335x-control.c index a3cb25cb74f8..d16dfc320faa 100644 --- a/drivers/usb/phy/phy-am335x-control.c +++ b/drivers/usb/phy/phy-am335x-control.c | |||
@@ -118,9 +118,9 @@ static const struct of_device_id omap_control_usb_id_table[] = { | |||
118 | MODULE_DEVICE_TABLE(of, omap_control_usb_id_table); | 118 | MODULE_DEVICE_TABLE(of, omap_control_usb_id_table); |
119 | 119 | ||
120 | static struct platform_driver am335x_control_driver; | 120 | static struct platform_driver am335x_control_driver; |
121 | static int match(struct device *dev, void *data) | 121 | static int match(struct device *dev, const void *data) |
122 | { | 122 | { |
123 | struct device_node *node = (struct device_node *)data; | 123 | const struct device_node *node = (const struct device_node *)data; |
124 | return dev->of_node == node && | 124 | return dev->of_node == node && |
125 | dev->driver == &am335x_control_driver.driver; | 125 | dev->driver == &am335x_control_driver.driver; |
126 | } | 126 | } |
diff --git a/drivers/usb/phy/phy-isp1301.c b/drivers/usb/phy/phy-isp1301.c index 93b7d6a30aad..6cf6fbd39237 100644 --- a/drivers/usb/phy/phy-isp1301.c +++ b/drivers/usb/phy/phy-isp1301.c | |||
@@ -142,9 +142,9 @@ static struct i2c_driver isp1301_driver = { | |||
142 | 142 | ||
143 | module_i2c_driver(isp1301_driver); | 143 | module_i2c_driver(isp1301_driver); |
144 | 144 | ||
145 | static int match(struct device *dev, void *data) | 145 | static int match(struct device *dev, const void *data) |
146 | { | 146 | { |
147 | struct device_node *node = (struct device_node *)data; | 147 | const struct device_node *node = (const struct device_node *)data; |
148 | return (dev->of_node == node) && | 148 | return (dev->of_node == node) && |
149 | (dev->driver == &isp1301_driver.driver); | 149 | (dev->driver == &isp1301_driver.driver); |
150 | } | 150 | } |
diff --git a/drivers/visorbus/visorbus_main.c b/drivers/visorbus/visorbus_main.c index 0b2434cc4ecd..152fd29f04f2 100644 --- a/drivers/visorbus/visorbus_main.c +++ b/drivers/visorbus/visorbus_main.c | |||
@@ -171,10 +171,10 @@ struct visor_busdev { | |||
171 | u32 dev_no; | 171 | u32 dev_no; |
172 | }; | 172 | }; |
173 | 173 | ||
174 | static int match_visorbus_dev_by_id(struct device *dev, void *data) | 174 | static int match_visorbus_dev_by_id(struct device *dev, const void *data) |
175 | { | 175 | { |
176 | struct visor_device *vdev = to_visor_device(dev); | 176 | struct visor_device *vdev = to_visor_device(dev); |
177 | struct visor_busdev *id = data; | 177 | const struct visor_busdev *id = data; |
178 | 178 | ||
179 | if (vdev->chipset_bus_no == id->bus_no && | 179 | if (vdev->chipset_bus_no == id->bus_no && |
180 | vdev->chipset_dev_no == id->dev_no) | 180 | vdev->chipset_dev_no == id->dev_no) |
diff --git a/include/linux/device.h b/include/linux/device.h index e85264fb6616..cbbdcadc660e 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -166,8 +166,8 @@ void subsys_dev_iter_exit(struct subsys_dev_iter *iter); | |||
166 | int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data, | 166 | int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data, |
167 | int (*fn)(struct device *dev, void *data)); | 167 | int (*fn)(struct device *dev, void *data)); |
168 | struct device *bus_find_device(struct bus_type *bus, struct device *start, | 168 | struct device *bus_find_device(struct bus_type *bus, struct device *start, |
169 | void *data, | 169 | const void *data, |
170 | int (*match)(struct device *dev, void *data)); | 170 | int (*match)(struct device *dev, const void *data)); |
171 | struct device *bus_find_device_by_name(struct bus_type *bus, | 171 | struct device *bus_find_device_by_name(struct bus_type *bus, |
172 | struct device *start, | 172 | struct device *start, |
173 | const char *name); | 173 | const char *name); |
diff --git a/sound/soc/rockchip/rk3399_gru_sound.c b/sound/soc/rockchip/rk3399_gru_sound.c index 3d0cc6e90d7b..c04c9ed185b7 100644 --- a/sound/soc/rockchip/rk3399_gru_sound.c +++ b/sound/soc/rockchip/rk3399_gru_sound.c | |||
@@ -405,7 +405,7 @@ static const struct dailink_match_data dailink_match[] = { | |||
405 | }, | 405 | }, |
406 | }; | 406 | }; |
407 | 407 | ||
408 | static int of_dev_node_match(struct device *dev, void *data) | 408 | static int of_dev_node_match(struct device *dev, const void *data) |
409 | { | 409 | { |
410 | return dev->of_node == data; | 410 | return dev->of_node == data; |
411 | } | 411 | } |