Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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;
}
+2 −2
Original line number Diff line number Diff line
@@ -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;
+1 −1
Original line number Diff line number Diff line
@@ -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);
+2 −2
Original line number Diff line number Diff line
@@ -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;

+3 −3
Original line number Diff line number Diff line
@@ -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;

Loading