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

From: Harald Freudenberger
Date: Tue Jun 04 2019 - 02:56:49 EST


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@xxxxxxxxxxxxxxx>
> Cc: Wolfram Sang <wsa@xxxxxxxxxxxxx>
> Cc: Jonathan Cameron <jic23@xxxxxxxxxx>
> Cc: Hartmut Knaack <knaack.h@xxxxxx>
> Cc: Grygorii Strashko <grygorii.strashko@xxxxxx>
> Cc: "David S. Miller" <davem@xxxxxxxxxxxxx>
> Cc: Bjorn Helgaas <bhelgaas@xxxxxxxxxx>
> Cc: Sebastian Ott <sebott@xxxxxxxxxxxxx>
> Cc: Peter Oberparleiter <oberpar@xxxxxxxxxxxxx>
> Cc: Harald Freudenberger <freude@xxxxxxxxxxxxx>
> Cc: "James E.J. Bottomley" <jejb@xxxxxxxxxxxxx>
> Cc: "Martin K. Petersen" <martin.petersen@xxxxxxxxxx>
> Cc: Andreas Noever <andreas.noever@xxxxxxxxx>
> Cc: Michael Jamet <michael.jamet@xxxxxxxxx>
> Cc: Felipe Balbi <balbi@xxxxxxxxxx>
> Cc: David Kershner <david.kershner@xxxxxxxxxx>
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@xxxxxxx>
> ---
> 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@xxxxxxxxxxxxx>