Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1174744 > unrolled thread

Re: [PATCH v1 09/10] device: property: add fwnode_driver_match_device()

Started byGrant Likely <grant.likely@secretlab.ca>
First post2015-06-30 22:30 +0200
Last post2015-06-30 22:30 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH v1 09/10] device: property: add  fwnode_driver_match_device() Grant Likely <grant.likely@secretlab.ca> - 2015-06-30 22:30 +0200

#1174744 — Re: [PATCH v1 09/10] device: property: add fwnode_driver_match_device()

FromGrant Likely <grant.likely@secretlab.ca>
Date2015-06-30 22:30 +0200
SubjectRe: [PATCH v1 09/10] device: property: add fwnode_driver_match_device()
Message-ID<pHakj-4aX-31@gated-at.bofh.it>
On Tue, 30 Jun 2015 16:55:07 +0200
, Tomeu Vizoso <tomeu.vizoso@collabora.com>
 wrote:
> So buses can match drivers to devices without having to care about what
> firmware is used to describe the device.
> 
> The introduction of this function will also allow us to introduce
> matching behavior common to the different type of firmwares.
> 
> Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>

The code looks fine... but the series only has one user! You should
update both SPI and I2C for the next version to show how this does
consolidate matching behaviour.

g.

> ---
> 
>  drivers/base/property.c  | 18 ++++++++++++++++++
>  include/linux/property.h |  4 ++++
>  2 files changed, 22 insertions(+)
> 
> diff --git a/drivers/base/property.c b/drivers/base/property.c
> index 9c8be31..8528eb9 100644
> --- a/drivers/base/property.c
> +++ b/drivers/base/property.c
> @@ -15,6 +15,7 @@
>  #include <linux/kernel.h>
>  #include <linux/of.h>
>  #include <linux/of_address.h>
> +#include <linux/of_device.h>
>  #include <linux/property.h>
>  
>  /**
> @@ -594,3 +595,20 @@ bool fwnode_is_compatible(struct fwnode_handle *fwnode, const char *compatible)
>  	return false;
>  }
>  EXPORT_SYMBOL_GPL(fwnode_is_compatible);
> +
> +/**
> + * fwnode_driver_match_device - Tell if a driver matches a device.
> + * @drv: the device_driver structure to test
> + * @dev: the device structure to match against
> + */
> +bool fwnode_driver_match_device(struct device *dev,
> +				const struct device_driver *drv)
> +{
> +	if (is_of_node(dev->fwnode))
> +		return of_driver_match_device(dev, drv);
> +	else if (is_acpi_node(dev->fwnode))
> +		return acpi_driver_match_device(dev, drv);
> +
> +	return false;
> +}
> +EXPORT_SYMBOL_GPL(fwnode_driver_match_device);
> diff --git a/include/linux/property.h b/include/linux/property.h
> index bf10074..4e453c4 100644
> --- a/include/linux/property.h
> +++ b/include/linux/property.h
> @@ -17,6 +17,7 @@
>  #include <linux/types.h>
>  
>  struct device;
> +struct device_driver;
>  
>  enum dev_prop_type {
>  	DEV_PROP_U8,
> @@ -82,6 +83,9 @@ void fwnode_handle_put(struct fwnode_handle *fwnode);
>  
>  bool fwnode_is_compatible(struct fwnode_handle *fwnode, const char *compatible);
>  
> +bool fwnode_driver_match_device(struct device *dev,
> +				const struct device_driver *drv);
> +
>  unsigned int device_get_child_node_count(struct device *dev);
>  
>  static inline bool device_property_read_bool(struct device *dev,
> -- 
> 2.4.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web