We have helper routines to lookup devices matching a criteria defined by a "match" helper for bus/class/driver. Often the search is based on a generic property of a device, such as of_node, fwnode, device type or device name. In the absense of a common set of match functions, we have drivers writing their own match functions, spilled all over the driver subsystems. This series is an attempt to consolidate the and cleanup the device match functions by providing generic match helpers by device properties listed above. In this attempt, we unify the prototype for the match functions for {bus/driver}_find_device() with that of the class_find_device() and thus further reducing the duplicate functions. The series also adds wrapper functions to lookup the devices by generic attributes, so that people don't miss the generic match functions and continue to write their own. Also, there are a couple of instances where the drivers use "platform_bus_type" directly reusing the "match" function of the bus. This is cleaned by providing a new helper "platform_find_device_by_driver()" to abstract the details away from the callers. Applies on 5.2-rc3 Cc: Alan Tull <atull@xxxxxxxxxx> Cc: Alessandro Zummo <a.zummo@xxxxxxxxxxxx> Cc: Alexander Aring <alex.aring@xxxxxxxxx> Cc: Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx> Cc: Alexandre Belloni <alexandre.belloni@xxxxxxxxxxx> Cc: Andreas Noever <andreas.noever@xxxxxxxxx> Cc: Andrew Lunn <andrew@xxxxxxx> Cc: Arnd Bergmann <arnd@xxxxxxxx> Cc: Bjorn Helgaas <bhelgaas@xxxxxxxxxx> Cc: Corey Minyard <minyard@xxxxxxx> Cc: Daniel Vetter <daniel@xxxxxxxx> Cc: Dan Murphy <dmurphy@xxxxxx> Cc: David Airlie <airlied@xxxxxxxx> Cc: David Kershner <david.kershner@xxxxxxxxxx> Cc: "David S. Miller" <davem@xxxxxxxxxxxxx> Cc: Doug Ledford <dledford@xxxxxxxxxx> Cc: dri-devel@xxxxxxxxxxxxxxxxxxxxx Cc: Elie Morisse <syniurge@xxxxxxxxx> Cc: Eric Anholt <eric@xxxxxxxxxx> Cc: Felipe Balbi <balbi@xxxxxxxxxx> Cc: Florian Fainelli <f.fainelli@xxxxxxxxx> Cc: Frank Rowand <frowand.list@xxxxxxxxx> Cc: Grant Likely <grant.likely@xxxxxxx> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> Cc: Grygorii Strashko <grygorii.strashko@xxxxxx> Cc: Harald Freudenberger <freude@xxxxxxxxxxxxx> Cc: Hartmut Knaack <knaack.h@xxxxxx> Cc: Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx> Cc: Heiko Carstens <heiko.carstens@xxxxxxxxxx> Cc: "Heiko Stübner" <heiko@xxxxxxxxx> Cc: Heiko Stuebner <heiko@xxxxxxxxx> Cc: Heiner Kallweit <hkallweit1@xxxxxxxxx> Cc: Inki Dae <inki.dae@xxxxxxxxxxx> Cc: Jacek Anaszewski <jacek.anaszewski@xxxxxxxxx> Cc: "James E.J. Bottomley" <jejb@xxxxxxxxxxxxx> Cc: Jason Gunthorpe <jgg@xxxxxxxx> Cc: Jiri Slaby <jslaby@xxxxxxxx> Cc: Joe Perches <joe@xxxxxxxxxxx> Cc: Joerg Roedel <joro@xxxxxxxxxx> Cc: Jonathan Cameron <jic23@xxxxxxxxxx> Cc: Jonathan Hunter <jonathanh@xxxxxxxxxx> Cc: Lee Jones <lee.jones@xxxxxxxxxx> Cc: Len Brown <lenb@xxxxxxxxxx Cc: Liam Girdwood <lgirdwood@xxxxxxxxx> Cc: Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxxxx> Cc: Mark Brown <broonie@xxxxxxxxxx> Cc: "Martin K. Petersen" <martin.petersen@xxxxxxxxxx> Cc: Mathieu Poirier <mathieu.poirier@xxxxxxxxxx> Cc: Maxime Coquelin <mcoquelin.stm32@xxxxxxxxx> Cc: Maxime Ripard <maxime.ripard@xxxxxxxxxxx> Cc: Michael Jamet <michael.jamet@xxxxxxxxx> Cc: Mika Westerberg <mika.westerberg@xxxxxxxxxxxxxxx> Cc: Moritz Fischer <mdf@xxxxxxxxxx> Cc: Nehal Shah <nehal-bakulchandra.shah@xxxxxxx> Cc: Oliver Neukum <oneukum@xxxxxxxx> Cc: Pavel Machek <pavel@xxxxxx> Cc: Peter Oberparleiter <oberpar@xxxxxxxxxxxxx> Cc: Peter Rosin <peda@xxxxxxxxxx> Cc: "Rafael J. Wysocki" <rafael.j.wysocki@xxxxxxxxx> Cc: "Rafael J. Wysocki" <rafael@xxxxxxxxxx> Cc: Rafael J. Wysocki" <rjw@xxxxxxxxxxxxx> Cc: Rob Herring <robh+dt@xxxxxxxxxx> Cc: Robin Murphy <robin.murphy@xxxxxxx> Cc: Russell King <linux@xxxxxxxxxxxxxxx> Cc: Sandy Huang <hjc@xxxxxxxxxxxxxx> Cc: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx> Cc: Sebastian Ott <sebott@xxxxxxxxxxxxx> Cc: Seung-Woo Kim <sw0312.kim@xxxxxxxxxxx> Cc: Shyam Sundar S K <shyam-sundar.s-k@xxxxxxx> Cc: Srinivas Kandagatla <srinivas.kandagatla@xxxxxxxxxx> Cc: Stefan Schmidt <stefan@xxxxxxxxxxxxxxxxxx> Cc: Takashi Iwai <tiwai@xxxxxxxx> Cc: Thierry Reding <thierry.reding@xxxxxxxxx> Cc: Thor Thayer <thor.thayer@xxxxxxxxxxxxxxx> Cc: Tomas Winkler <tomas.winkler@xxxxxxxxx> Cc: Ulf Hansson <ulf.hansson@xxxxxxxxxx> Cc: Will Deacon <will.deacon@xxxxxxx> Cc: Wolfram Sang <wsa@xxxxxxxxxxxxx> Cc: devicetree@xxxxxxxxxxxxxxx Cc: linux-acpi@xxxxxxxxxxxxxxx Cc: linux-fpga@xxxxxxxxxxxxxxx Cc: linux-i2c@xxxxxxxxxxxxxxx Cc: linux-leds@xxxxxxxxxxxxxxx Cc: linux-rockchip@xxxxxxxxxxxxxxxxxxx Cc: linux-rtc@xxxxxxxxxxxxxxx Cc: linux-spi@xxxxxxxxxxxxxxx Cc: linux-usb@xxxxxxxxxxxxxxx Cc: linux-wpan@xxxxxxxxxxxxxxx Suzuki K Poulose (57): drivers: s390/cio: Use driver_for_each_device drivers: ipmi: Drop device reference drivers: coresight: Drop device references found via bus_find_device drivers: Add generic match helper to match the device of_node drm: mipi_dsi: Use bus_find_device_by_of_node() helper drivers: i2c: i2c-core: Use bus_find_device_by_of_node helper drivers: nvmem: Use bus_find_device_by_of_node helper drivers: spi: Use bus_find_device_by_of_node helper drivers: sound: rockchip: rk3399: Use bus_find_device_by_of_node helper drivers: coresight: Use bus_find_device_by_of_node helper of: mdio: Use bus_find_device_by_of_node helper of: platform: Use bus_find_device_by_of_node helper drivers: Add generic helper for matching device by fwnode drivers: devcon: Use bus_find_device_by_fwnode helper net: hisilicon: hnfs:Use bus_find_device_by_fwnode helper net: hns_roce: Use bus_find_device_by_fwnode helper drivers: Add generic match by device type helper drivers: intel_th: Use bus_find_device_by_devt helper drivers: usb: core: Use bus_find_device_by_devt helper platform: Add a helper to find device by driver drivers: Add generic match helper by ACPI_COMPANION device drivers: i2c: Use generic helper to match device by acpi_dev drivers: spi: Use bus_find_device_by_acpi_dev match helper drivers: staging: most-core: Use bus_find_device_by_name drivers: Add generic match by name helper drivers: acpi: Clean up acpi_dev_match_cb drivers: Unify the match prototype for bus_find_device with class_find_device drivers: class: Add variants of class_find_device() drivers: stm: Use class_find_device_by_name() helper drivers: leds: Use class_find_device_by_name() helper drivers: rtc: Use class_find_device_by_name() helper drivers: s390-crypto: Use class_device_find_by_name() helper drivers: usb: Use class_find_device_by_name() helper drivers: ieee802154: Use class_find_device_by_name() helper drivers: core: Reuse generic match by device type helper drivers: mei: Use class_find_device_by_devt match helper drivers: s390: zcrypt: Use class_find_device_by_devt helper drivers: fpga: Use generic helpers to match by of_node drivers: mux: Use class_find_device_by_of_node helper drivers: spi: Use class_find_device_by_of_node helper drivers: net: phy: Use class_find_device_by_of_node helper drivers: regulator: Use class_find_device_by_of_node helper drivers: tty : Use class_find_device_by_of_node helper drivers: usb : Use class_find_device_by_fwnode() helper drivers: driver_find_device: Unify the match function driver: Add variants of driver_find_device() drivers: mfd: Use driver_find_device_by_name helper drivers: s390: cio: Use driver_find_by_name() helper drivers: mfd: altera: Use driver_find_device_by_of_node() helper drivers: iommu: arm-smmu: Use driver_find_device_by_fwnode() helper drivers: Add generic helper to match all devices drivers: tegra: Use driver_find_device_by_of_node() helper drivers: Introduce bus_find_next_device() helper drivers: pci: Use bus_find_next_device() helper drivers: scsi: Use bus_find_next_device() helper drivers: Introduce driver_find_next_device() helper drivers: i2c-amd: Use driver_find_next_device() helper arch/powerpc/platforms/pseries/ibmebus.c | 4 +- drivers/acpi/acpi_lpss.c | 4 +- drivers/acpi/sleep.c | 2 +- drivers/acpi/utils.c | 11 +- drivers/amba/tegra-ahb.c | 11 +- drivers/base/bus.c | 26 +-- drivers/base/core.c | 45 ++++- drivers/base/devcon.c | 8 +- drivers/base/driver.c | 2 +- drivers/base/platform.c | 14 ++ drivers/char/ipmi/ipmi_msghandler.c | 8 +- drivers/char/ipmi/ipmi_si_platform.c | 3 +- drivers/firmware/efi/dev-path-parser.c | 4 +- drivers/fpga/fpga-bridge.c | 8 +- drivers/fpga/fpga-mgr.c | 8 +- drivers/fpga/of-fpga-region.c | 7 +- drivers/gpu/drm/drm_mipi_dsi.c | 7 +- drivers/gpu/drm/exynos/exynos_drm_drv.c | 9 +- drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 3 +- drivers/gpu/drm/tegra/dc.c | 4 +- drivers/gpu/drm/vc4/vc4_drv.c | 3 +- drivers/hwtracing/coresight/coresight.c | 10 +- drivers/hwtracing/coresight/of_coresight.c | 11 +- drivers/hwtracing/intel_th/core.c | 11 +- drivers/hwtracing/stm/core.c | 9 +- drivers/i2c/busses/i2c-amd-mp2-pci.c | 8 +- drivers/i2c/i2c-core-acpi.c | 10 +- drivers/i2c/i2c-core-of.c | 9 +- drivers/iio/inkern.c | 2 +- drivers/infiniband/hw/hns/hns_roce_hw_v1.c | 8 +- drivers/iommu/arm-smmu-v3.c | 9 +- drivers/iommu/arm-smmu.c | 9 +- drivers/leds/led-class.c | 9 +- drivers/mfd/altera-sysmgr.c | 14 +- drivers/mfd/syscon.c | 8 +- drivers/misc/mei/main.c | 9 +- drivers/mux/core.c | 8 +- drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c | 8 +- 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/net/phy/mdio_bus.c | 9 +- drivers/nvmem/core.c | 7 +- drivers/of/of_mdio.c | 8 +- drivers/of/platform.c | 7 +- drivers/pci/probe.c | 7 +- drivers/pci/search.c | 4 +- drivers/regulator/of_regulator.c | 7 +- drivers/rtc/interface.c | 11 +- drivers/s390/cio/ccwgroup.c | 28 +-- drivers/s390/cio/chsc_sch.c | 2 +- drivers/s390/cio/css.c | 4 +- drivers/s390/cio/device.c | 21 +-- drivers/s390/crypto/ap_bus.c | 4 +- drivers/s390/crypto/zcrypt_api.c | 23 +-- drivers/scsi/scsi_proc.c | 9 +- drivers/spi/spi.c | 28 +-- drivers/staging/most/core.c | 9 +- drivers/thunderbolt/switch.c | 4 +- drivers/tty/tty_io.c | 8 +- drivers/usb/core/devio.c | 8 +- drivers/usb/core/usb.c | 4 +- drivers/usb/phy/phy-am335x-control.c | 4 +- drivers/usb/phy/phy-isp1301.c | 4 +- drivers/usb/roles/class.c | 16 +- drivers/usb/typec/class.c | 16 +- drivers/visorbus/visorbus_main.c | 4 +- include/linux/device.h | 191 ++++++++++++++++++++- include/linux/platform_device.h | 3 + net/ieee802154/core.c | 7 +- sound/soc/rockchip/rk3399_gru_sound.c | 9 +- 71 files changed, 359 insertions(+), 460 deletions(-) -- 2.7.4 _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel