Re: [RFC PATCH 27/57] drivers: Unify the match prototype for bus_find_device with class_find_device

Harald Freudenberger
2019-06-04T06:52:56Z

On 03.06.19 17:49, Suzuki K Poulose wrote:
> We have iterators for devices by bus and class, with a supplied
> "match" function to do the comparison. However, both of the helper
> function have slightly different prototype for the "match" argument.
>
> int (*) (struct device *dev, void *data) // bus_find_device
> vs
> int (*) (struct device *dev, const void *data) // class_find_device
>
> Unify the prototype by promoting the match function to use that of
> the class_find_device(). This will allow us to share the generic
> match helpers with class_find_device() users.
>
> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
> Cc: Wolfram Sang <wsa@the-dreams.de>
> Cc: Jonathan Cameron <jic23@kernel.org>
> Cc: Hartmut Knaack <knaack.h@gmx.de>
> Cc: Grygorii Strashko <grygorii.strashko@ti.com>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Bjorn Helgaas <bhelgaas@google.com>
> Cc: Sebastian Ott <sebott@linux.ibm.com>
> Cc: Peter Oberparleiter <oberpar@linux.ibm.com>
> Cc: Harald Freudenberger <freude@linux.ibm.com>
> Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>
> Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
> Cc: Andreas Noever <andreas.noever@gmail.com>
> Cc: Michael Jamet <michael.jamet@intel.com>
> Cc: Felipe Balbi <balbi@kernel.org>
> Cc: David Kershner <david.kershner@unisys.com>
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
> ---
> arch/powerpc/platforms/pseries/ibmebus.c | 4 ++--
> drivers/acpi/acpi_lpss.c | 4 ++--
> drivers/acpi/sleep.c | 2 +-
> drivers/acpi/utils.c | 4 ++--
> drivers/base/bus.c | 2 +-
> drivers/base/core.c | 10 +++++-----
> drivers/base/platform.c | 2 +-
> drivers/char/ipmi/ipmi_si_platform.c | 2 +-
> drivers/firmware/efi/dev-path-parser.c | 4 ++--
> drivers/hwtracing/coresight/coresight.c | 6 +++---
> drivers/i2c/i2c-core-acpi.c | 2 +-
> drivers/i2c/i2c-core-of.c | 2 +-
> drivers/iio/inkern.c | 2 +-
> drivers/net/ethernet/ti/cpsw-phy-sel.c | 4 ++--
> drivers/net/ethernet/ti/davinci_emac.c | 2 +-
> drivers/net/ethernet/toshiba/tc35815.c | 4 ++--
> drivers/pci/probe.c | 2 +-
> drivers/pci/search.c | 4 ++--
> drivers/s390/cio/css.c | 4 ++--
> drivers/s390/cio/device.c | 4 ++--
> drivers/s390/crypto/ap_bus.c | 4 ++--
> drivers/scsi/scsi_proc.c | 2 +-
> drivers/thunderbolt/switch.c | 4 ++--
> drivers/usb/core/usb.c | 4 ++--
> drivers/usb/phy/phy-am335x-control.c | 4 ++--
> drivers/usb/phy/phy-isp1301.c | 4 ++--
> drivers/visorbus/visorbus_main.c | 4 ++--
> include/linux/device.h | 13 ++++++-------
> 28 files changed, 54 insertions(+), 55 deletions(-)
>
...

> diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c
> index b9fc502..e440682 100644
> --- a/drivers/s390/crypto/ap_bus.c
> +++ b/drivers/s390/crypto/ap_bus.c
> @@ -1365,7 +1365,7 @@ static int __match_card_device_with_id(struct device *dev, 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;
fine with me, Thanks
acked-by: Harald Freudenberger <freude@linux.ibm.com>