Commit 418e3ea1 authored by Suzuki K Poulose's avatar Suzuki K Poulose Committed by Greg Kroah-Hartman

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: default avatarCorey Minyard <minyard@acm.org>
Acked-by: default avatarDavid Kershner <david.kershner@unisys.com>
Acked-by: default avatarMark Brown <broonie@kernel.org>
Acked-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Acked-by: Wolfram Sang <wsa@the-dreams.de> # for the I2C parts
Acked-by: default avatarRob Herring <robh@kernel.org>
Signed-off-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e6374f6b
...@@ -147,13 +147,13 @@ static const struct dma_map_ops ibmebus_dma_ops = { ...@@ -147,13 +147,13 @@ static const struct dma_map_ops ibmebus_dma_ops = {
.unmap_page = ibmebus_unmap_page, .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; struct device_node *dn = to_platform_device(dev)->dev.of_node;
return (of_find_node_by_path(data) == dn); 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; return to_platform_device(dev)->dev.of_node == data;
} }
......
...@@ -511,10 +511,10 @@ struct hid_uid { ...@@ -511,10 +511,10 @@ struct hid_uid {
const char *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 acpi_device *adev = ACPI_COMPANION(dev);
struct hid_uid *id = data; const struct hid_uid *id = data;
if (!adev) if (!adev)
return 0; return 0;
......
...@@ -454,7 +454,7 @@ static int acpi_pm_prepare(void) ...@@ -454,7 +454,7 @@ static int acpi_pm_prepare(void)
return error; 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); struct acpi_device *device = to_acpi_device(dev);
const char *hid = acpi_device_hid(device); const char *hid = acpi_device_hid(device);
......
...@@ -730,10 +730,10 @@ struct acpi_dev_match_info { ...@@ -730,10 +730,10 @@ struct acpi_dev_match_info {
s64 hrv; 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_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; unsigned long long hrv;
acpi_status status; acpi_status status;
......
...@@ -323,8 +323,8 @@ EXPORT_SYMBOL_GPL(bus_for_each_dev); ...@@ -323,8 +323,8 @@ EXPORT_SYMBOL_GPL(bus_for_each_dev);
* return to the caller and not iterate over any more devices. * return to the caller and not iterate over any more devices.
*/ */
struct device *bus_find_device(struct bus_type *bus, struct device *bus_find_device(struct bus_type *bus,
struct device *start, void *data, struct device *start, const void *data,
int (*match)(struct device *dev, void *data)) int (*match)(struct device *dev, const void *data))
{ {
struct klist_iter i; struct klist_iter i;
struct device *dev; struct device *dev;
...@@ -342,7 +342,7 @@ struct device *bus_find_device(struct bus_type *bus, ...@@ -342,7 +342,7 @@ struct device *bus_find_device(struct bus_type *bus,
} }
EXPORT_SYMBOL_GPL(bus_find_device); 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; const char *name = data;
......
...@@ -107,7 +107,7 @@ static struct bus_type *generic_match_buses[] = { ...@@ -107,7 +107,7 @@ static struct bus_type *generic_match_buses[] = {
NULL, 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; return dev_fwnode(dev) == fwnode;
} }
......
...@@ -426,7 +426,7 @@ static int ipmi_remove(struct platform_device *pdev) ...@@ -426,7 +426,7 @@ static int ipmi_remove(struct platform_device *pdev)
return ipmi_si_remove_by_dev(&pdev->dev); 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); struct platform_device *pdev = to_platform_device(dev);
const char *name = data; const char *name = data;
......
...@@ -17,9 +17,9 @@ struct acpi_hid_uid { ...@@ -17,9 +17,9 @@ struct acpi_hid_uid {
char uid[11]; /* UINT_MAX + null byte */ 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); struct acpi_device *adev = to_acpi_device(dev);
if (acpi_match_device_ids(adev, hid_uid.hid)) if (acpi_match_device_ids(adev, hid_uid.hid))
......
...@@ -93,7 +93,7 @@ static struct bus_type mipi_dsi_bus_type = { ...@@ -93,7 +93,7 @@ static struct bus_type mipi_dsi_bus_type = {
.pm = &mipi_dsi_device_pm_ops, .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; return dev->of_node == data;
} }
......
...@@ -498,9 +498,9 @@ struct coresight_device *coresight_get_sink(struct list_head *path) ...@@ -498,9 +498,9 @@ struct coresight_device *coresight_get_sink(struct list_head *path)
return csdev; 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); struct coresight_device *csdev = to_coresight_device(dev);
if ((csdev->type == CORESIGHT_DEV_TYPE_SINK || if ((csdev->type == CORESIGHT_DEV_TYPE_SINK ||
...@@ -544,7 +544,7 @@ struct coresight_device *coresight_get_enabled_sink(bool deactivate) ...@@ -544,7 +544,7 @@ struct coresight_device *coresight_get_enabled_sink(bool deactivate)
return dev ? to_coresight_device(dev) : NULL; 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); struct coresight_device *csdev = to_coresight_device(dev);
unsigned long hash; unsigned long hash;
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include <asm/smp_plat.h> #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; return dev->of_node == data;
} }
......
...@@ -789,10 +789,9 @@ static int intel_th_populate(struct intel_th *th) ...@@ -789,10 +789,9 @@ static int intel_th_populate(struct intel_th *th)
return 0; 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; return dev->devt == devt;
} }
......
...@@ -318,7 +318,7 @@ u32 i2c_acpi_find_bus_speed(struct device *dev) ...@@ -318,7 +318,7 @@ u32 i2c_acpi_find_bus_speed(struct device *dev)
} }
EXPORT_SYMBOL_GPL(i2c_acpi_find_bus_speed); 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); struct i2c_adapter *adapter = i2c_verify_adapter(dev);
...@@ -328,7 +328,7 @@ static int i2c_acpi_find_match_adapter(struct device *dev, void *data) ...@@ -328,7 +328,7 @@ static int i2c_acpi_find_match_adapter(struct device *dev, void *data)
return ACPI_HANDLE(dev) == (acpi_handle)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; return ACPI_COMPANION(dev) == data;
} }
......
...@@ -112,12 +112,12 @@ void of_i2c_register_devices(struct i2c_adapter *adap) ...@@ -112,12 +112,12 @@ void of_i2c_register_devices(struct i2c_adapter *adap)
of_node_put(bus); 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; 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) if (dev->of_node == data)
return 1; return 1;
......
...@@ -93,7 +93,7 @@ static const struct iio_chan_spec ...@@ -93,7 +93,7 @@ static const struct iio_chan_spec
#ifdef CONFIG_OF #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; return dev->of_node == data && dev->type == &iio_device_type;
} }
......
...@@ -4497,7 +4497,7 @@ static const struct acpi_device_id hns_roce_acpi_match[] = { ...@@ -4497,7 +4497,7 @@ static const struct acpi_device_id hns_roce_acpi_match[] = {
}; };
MODULE_DEVICE_TABLE(acpi, 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; return dev->fwnode == fwnode;
} }
......
...@@ -754,7 +754,7 @@ struct dsaf_misc_op *hns_misc_op_get(struct dsaf_device *dsaf_dev) ...@@ -754,7 +754,7 @@ struct dsaf_misc_op *hns_misc_op_get(struct dsaf_device *dsaf_dev)
return (void *)misc_op; 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; return dev->fwnode == fwnode;
} }
......
...@@ -151,9 +151,9 @@ static void cpsw_gmii_sel_dra7xx(struct cpsw_phy_sel_priv *priv, ...@@ -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 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 && return dev->of_node == node &&
dev->driver == &cpsw_phy_sel_driver.driver; dev->driver == &cpsw_phy_sel_driver.driver;
} }
......
...@@ -1371,7 +1371,7 @@ static int emac_devioctl(struct net_device *ndev, struct ifreq *ifrq, int cmd) ...@@ -1371,7 +1371,7 @@ static int emac_devioctl(struct net_device *ndev, struct ifreq *ifrq, int cmd)
return -EOPNOTSUPP; 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) if (dev->parent && dev->parent->of_node)
return of_device_is_compatible(dev->parent->of_node, return of_device_is_compatible(dev->parent->of_node,
......
...@@ -694,10 +694,10 @@ static int tc_mii_init(struct net_device *dev) ...@@ -694,10 +694,10 @@ static int tc_mii_init(struct net_device *dev)
* should provide a "tc35815-mac" device with a MAC address in its * should provide a "tc35815-mac" device with a MAC address in its
* platform_data. * 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 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; unsigned int id = pci_dev->irq;
return !strcmp(plat_dev->name, "tc35815-mac") && plat_dev->id == id; return !strcmp(plat_dev->name, "tc35815-mac") && plat_dev->id == id;
} }
......
...@@ -76,7 +76,7 @@ static struct bus_type nvmem_bus_type = { ...@@ -76,7 +76,7 @@ static struct bus_type nvmem_bus_type = {
.name = "nvmem", .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; return dev->of_node == nvmem_np;
} }
......
...@@ -282,7 +282,7 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) ...@@ -282,7 +282,7 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
EXPORT_SYMBOL(of_mdiobus_register); EXPORT_SYMBOL(of_mdiobus_register);
/* Helper function for of_phy_find_device */ /* 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; return dev->of_node == phy_np;
} }
......
...@@ -37,7 +37,7 @@ static const struct of_device_id of_skipped_node_table[] = { ...@@ -37,7 +37,7 @@ static const struct of_device_id of_skipped_node_table[] = {
{} /* Empty terminated list */ {} /* 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; return dev->of_node == data;
} }
......
...@@ -64,7 +64,7 @@ static struct resource *get_pci_domain_busn_res(int domain_nr) ...@@ -64,7 +64,7 @@ static struct resource *get_pci_domain_busn_res(int domain_nr)
return &r->res; return &r->res;
} }
static int find_anything(struct device *dev, void *data) static int find_anything(struct device *dev, const void *data)
{ {
return 1; return 1;
} }
......
...@@ -236,10 +236,10 @@ struct pci_dev *pci_get_domain_bus_and_slot(int domain, unsigned int bus, ...@@ -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); 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_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)) if (pci_match_one_device(id, pdev))
return 1; return 1;
......
...@@ -434,10 +434,10 @@ static int css_probe_device(struct subchannel_id schid, struct schib *schib) ...@@ -434,10 +434,10 @@ static int css_probe_device(struct subchannel_id schid, struct schib *schib)
} }
static int static int
check_subchannel(struct device * dev, void * data) check_subchannel(struct device *dev, const void *data)
{ {
struct subchannel *sch; struct subchannel *sch;
struct subchannel_id *schid = data; struct subchannel_id *schid = (void *)data;
sch = to_subchannel(dev); sch = to_subchannel(dev);
return schid_equal(&sch->schid, schid); return schid_equal(&sch->schid, schid);
......
...@@ -642,10 +642,10 @@ static int ccw_device_add(struct ccw_device *cdev) ...@@ -642,10 +642,10 @@ static int ccw_device_add(struct ccw_device *cdev)
return device_add(dev); 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_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); return ccw_dev_id_is_equal(&cdev->private->dev_id, dev_id);
} }
......
...@@ -174,10 +174,10 @@ static void scmdev_update(struct scm_device *scmdev, struct sale *sale) ...@@ -174,10 +174,10 @@ static void scmdev_update(struct scm_device *scmdev, struct sale *sale)
kobject_uevent(&scmdev->dev.kobj, KOBJ_CHANGE); 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 scm_device *scmdev = to_scm_dev(dev);
struct sale *sale = data; const struct sale *sale = data;
return scmdev->address == sale->sa; return scmdev->address == sale->sa;
} }
......
...@@ -1356,16 +1356,16 @@ static int ap_get_compatible_type(ap_qid_t qid, int rawtype, unsigned int func) ...@@ -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 * Helper function to be used with bus_find_dev
* matches for the card device with the given id * 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 * Helper function to be used with bus_find_dev
* matches for the queue device with a given qid * 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; 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) ...@@ -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 * Helper function to be used with bus_find_dev
* matches any queue device with given queue id * 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) return is_queue_dev(dev)
&& AP_QID_QUEUE(to_ap_queue(dev)->qid) == (int)(long) data; && AP_QID_QUEUE(to_ap_queue(dev)->qid) == (int)(long) data;
......
...@@ -372,7 +372,7 @@ static ssize_t proc_scsi_write(struct file *file, const char __user *buf, ...@@ -372,7 +372,7 @@ static ssize_t proc_scsi_write(struct file *file, const char __user *buf,
return err; return err;
} }
static int always_match(struct device *dev, void *data) static int always_match(struct device *dev, const void *data)
{ {
return 1; return 1;
} }
......
...@@ -3538,7 +3538,7 @@ EXPORT_SYMBOL_GPL(spi_write_then_read); ...@@ -3538,7 +3538,7 @@ EXPORT_SYMBOL_GPL(spi_write_then_read);
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
#if IS_ENABLED(CONFIG_OF) #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; return dev->of_node == data;
} }
...@@ -3639,7 +3639,7 @@ static int spi_acpi_controller_match(struct device *dev, const void *data) ...@@ -3639,7 +3639,7 @@ static int spi_acpi_controller_match(struct device *dev, const void *data)
return ACPI_COMPANION(dev->parent) == 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; return ACPI_COMPANION(dev) == data;
} }
......
...@@ -1946,10 +1946,10 @@ struct tb_sw_lookup { ...@@ -1946,10 +1946,10 @@ struct tb_sw_lookup {
u64 route; 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_switch *sw = tb_to_switch(dev);
struct tb_sw_lookup *lookup = data; const struct tb_sw_lookup *lookup = data;
if (!sw) if (!sw)
return 0; return 0;
......
...@@ -947,9 +947,9 @@ static int parse_usbdevfs_streams(struct usb_dev_state *ps, ...@@ -947,9 +947,9 @@ static int parse_usbdevfs_streams(struct usb_dev_state *ps,
return ret; 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) static struct usb_device *usbdev_lookup_by_devt(dev_t devt)
......
...@@ -325,9 +325,9 @@ struct find_interface_arg { ...@@ -325,9 +325,9 @@ struct find_interface_arg {
struct device_driver *drv; 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; struct usb_interface *intf;
if (!is_usb_interface(dev)) if (!is_usb_interface(dev))
......
...@@ -118,9 +118,9 @@ static const struct of_device_id omap_control_usb_id_table[] = { ...@@ -118,9 +118,9 @@ static const struct of_device_id omap_control_usb_id_table[] = {
MODULE_DEVICE_TABLE(of, omap_control_usb_id_table); MODULE_DEVICE_TABLE(of, omap_control_usb_id_table);
static struct platform_driver am335x_control_driver; 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 && return dev->of_node == node &&
dev->driver == &am335x_control_driver.driver; dev->driver == &am335x_control_driver.driver;
} }
......
...@@ -142,9 +142,9 @@ static struct i2c_driver isp1301_driver = { ...@@ -142,9 +142,9 @@ static struct i2c_driver isp1301_driver = {
module_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) && return (dev->of_node == node) &&
(dev->driver == &isp1301_driver.driver); (dev->driver == &isp1301_driver.driver);
} }
......
...@@ -171,10 +171,10 @@ struct visor_busdev { ...@@ -171,10 +171,10 @@ struct visor_busdev {
u32 dev_no; 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_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 && if (vdev->chipset_bus_no == id->bus_no &&
vdev->chipset_dev_no == id->dev_no) vdev->chipset_dev_no == id->dev_no)
......
...@@ -166,8 +166,8 @@ void subsys_dev_iter_exit(struct subsys_dev_iter *iter); ...@@ -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 bus_for_each_dev(struct bus_type *bus, struct device *start, void *data,
int (*fn)(struct device *dev, void *data)); int (*fn)(struct device *dev, void *data));
struct device *bus_find_device(struct bus_type *bus, struct device *start, struct device *bus_find_device(struct bus_type *bus, struct device *start,
void *data, const void *data,
int (*match)(struct device *dev, void *data)); int (*match)(struct device *dev, const void *data));
struct device *bus_find_device_by_name(struct bus_type *bus, struct device *bus_find_device_by_name(struct bus_type *bus,
struct device *start, struct device *start,
const char *name); const char *name);
......
...@@ -405,7 +405,7 @@ static const struct dailink_match_data dailink_match[] = { ...@@ -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; return dev->of_node == data;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment