devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] of/i2c: call i2c_verify_client from of_find_i2c_device_by_node
@ 2012-04-17 18:42 Stephen Warren
       [not found] ` <1334688135-8355-1-git-send-email-swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Warren @ 2012-04-17 18:42 UTC (permalink / raw)
  To: Grant Likely, Rob Herring, Ben Dooks, Wolfram Sang
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA, Stephen Warren

From: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>

i2c_bus_type may contain both I2C clients and I2C adapters. Fix
of_find_i2c_device_by_node to call i2c_verify_client to ensure that it
only returns non-NULL of I2C clients.

Signed-off-by: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
Note: This is a dependency for the pinctrl I2C bus mux I will send in a
minute. It'd probably be easiest to merge this through the I2C tree.
It might also be useful to put this patch (and the others I'll send) in
a separate tree so it can be merged into any SoC trees that wish to use
this new feature.

 drivers/of/of_i2c.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/of/of_i2c.c b/drivers/of/of_i2c.c
index f37fbeb..0684887 100644
--- a/drivers/of/of_i2c.c
+++ b/drivers/of/of_i2c.c
@@ -90,7 +90,7 @@ struct i2c_client *of_find_i2c_device_by_node(struct device_node *node)
 	if (!dev)
 		return NULL;
 
-	return to_i2c_client(dev);
+	return i2c_verify_client(dev);
 }
 EXPORT_SYMBOL(of_find_i2c_device_by_node);
 
-- 
1.7.0.4

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

* Re: [PATCH] of/i2c: call i2c_verify_client from of_find_i2c_device_by_node
       [not found] ` <1334688135-8355-1-git-send-email-swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
@ 2012-04-23 11:04   ` Wolfram Sang
  2012-04-23 13:00   ` Rob Herring
  1 sibling, 0 replies; 3+ messages in thread
From: Wolfram Sang @ 2012-04-23 11:04 UTC (permalink / raw)
  To: Stephen Warren
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Rob Herring,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA, Ben Dooks


[-- Attachment #1.1: Type: text/plain, Size: 730 bytes --]

On Tue, Apr 17, 2012 at 12:42:15PM -0600, Stephen Warren wrote:
> From: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> 
> i2c_bus_type may contain both I2C clients and I2C adapters. Fix
> of_find_i2c_device_by_node to call i2c_verify_client to ensure that it
> only returns non-NULL of I2C clients.
> 
> Signed-off-by: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>

Patch looks good to me, so I took the liberty and applied it to
i2c-embedded/for-next. Acks by either Grant or Rob would still be
appreciated.

Thanks!

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

[-- Attachment #2: Type: text/plain, Size: 192 bytes --]

_______________________________________________
devicetree-discuss mailing list
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
https://lists.ozlabs.org/listinfo/devicetree-discuss

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

* Re: [PATCH] of/i2c: call i2c_verify_client from of_find_i2c_device_by_node
       [not found] ` <1334688135-8355-1-git-send-email-swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
  2012-04-23 11:04   ` Wolfram Sang
@ 2012-04-23 13:00   ` Rob Herring
  1 sibling, 0 replies; 3+ messages in thread
From: Rob Herring @ 2012-04-23 13:00 UTC (permalink / raw)
  To: Stephen Warren
  Cc: Grant Likely, Ben Dooks, Wolfram Sang,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA

On 04/17/2012 01:42 PM, Stephen Warren wrote:
> From: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> 
> i2c_bus_type may contain both I2C clients and I2C adapters. Fix
> of_find_i2c_device_by_node to call i2c_verify_client to ensure that it
> only returns non-NULL of I2C clients.
> 
> Signed-off-by: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>

Acked-by: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>


> ---
> Note: This is a dependency for the pinctrl I2C bus mux I will send in a
> minute. It'd probably be easiest to merge this through the I2C tree.
> It might also be useful to put this patch (and the others I'll send) in
> a separate tree so it can be merged into any SoC trees that wish to use
> this new feature.
> 
>  drivers/of/of_i2c.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/of/of_i2c.c b/drivers/of/of_i2c.c
> index f37fbeb..0684887 100644
> --- a/drivers/of/of_i2c.c
> +++ b/drivers/of/of_i2c.c
> @@ -90,7 +90,7 @@ struct i2c_client *of_find_i2c_device_by_node(struct device_node *node)
>  	if (!dev)
>  		return NULL;
>  
> -	return to_i2c_client(dev);
> +	return i2c_verify_client(dev);
>  }
>  EXPORT_SYMBOL(of_find_i2c_device_by_node);
>  

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

end of thread, other threads:[~2012-04-23 13:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-17 18:42 [PATCH] of/i2c: call i2c_verify_client from of_find_i2c_device_by_node Stephen Warren
     [not found] ` <1334688135-8355-1-git-send-email-swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-04-23 11:04   ` Wolfram Sang
2012-04-23 13:00   ` Rob Herring

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).