[PATCH v3 0/7] drivers: Add generic device lookup helpers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We have device iterators to find a particular device matching a criteria
for a given bus/class/driver. i.e, {bus,class,driver}_find_device()
APIs. The matching criteria is a function pointer for the APIs. Often the
lookup is based on a generic property of a device (e.g, name, fwnode, of node
pointer or device type) rather than a driver specific information. However, each
driver writes up its own "match" function, spilling the similar match functions
all over the driver subsystems.

This series adds device match helpers by generic device properties of a device.
Using these generic match functions, introduce wrappers to the existing
 *_find_device() helpers and converts the existing users to use the new wrappers.
 i.e,
	{bus/class/driver}_find_device_by_name()
	{bus/class/driver}_find_device_by_fwnode()
	{bus/class/driver}_find_device_by_devt()
	{bus/class/driver}_find_device_by_acpi_dev()

Also adds a wrapper for finding a platform device by driver, to avoid
spilling the platform_bus internals in the individual drivers. Applies
on 5.3-rc1.

   [0] git://linux-arm.org/linux-skp.git driver-cleanup/v3
RFC[1] https://marc.info/?i=1559577023-558-1-git-send-email-suzuki.poulose@xxxxxxx
V1 [2] https://marc.info/?i=1559747630-28065-1-git-send-email-suzuki.poulose@xxxxxxx
V2 [3] https://marc.info/?i=1560534863-15115-1-git-send-email-suzuki.poulose@xxxxxxx

Changes since v2:
 - Merge the device match helper introduction patch with the variants
   of the helpers, for better review.
 - Use platform_find_device_by_driver for mcde drm driver.

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: Andrew Lunn <andrew@xxxxxxx>
Cc: Arnd Bergmann <arnd@xxxxxxxx>
Cc: Bjorn Helgaas <bhelgaas@xxxxxxxxxx>
Cc: Daniel Vetter <daniel@xxxxxxxx>
Cc: Dan Murphy <dmurphy@xxxxxx>
Cc: David Airlie <airlied@xxxxxxxx>
Cc: "David S. Miller" <davem@xxxxxxxxxxxxx>
Cc: devicetree@xxxxxxxxxxxxxxx
Cc: Doug Ledford <dledford@xxxxxxxxxx>
Cc: dri-devel@xxxxxxxxxxxxxxxxxxxxx
Cc: Elie Morisse <syniurge@xxxxxxxxx>
Cc: Eric Anholt <eric@xxxxxxxxxx>
Cc: Florian Fainelli <f.fainelli@xxxxxxxxx>
Cc: Frank Rowand <frowand.list@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
Cc: Harald Freudenberger <freude@xxxxxxxxxxxxx>
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: Lee Jones <lee.jones@xxxxxxxxxx>
Cc: Len Brown <lenb@xxxxxxxxxx>
Cc: Liam Girdwood <lgirdwood@xxxxxxxxx>
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
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: 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: Rob Herring <robh+dt@xxxxxxxxxx>
Cc: Robin Murphy <robin.murphy@xxxxxxx>
Cc: Sandy Huang <hjc@xxxxxxxxxxxxxx>
Cc: Sebastian Andrzej Siewior <bigeasy@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: 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>

Suzuki K Poulose (7):
  drivers: Introduce device lookup variants by name
  drivers: Introduce device lookup variants by of_node
  drivers: Introduce device lookup variants by fwnode
  drivers: Introduce device lookup variants by device type
  drivers: Introduce device lookup variants by ACPI_COMPANION device
  drivers: Add generic helper to match any device
  platform: Add platform_find_device_by_driver() helper

 drivers/amba/tegra-ahb.c                      |  11 +-
 drivers/base/bus.c                            |  24 --
 drivers/base/core.c                           |  39 ++-
 drivers/base/devcon.c                         |   8 +-
 drivers/base/platform.c                       |  14 ++
 drivers/fpga/fpga-bridge.c                    |   8 +-
 drivers/fpga/fpga-mgr.c                       |   8 +-
 drivers/gpu/drm/drm_mipi_dsi.c                |   7 +-
 drivers/gpu/drm/exynos/exynos_drm_drv.c       |   9 +-
 drivers/gpu/drm/mcde/mcde_drv.c               |   3 +-
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c   |   3 +-
 drivers/gpu/drm/vc4/vc4_drv.c                 |   3 +-
 .../hwtracing/coresight/coresight-platform.c  |  11 +-
 drivers/hwtracing/coresight/coresight-priv.h  |   2 -
 drivers/hwtracing/coresight/coresight.c       |   4 +-
 drivers/hwtracing/intel_th/core.c             |  10 +-
 drivers/hwtracing/stm/core.c                  |   9 +-
 drivers/i2c/busses/i2c-amd-mp2-pci.c          |   8 +-
 drivers/i2c/i2c-core-acpi.c                   |  11 +-
 drivers/i2c/i2c-core-of.c                     |   7 +-
 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/misc/mei/main.c                       |   9 +-
 drivers/mux/core.c                            |   7 +-
 .../ethernet/hisilicon/hns/hns_dsaf_misc.c    |   8 +-
 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/regulator/of_regulator.c              |   7 +-
 drivers/rtc/interface.c                       |  11 +-
 drivers/s390/cio/ccwgroup.c                   |  18 +-
 drivers/s390/cio/device.c                     |  15 +-
 drivers/s390/crypto/zcrypt_api.c              |  22 +-
 drivers/scsi/scsi_proc.c                      |   9 +-
 drivers/spi/spi.c                             |  28 +--
 drivers/tty/tty_io.c                          |   8 +-
 drivers/usb/core/devio.c                      |   8 +-
 drivers/usb/roles/class.c                     |  16 +-
 drivers/usb/typec/class.c                     |  16 +-
 include/linux/device.h                        | 237 +++++++++++++++++-
 include/linux/platform_device.h               |   3 +
 net/ieee802154/core.c                         |   7 +-
 sound/soc/rockchip/rk3399_gru_sound.c         |   9 +-
 48 files changed, 341 insertions(+), 383 deletions(-)

-- 
2.21.0

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux