devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/7] drivers: Add generic device lookup helpers
@ 2019-07-23 22:18 Suzuki K Poulose
  2019-07-23 22:18 ` [PATCH v3 2/7] drivers: Introduce device lookup variants by of_node Suzuki K Poulose
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Suzuki K Poulose @ 2019-07-23 22:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: gregkh, rafael, linux-arm-kernel, Suzuki K Poulose, Alan Tull,
	Alessandro Zummo, Alexander Aring, Alexander Shishkin,
	Alexandre Belloni, Andrew Lunn, Arnd Bergmann, Bjorn Helgaas,
	Daniel Vetter, Dan Murphy, David Airlie, David S. Miller,
	devicetree, Doug Ledford, dri-devel, Elie Morisse, Eric Anholt,
	Florian Fainelli, Frank Rowand, Harald Freudenberger,
	Heikki Krogerus, Heiko Carstens, Heiko Stübner,
	Heiner Kallweit, Inki Dae, Jacek Anaszewski,
	James E.J. Bottomley, Jason Gunthorpe, Jiri Slaby, Joe Perches,
	Joerg Roedel, Lee Jones, Len Brown, Liam Girdwood, linux-acpi,
	linux-fpga, linux-i2c, linux-leds, linux-rockchip, linux-rtc,
	linux-spi, linux-usb, linux-wpan, Maarten Lankhorst, Mark Brown,
	Martin K. Petersen, Mathieu Poirier, Maxime Coquelin,
	Maxime Ripard, Mika Westerberg, Moritz Fischer, Nehal Shah,
	Oliver Neukum, Pavel Machek, Peter Oberparleiter, Peter Rosin,
	Rafael J. Wysocki, Rob Herring, Robin Murphy, Sandy Huang,
	Sebastian Andrzej Siewior, Seung-Woo Kim, Shyam Sundar S K,
	Srinivas Kandagatla, Stefan Schmidt, Takashi Iwai, Thor Thayer,
	Tomas Winkler, Ulf Hansson, Will Deacon, Wolfram Sang

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@arm.com
V1 [2] https://marc.info/?i=1559747630-28065-1-git-send-email-suzuki.poulose@arm.com
V2 [3] https://marc.info/?i=1560534863-15115-1-git-send-email-suzuki.poulose@arm.com

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@kernel.org>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Alexander Aring <alex.aring@gmail.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Dan Murphy <dmurphy@ti.com>
Cc: David Airlie <airlied@linux.ie>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: devicetree@vger.kernel.org
Cc: Doug Ledford <dledford@redhat.com>
Cc: dri-devel@lists.freedesktop.org
Cc: Elie Morisse <syniurge@gmail.com>
Cc: Eric Anholt <eric@anholt.net>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Frank Rowand <frowand.list@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Harald Freudenberger <freude@linux.ibm.com>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: "Heiko Stübner" <heiko@sntech.de>
Cc: Heiko Stuebner <heiko@sntech.de>
Cc: Heiner Kallweit <hkallweit1@gmail.com>
Cc: Inki Dae <inki.dae@samsung.com>
Cc: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Jiri Slaby <jslaby@suse.com>
Cc: Joe Perches <joe@perches.com>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Len Brown <lenb@kernel.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: linux-acpi@vger.kernel.org
Cc: linux-fpga@vger.kernel.org
Cc: linux-i2c@vger.kernel.org
Cc: linux-leds@vger.kernel.org
Cc: linux-rockchip@lists.infradead.org
Cc: linux-rtc@vger.kernel.org
Cc: linux-spi@vger.kernel.org
Cc: linux-usb@vger.kernel.org
Cc: linux-wpan@vger.kernel.org
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: Maxime Ripard <maxime.ripard@bootlin.com>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: Moritz Fischer <mdf@kernel.org>
Cc: Nehal Shah <nehal-bakulchandra.shah@amd.com>
Cc: Oliver Neukum <oneukum@suse.com>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Peter Oberparleiter <oberpar@linux.ibm.com>
Cc: Peter Rosin <peda@axentia.se>
Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Robin Murphy <robin.murphy@arm.com>
Cc: Sandy Huang <hjc@rock-chips.com>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Seung-Woo Kim <sw0312.kim@samsung.com>
Cc: Shyam Sundar S K <shyam-sundar.s-k@amd.com>
Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Cc: Stefan Schmidt <stefan@datenfreihafen.org>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: Thor Thayer <thor.thayer@linux.intel.com>
Cc: Tomas Winkler <tomas.winkler@intel.com>
Cc: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Wolfram Sang <wsa@the-dreams.de>

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-07-30 11:56 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-23 22:18 [PATCH v3 0/7] drivers: Add generic device lookup helpers Suzuki K Poulose
2019-07-23 22:18 ` [PATCH v3 2/7] drivers: Introduce device lookup variants by of_node Suzuki K Poulose
2019-07-25 13:54   ` Lee Jones
2019-07-30 11:03     ` Greg KH
2019-07-25 19:25   ` Wolfram Sang
2019-07-25 21:01   ` Moritz Fischer
2019-07-26 17:18   ` Mark Brown
2019-07-25 14:10 ` [PATCH v3 0/7] drivers: Add generic device lookup helpers Greg KH
2019-07-30 11:56 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).