bus_find_device: Unify the match callback with class_find_device
authorSuzuki K Poulose <suzuki.poulose@arm.com>
Fri, 14 Jun 2019 17:53:59 +0000 (18:53 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 24 Jun 2019 03:22:31 +0000 (05:22 +0200)
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:
arch/powerpc/platforms/pseries/ibmebus.c
drivers/acpi/acpi_lpss.c
drivers/acpi/sleep.c
drivers/acpi/utils.c
drivers/base/bus.c
drivers/base/devcon.c
drivers/char/ipmi/ipmi_si_platform.c
drivers/firmware/efi/dev-path-parser.c
drivers/gpu/drm/drm_mipi_dsi.c
drivers/hwtracing/coresight/coresight.c
drivers/hwtracing/coresight/of_coresight.c
drivers/hwtracing/intel_th/core.c
drivers/i2c/i2c-core-acpi.c
drivers/i2c/i2c-core-of.c
drivers/iio/inkern.c
drivers/infiniband/hw/hns/hns_roce_hw_v1.c
drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c
drivers/net/ethernet/ti/cpsw-phy-sel.c
drivers/net/ethernet/ti/davinci_emac.c
drivers/net/ethernet/toshiba/tc35815.c
drivers/nvmem/core.c
drivers/of/of_mdio.c
drivers/of/platform.c
drivers/pci/probe.c
drivers/pci/search.c
drivers/s390/cio/css.c
drivers/s390/cio/device.c
drivers/s390/cio/scm.c
drivers/s390/crypto/ap_bus.c
drivers/scsi/scsi_proc.c
drivers/spi/spi.c
drivers/thunderbolt/switch.c
drivers/usb/core/devio.c
drivers/usb/core/usb.c
drivers/usb/phy/phy-am335x-control.c
drivers/usb/phy/phy-isp1301.c
drivers/visorbus/visorbus_main.c
include/linux/device.h
sound/soc/rockchip/rk3399_gru_sound.c

index 84e8ec4011ba72a39ffa0b4b209c1f1b496dd4cf..b91eb0929ed144cceb6258c278f4bc633f9319a1 100644 (file)
@@ -147,13 +147,13 @@ static const struct dma_map_ops ibmebus_dma_ops = {
        .unmap_page         = ibmebus_unmap_page,
 };
 
-static int ibmebus_match_path(struct device *dev, void *data)
+static int ibmebus_match_path(struct device *dev, const void *data)
 {
        struct device_node *dn = to_platform_device(dev)->dev.of_node;
        return (of_find_node_by_path(data) == dn);
 }
 
-static int ibmebus_match_node(struct device *dev, void *data)
+static int ibmebus_match_node(struct device *dev, const void *data)
 {
        return to_platform_device(dev)->dev.of_node == data;
 }
index cf768608437e1bade6adf13b7ae9ca443400f995..dc2ca78748a2f5c7884174dfccc3a127be2746cc 100644 (file)
@@ -511,10 +511,10 @@ struct hid_uid {
        const char *uid;
 };
 
-static int match_hid_uid(struct device *dev, void *data)
+static int match_hid_uid(struct device *dev, const void *data)
 {
        struct acpi_device *adev = ACPI_COMPANION(dev);
-       struct hid_uid *id = data;
+       const struct hid_uid *id = data;
 
        if (!adev)
                return 0;
index a34deccd7317ee6a01350d84c96deecbadc4683e..fcf4386ecc78586ba92377ced803215e6068d32f 100644 (file)
@@ -454,7 +454,7 @@ static int acpi_pm_prepare(void)
        return error;
 }
 
-static int find_powerf_dev(struct device *dev, void *data)
+static int find_powerf_dev(struct device *dev, const void *data)
 {
        struct acpi_device *device = to_acpi_device(dev);
        const char *hid = acpi_device_hid(device);
index 1391b63cadfd55fd141c7752a9e37b669691539a..e3974a8f8fd41aa30cc89c0b951a16fd1e2babe6 100644 (file)
@@ -730,10 +730,10 @@ struct acpi_dev_match_info {
        s64 hrv;
 };
 
-static int acpi_dev_match_cb(struct device *dev, void *data)
+static int acpi_dev_match_cb(struct device *dev, const void *data)
 {
        struct acpi_device *adev = to_acpi_device(dev);
-       struct acpi_dev_match_info *match = data;
+       const struct acpi_dev_match_info *match = data;
        unsigned long long hrv;
        acpi_status status;
 
index 0a58e969f8b7c27c1c956004f7d036b6e7b8def5..df3cac739813fd7f85ef02da83504aa0e4d34d59 100644 (file)
@@ -323,8 +323,8 @@ EXPORT_SYMBOL_GPL(bus_for_each_dev);
  * return to the caller and not iterate over any more devices.
  */
 struct device *bus_find_device(struct bus_type *bus,
-                              struct device *start, void *data,
-                              int (*match)(struct device *dev, void *data))
+                              struct device *start, const void *data,
+                              int (*match)(struct device *dev, const void *data))
 {
        struct klist_iter i;
        struct device *dev;
@@ -342,7 +342,7 @@ struct device *bus_find_device(struct bus_type *bus,
 }
 EXPORT_SYMBOL_GPL(bus_find_device);
 
-static int match_name(struct device *dev, void *data)
+static int match_name(struct device *dev, const void *data)
 {
        const char *name = data;
 
index 04db9ae235e41ef2a9d254ce6a4c76977ef193b1..ac026d5fc672676425ffa405f1224a033180d506 100644 (file)
@@ -107,7 +107,7 @@ static struct bus_type *generic_match_buses[] = {
        NULL,
 };
 
-static int device_fwnode_match(struct device *dev, void *fwnode)
+static int device_fwnode_match(struct device *dev, const void *fwnode)
 {
        return dev_fwnode(dev) == fwnode;
 }
index f2a91c4d8cab6074c9a1d1d6686ee1f5daf6dde4..fd94c423844944cd34b378cba20486c15d743549 100644 (file)
@@ -426,7 +426,7 @@ static int ipmi_remove(struct platform_device *pdev)
        return ipmi_si_remove_by_dev(&pdev->dev);
 }
 
-static int pdev_match_name(struct device *dev, void *data)
+static int pdev_match_name(struct device *dev, const void *data)
 {
        struct platform_device *pdev = to_platform_device(dev);
        const char *name = data;
index 85ec99f978412fc9c4d18fb3dc3c94c0164b1042..20123384271c8150e969471ee19ac090953207d6 100644 (file)
@@ -17,9 +17,9 @@ struct acpi_hid_uid {
        char uid[11]; /* UINT_MAX + null byte */
 };
 
-static int __init match_acpi_dev(struct device *dev, void *data)
+static int __init match_acpi_dev(struct device *dev, const void *data)
 {
-       struct acpi_hid_uid hid_uid = *(struct acpi_hid_uid *)data;
+       struct acpi_hid_uid hid_uid = *(const struct acpi_hid_uid *)data;
        struct acpi_device *adev = to_acpi_device(dev);
 
        if (acpi_match_device_ids(adev, hid_uid.hid))
index 80b75501f5c6a203d7967fffdb94378b89039dab..ad19df0686c93c0cdd66d18543764a4925357ab5 100644 (file)
@@ -93,7 +93,7 @@ static struct bus_type mipi_dsi_bus_type = {
        .pm = &mipi_dsi_device_pm_ops,
 };
 
-static int of_device_match(struct device *dev, void *data)
+static int of_device_match(struct device *dev, const void *data)
 {
        return dev->of_node == data;
 }
index 4b130281236a25c0e9ebaac850ba5ac1f2ac0a99..b67ab6a09587f5009de7a17a5daf2688b7c713a7 100644 (file)
@@ -498,9 +498,9 @@ struct coresight_device *coresight_get_sink(struct list_head *path)
        return csdev;
 }
 
-static int coresight_enabled_sink(struct device *dev, void *data)
+static int coresight_enabled_sink(struct device *dev, const void *data)
 {
-       bool *reset = data;
+       const bool *reset = data;
        struct coresight_device *csdev = to_coresight_device(dev);
 
        if ((csdev->type == CORESIGHT_DEV_TYPE_SINK ||
@@ -544,7 +544,7 @@ struct coresight_device *coresight_get_enabled_sink(bool deactivate)
        return dev ? to_coresight_device(dev) : NULL;
 }
 
-static int coresight_sink_by_id(struct device *dev, void *data)
+static int coresight_sink_by_id(struct device *dev, const void *data)
 {
        struct coresight_device *csdev = to_coresight_device(dev);
        unsigned long hash;
index 7045930fc958d0034813855d7f6cd4b6ad53a437..3fc200ec1c03aa88c089d4f0093f09d9c320ae76 100644 (file)
@@ -18,7 +18,7 @@
 #include <asm/smp_plat.h>
 
 
-static int of_dev_node_match(struct device *dev, void *data)
+static int of_dev_node_match(struct device *dev, const void *data)
 {
        return dev->of_node == data;
 }
index 033dce563c993ae4f859209b9d4a474da9cf074c..55922896d862686fbe64e9ea214f1d15413f1797 100644 (file)
@@ -789,10 +789,9 @@ static int intel_th_populate(struct intel_th *th)
        return 0;
 }
 
-static int match_devt(struct device *dev, void *data)
+static int match_devt(struct device *dev, const void *data)
 {
-       dev_t devt = (dev_t)(unsigned long)data;
-
+       dev_t devt = (dev_t)(unsigned long)(void *)data;
        return dev->devt == devt;
 }
 
index d84095591e4549400799f76cf98e85f0f7ac5ba3..8af35f1148213318ae5c750b21c9597cf237ae23 100644 (file)
@@ -318,7 +318,7 @@ u32 i2c_acpi_find_bus_speed(struct device *dev)
 }
 EXPORT_SYMBOL_GPL(i2c_acpi_find_bus_speed);
 
-static int i2c_acpi_find_match_adapter(struct device *dev, void *data)
+static int i2c_acpi_find_match_adapter(struct device *dev, const void *data)
 {
        struct i2c_adapter *adapter = i2c_verify_adapter(dev);
 
@@ -328,7 +328,7 @@ static int i2c_acpi_find_match_adapter(struct device *dev, void *data)
        return ACPI_HANDLE(dev) == (acpi_handle)data;
 }
 
-static int i2c_acpi_find_match_device(struct device *dev, void *data)
+static int i2c_acpi_find_match_device(struct device *dev, const void *data)
 {
        return ACPI_COMPANION(dev) == data;
 }
index 406e5f695a7ecb6b832ae29c3b30258afaef8fe6..2eb59a260ad469c37a10757a237242f64df07eeb 100644 (file)
@@ -112,12 +112,12 @@ void of_i2c_register_devices(struct i2c_adapter *adap)
        of_node_put(bus);
 }
 
-static int of_dev_node_match(struct device *dev, void *data)
+static int of_dev_node_match(struct device *dev, const void *data)
 {
        return dev->of_node == data;
 }
 
-static int of_dev_or_parent_node_match(struct device *dev, void *data)
+static int of_dev_or_parent_node_match(struct device *dev, const void *data)
 {
        if (dev->of_node == data)
                return 1;
index 4a5eff3f18bcd34b39162b377fbc3707d12338ac..c46fb59d92cba79029701c743a4b7abe437ba1d2 100644 (file)
@@ -93,7 +93,7 @@ static const struct iio_chan_spec
 
 #ifdef CONFIG_OF
 
-static int iio_dev_node_match(struct device *dev, void *data)
+static int iio_dev_node_match(struct device *dev, const void *data)
 {
        return dev->of_node == data && dev->type == &iio_device_type;
 }
index 4c5d0f160c106f8974621bc0c459de2462e51300..fd90b05849c8a444d4250a13b813e5009d58cf09 100644 (file)
@@ -4497,7 +4497,7 @@ static const struct acpi_device_id hns_roce_acpi_match[] = {
 };
 MODULE_DEVICE_TABLE(acpi, hns_roce_acpi_match);
 
-static int hns_roce_node_match(struct device *dev, void *fwnode)
+static int hns_roce_node_match(struct device *dev, const void *fwnode)
 {
        return dev->fwnode == fwnode;
 }
index 09c16d88172e1da63ab416c6282f88d4ca7f2002..bb6586d0e5af6676948ea3cdcf8c2e1089deb102 100644 (file)
@@ -754,7 +754,7 @@ struct dsaf_misc_op *hns_misc_op_get(struct dsaf_device *dsaf_dev)
        return (void *)misc_op;
 }
 
-static int hns_dsaf_dev_match(struct device *dev, void *fwnode)
+static int hns_dsaf_dev_match(struct device *dev, const void *fwnode)
 {
        return dev->fwnode == fwnode;
 }
index 48e0924259f541425d190dabb4841623987f68e0..4e184eecc8e180c737c620c49523aca605526d6d 100644 (file)
@@ -151,9 +151,9 @@ static void cpsw_gmii_sel_dra7xx(struct cpsw_phy_sel_priv *priv,
 }
 
 static struct platform_driver cpsw_phy_sel_driver;
-static int match(struct device *dev, void *data)
+static int match(struct device *dev, const void *data)
 {
-       struct device_node *node = (struct device_node *)data;
+       const struct device_node *node = (const struct device_node *)data;
        return dev->of_node == node &&
                dev->driver == &cpsw_phy_sel_driver.driver;
 }
index 4bf65cab79e6cae5d7c5b20cdc87a130f8ad7918..57d131a04db34a0fde8423363116effc0ff9deea 100644 (file)
@@ -1371,7 +1371,7 @@ static int emac_devioctl(struct net_device *ndev, struct ifreq *ifrq, int cmd)
                return -EOPNOTSUPP;
 }
 
-static int match_first_device(struct device *dev, void *data)
+static int match_first_device(struct device *dev, const void *data)
 {
        if (dev->parent && dev->parent->of_node)
                return of_device_is_compatible(dev->parent->of_node,
index c50a9772f4affbdb4fc0683dc987f74766f22263..8479a440527b8902cfc6b1b5cd25ef34c6171e7b 100644 (file)
@@ -694,10 +694,10 @@ err_out:
  * should provide a "tc35815-mac" device with a MAC address in its
  * platform_data.
  */
-static int tc35815_mac_match(struct device *dev, void *data)
+static int tc35815_mac_match(struct device *dev, const void *data)
 {
        struct platform_device *plat_dev = to_platform_device(dev);
-       struct pci_dev *pci_dev = data;
+       const struct pci_dev *pci_dev = data;
        unsigned int id = pci_dev->irq;
        return !strcmp(plat_dev->name, "tc35815-mac") && plat_dev->id == id;
 }
index c7892c3da91f8f2e69ad4f4fd1bca5c79afce8bc..ac5d945be88a8ea9eab02b85b23a0bb84e11b93e 100644 (file)
@@ -76,7 +76,7 @@ static struct bus_type nvmem_bus_type = {
        .name           = "nvmem",
 };
 
-static int of_nvmem_match(struct device *dev, void *nvmem_np)
+static int of_nvmem_match(struct device *dev, const void *nvmem_np)
 {
        return dev->of_node == nvmem_np;
 }
index de6157357e269b7cea27166fc5b88a2475b804d9..dfe12948c8344865b50dbc2f832035c75850509d 100644 (file)
@@ -282,7 +282,7 @@ unregister:
 EXPORT_SYMBOL(of_mdiobus_register);
 
 /* Helper function for of_phy_find_device */
-static int of_phy_match(struct device *dev, void *phy_np)
+static int of_phy_match(struct device *dev, const void *phy_np)
 {
        return dev->of_node == phy_np;
 }
index 04ad312fd85b9a2af8920fb81092b3ae4ca65a41..008d79e33c2d48bfbe89a08d6eb7646d1261de79 100644 (file)
@@ -37,7 +37,7 @@ static const struct of_device_id of_skipped_node_table[] = {
        {} /* Empty terminated list */
 };
 
-static int of_dev_node_match(struct device *dev, void *data)
+static int of_dev_node_match(struct device *dev, const void *data)
 {
        return dev->of_node == data;
 }
index 0e8e2c186f508df22739534e464a37b1f3a89225..f9ef7ad3f75d2efbbc60e31646e99aad33c7e4e0 100644 (file)
@@ -64,7 +64,7 @@ static struct resource *get_pci_domain_busn_res(int domain_nr)
        return &r->res;
 }
 
-static int find_anything(struct device *dev, void *data)
+static int find_anything(struct device *dev, const void *data)
 {
        return 1;
 }
index 5c7922612733ec668f7583b33939752cc5cab1e6..7f4e65872b8daf640886d9887f9be804779f0dc4 100644 (file)
@@ -236,10 +236,10 @@ struct pci_dev *pci_get_domain_bus_and_slot(int domain, unsigned int bus,
 }
 EXPORT_SYMBOL(pci_get_domain_bus_and_slot);
 
-static int match_pci_dev_by_id(struct device *dev, void *data)
+static int match_pci_dev_by_id(struct device *dev, const void *data)
 {
        struct pci_dev *pdev = to_pci_dev(dev);
-       struct pci_device_id *id = data;
+       const struct pci_device_id *id = data;
 
        if (pci_match_one_device(id, pdev))
                return 1;
index aea50292264629e63f131dfd2dfd87d3ff108799..a2c97830efe0375fcc76bdfb13b0c6aae5af8ce2 100644 (file)
@@ -434,10 +434,10 @@ static int css_probe_device(struct subchannel_id schid, struct schib *schib)
 }
 
 static int
-check_subchannel(struct device * dev, void * data)
+check_subchannel(struct device *dev, const void *data)
 {
        struct subchannel *sch;
-       struct subchannel_id *schid = data;
+       struct subchannel_id *schid = (void *)data;
 
        sch = to_subchannel(dev);
        return schid_equal(&sch->schid, schid);
index 1540229a37bbab129e39b8ef0ad943be237b86b8..d32f373e5bc79cc79421e4098f6d47f7784945a2 100644 (file)
@@ -642,10 +642,10 @@ static int ccw_device_add(struct ccw_device *cdev)
        return device_add(dev);
 }
 
-static int match_dev_id(struct device *dev, void *data)
+static int match_dev_id(struct device *dev, const void *data)
 {
        struct ccw_device *cdev = to_ccwdev(dev);
-       struct ccw_dev_id *dev_id = data;
+       struct ccw_dev_id *dev_id = (void *)data;
 
        return ccw_dev_id_is_equal(&cdev->private->dev_id, dev_id);
 }
index 6bca1d5455d4f6ce1997d39d09792a90e65511a0..9f26d4310bb3465132132c8a15d7bfe54c1dc7c6 100644 (file)
@@ -174,10 +174,10 @@ out:
                kobject_uevent(&scmdev->dev.kobj, KOBJ_CHANGE);
 }
 
-static int check_address(struct device *dev, void *data)
+static int check_address(struct device *dev, const void *data)
 {
        struct scm_device *scmdev = to_scm_dev(dev);
-       struct sale *sale = data;
+       const struct sale *sale = data;
 
        return scmdev->address == sale->sa;
 }
index b9fc502c58c24a146c9e5c5109312a2d40c7d268..b7902b643ec8392abff5d313c181060a7a5fe77f 100644 (file)
@@ -1356,16 +1356,16 @@ static int ap_get_compatible_type(ap_qid_t qid, int rawtype, unsigned int func)
  * Helper function to be used with bus_find_dev
  * matches for the card device with the given id
  */
-static int __match_card_device_with_id(struct device *dev, void *data)
+static int __match_card_device_with_id(struct device *dev, const void *data)
 {
-       return is_card_dev(dev) && to_ap_card(dev)->id == (int)(long) data;
+       return is_card_dev(dev) && to_ap_card(dev)->id == (int)(long)(void *) data;
 }
 
 /*
  * Helper function to be used with bus_find_dev
  * matches for the queue device with a given qid
  */
-static int __match_queue_device_with_qid(struct device *dev, void *data)
+static int __match_queue_device_with_qid(struct device *dev, const void *data)
 {
        return is_queue_dev(dev) && to_ap_queue(dev)->qid == (int)(long) data;
 }
@@ -1374,7 +1374,7 @@ static int __match_queue_device_with_qid(struct device *dev, void *data)
  * Helper function to be used with bus_find_dev
  * matches any queue device with given queue id
  */
-static int __match_queue_device_with_queue_id(struct device *dev, void *data)
+static int __match_queue_device_with_queue_id(struct device *dev, const void *data)
 {
        return is_queue_dev(dev)
                && AP_QID_QUEUE(to_ap_queue(dev)->qid) == (int)(long) data;
index 7f0ceb65c3f39dcc89ac21a10f36de6391b5bcee..c074631086a4db3e38c03d6a1425607472afd69c 100644 (file)
@@ -372,7 +372,7 @@ static ssize_t proc_scsi_write(struct file *file, const char __user *buf,
        return err;
 }
 
-static int always_match(struct device *dev, void *data)
+static int always_match(struct device *dev, const void *data)
 {
        return 1;
 }
index 5e75944ad5d1cd5b813a01c683d192db0806266c..3da1121f7572250e39b53cc115a94878418a326a 100644 (file)
@@ -3538,7 +3538,7 @@ EXPORT_SYMBOL_GPL(spi_write_then_read);
 /*-------------------------------------------------------------------------*/
 
 #if IS_ENABLED(CONFIG_OF)
-static int __spi_of_device_match(struct device *dev, void *data)
+static int __spi_of_device_match(struct device *dev, const void *data)
 {
        return dev->of_node == data;
 }
@@ -3639,7 +3639,7 @@ static int spi_acpi_controller_match(struct device *dev, const void *data)
        return ACPI_COMPANION(dev->parent) == data;
 }
 
-static int spi_acpi_device_match(struct device *dev, void *data)
+static int spi_acpi_device_match(struct device *dev, const void *data)
 {
        return ACPI_COMPANION(dev) == data;
 }
index c1b016574fb4562319583dcb3710ef644def7629..c9a7e4a779cd0e1f7048efa71f15821c208b8bc8 100644 (file)
@@ -1946,10 +1946,10 @@ struct tb_sw_lookup {
        u64 route;
 };
 
-static int tb_switch_match(struct device *dev, void *data)
+static int tb_switch_match(struct device *dev, const void *data)
 {
        struct tb_switch *sw = tb_to_switch(dev);
-       struct tb_sw_lookup *lookup = data;
+       const struct tb_sw_lookup *lookup = data;
 
        if (!sw)
                return 0;
index fa783531ee889140d580e19a489cede393f12a10..7bd7de7273a3c123fba4c9e8c62f66553f13b90f 100644 (file)
@@ -947,9 +947,9 @@ error:
        return ret;
 }
 
-static int match_devt(struct device *dev, void *data)
+static int match_devt(struct device *dev, const void *data)
 {
-       return dev->devt == (dev_t) (unsigned long) data;
+       return dev->devt == (dev_t)(unsigned long)(void *)data;
 }
 
 static struct usb_device *usbdev_lookup_by_devt(dev_t devt)
index 7fcb9f782931035b10fbeb3e6a50b897f6828e36..1678e305e037e7260c13d31a52833db5080d2d08 100644 (file)
@@ -325,9 +325,9 @@ struct find_interface_arg {
        struct device_driver *drv;
 };
 
-static int __find_interface(struct device *dev, void *data)
+static int __find_interface(struct device *dev, const void *data)
 {
-       struct find_interface_arg *arg = data;
+       const struct find_interface_arg *arg = data;
        struct usb_interface *intf;
 
        if (!is_usb_interface(dev))
index a3cb25cb74f833a3735ea4ca5eb876afd5214a3e..d16dfc320faa8930a97d6feb285f9b2431264378 100644 (file)
@@ -118,9 +118,9 @@ static const struct of_device_id omap_control_usb_id_table[] = {
 MODULE_DEVICE_TABLE(of, omap_control_usb_id_table);
 
 static struct platform_driver am335x_control_driver;
-static int match(struct device *dev, void *data)
+static int match(struct device *dev, const void *data)
 {
-       struct device_node *node = (struct device_node *)data;
+       const struct device_node *node = (const struct device_node *)data;
        return dev->of_node == node &&
                dev->driver == &am335x_control_driver.driver;
 }
index 93b7d6a30aad4cd8cad8744cf2778ff6e97f8da4..6cf6fbd39237633fc9c8afd4cf7959c779a9ad63 100644 (file)
@@ -142,9 +142,9 @@ static struct i2c_driver isp1301_driver = {
 
 module_i2c_driver(isp1301_driver);
 
-static int match(struct device *dev, void *data)
+static int match(struct device *dev, const void *data)
 {
-       struct device_node *node = (struct device_node *)data;
+       const struct device_node *node = (const struct device_node *)data;
        return (dev->of_node == node) &&
                (dev->driver == &isp1301_driver.driver);
 }
index 0b2434cc4ecd4dbd6dde5feccea26fbb42ee5a1b..152fd29f04f295509b3317f899e0fc7675e4e527 100644 (file)
@@ -171,10 +171,10 @@ struct visor_busdev {
        u32 dev_no;
 };
 
-static int match_visorbus_dev_by_id(struct device *dev, void *data)
+static int match_visorbus_dev_by_id(struct device *dev, const void *data)
 {
        struct visor_device *vdev = to_visor_device(dev);
-       struct visor_busdev *id = data;
+       const struct visor_busdev *id = data;
 
        if (vdev->chipset_bus_no == id->bus_no &&
            vdev->chipset_dev_no == id->dev_no)
index e85264fb66161408aee2815001d8d5159ab04ac1..cbbdcadc660e8d0eb1597e910474cb01181701a8 100644 (file)
@@ -166,8 +166,8 @@ void subsys_dev_iter_exit(struct subsys_dev_iter *iter);
 int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data,
                     int (*fn)(struct device *dev, void *data));
 struct device *bus_find_device(struct bus_type *bus, struct device *start,
-                              void *data,
-                              int (*match)(struct device *dev, void *data));
+                              const void *data,
+                              int (*match)(struct device *dev, const void *data));
 struct device *bus_find_device_by_name(struct bus_type *bus,
                                       struct device *start,
                                       const char *name);
index 3d0cc6e90d7b3bcc248b8f321792aab2a4d0155a..c04c9ed185b738320d6421e003861b52c79ac073 100644 (file)
@@ -405,7 +405,7 @@ static const struct dailink_match_data dailink_match[] = {
        },
 };
 
-static int of_dev_node_match(struct device *dev, void *data)
+static int of_dev_node_match(struct device *dev, const void *data)
 {
        return dev->of_node == data;
 }