All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
To: Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>,
	Sebastian Hesselbarth
	<sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Jason Cooper <jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org>,
	Andrew Lunn <andrew-g2DYL2Zd6BY@public.gmane.org>,
	Gregory Clement
	<gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
	Gabriel Dobato <dobatog-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v3 1/4] i2c: mux-pinctrl: Rework to honor disabled child nodes
Date: Thu, 19 Mar 2015 09:47:41 -0600	[thread overview]
Message-ID: <550AEF9D.6090307@wwwdotorg.org> (raw)
In-Reply-To: <20150319100944.GA914@katana>

On 03/19/2015 04:09 AM, Wolfram Sang wrote:
>
>>>> Possible. But this change just makes i2c-mux-pinctrl honor status
>>>> property at all. There is no functional change except it now allows
>>>> you to disable any of the sub-busses.
>>>
>>> Actually, this is the feature I like. However, I wonder if we shouldn't
>>> have that in the core, say in of_i2c_register_devices()?
>>
>> Hmm, looking at of_i2c_register_devices():
>>
>> 	for_each_available_child_of_node(adap->dev.of_node, node)
>> 		of_i2c_register_device(adap, node);
>>
>> already honors status properties by using for_each_available_foo.
>> Therefore, i2c-core will also skip i2c device nodes disabled by
>> status property.
>
> Yes, but only child nodes, not the complete bus. Here is an RFC of what
> I mean:
>
> From: Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
> Subject: [RFC] i2c: of: always check if busses are enabled
>
> Allow all busses to have a "status" property which allows busses to not
> be probed when set to "disabled". Needed for DTS overlays with i2c mux
> scenarios.

> diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c

> @@ -1305,8 +1305,8 @@ static void of_i2c_register_devices(struct i2c_adapter *adap)
>   {
>   	struct device_node *node;
>
> -	/* Only register child devices if the adapter has a node pointer set */
> -	if (!adap->dev.of_node)
> +	/* Only register childs if adapter has a node pointer with enabled status */
> +	if (!adap->dev.of_node || !of_device_is_available(adap->dev.of_node))
>   		return;

That feels a bit odd to me. For a regular non-mux I2C controller, that 
extra case would never trigger if the controller node was disabled, 
since the device core would never probe the controller device itself. 
So, we'd end up with inconsistent paths through the I2C core for regular 
controllers and muxes.

Perhaps better would be to have a mux-specific function to iterate over 
a mux's child nodes and instantiate buses for those. That function would 
check whether each bus node was disabled or not. That'd isolate the 
special case into the place where it was relevant.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: swarren@wwwdotorg.org (Stephen Warren)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 1/4] i2c: mux-pinctrl: Rework to honor disabled child nodes
Date: Thu, 19 Mar 2015 09:47:41 -0600	[thread overview]
Message-ID: <550AEF9D.6090307@wwwdotorg.org> (raw)
In-Reply-To: <20150319100944.GA914@katana>

On 03/19/2015 04:09 AM, Wolfram Sang wrote:
>
>>>> Possible. But this change just makes i2c-mux-pinctrl honor status
>>>> property at all. There is no functional change except it now allows
>>>> you to disable any of the sub-busses.
>>>
>>> Actually, this is the feature I like. However, I wonder if we shouldn't
>>> have that in the core, say in of_i2c_register_devices()?
>>
>> Hmm, looking at of_i2c_register_devices():
>>
>> 	for_each_available_child_of_node(adap->dev.of_node, node)
>> 		of_i2c_register_device(adap, node);
>>
>> already honors status properties by using for_each_available_foo.
>> Therefore, i2c-core will also skip i2c device nodes disabled by
>> status property.
>
> Yes, but only child nodes, not the complete bus. Here is an RFC of what
> I mean:
>
> From: Wolfram Sang <wsa@the-dreams.de>
> Subject: [RFC] i2c: of: always check if busses are enabled
>
> Allow all busses to have a "status" property which allows busses to not
> be probed when set to "disabled". Needed for DTS overlays with i2c mux
> scenarios.

> diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c

> @@ -1305,8 +1305,8 @@ static void of_i2c_register_devices(struct i2c_adapter *adap)
>   {
>   	struct device_node *node;
>
> -	/* Only register child devices if the adapter has a node pointer set */
> -	if (!adap->dev.of_node)
> +	/* Only register childs if adapter has a node pointer with enabled status */
> +	if (!adap->dev.of_node || !of_device_is_available(adap->dev.of_node))
>   		return;

That feels a bit odd to me. For a regular non-mux I2C controller, that 
extra case would never trigger if the controller node was disabled, 
since the device core would never probe the controller device itself. 
So, we'd end up with inconsistent paths through the I2C core for regular 
controllers and muxes.

Perhaps better would be to have a mux-specific function to iterate over 
a mux's child nodes and instantiate buses for those. That function would 
check whether each bus node was disabled or not. That'd isolate the 
special case into the place where it was relevant.

WARNING: multiple messages have this Message-ID (diff)
From: Stephen Warren <swarren@wwwdotorg.org>
To: Wolfram Sang <wsa@the-dreams.de>,
	Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Cc: Jason Cooper <jason@lakedaemon.net>, Andrew Lunn <andrew@lunn.ch>,
	Gregory Clement <gregory.clement@free-electrons.com>,
	Gabriel Dobato <dobatog@gmail.com>,
	linux-i2c@vger.kernel.org, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/4] i2c: mux-pinctrl: Rework to honor disabled child nodes
Date: Thu, 19 Mar 2015 09:47:41 -0600	[thread overview]
Message-ID: <550AEF9D.6090307@wwwdotorg.org> (raw)
In-Reply-To: <20150319100944.GA914@katana>

On 03/19/2015 04:09 AM, Wolfram Sang wrote:
>
>>>> Possible. But this change just makes i2c-mux-pinctrl honor status
>>>> property at all. There is no functional change except it now allows
>>>> you to disable any of the sub-busses.
>>>
>>> Actually, this is the feature I like. However, I wonder if we shouldn't
>>> have that in the core, say in of_i2c_register_devices()?
>>
>> Hmm, looking at of_i2c_register_devices():
>>
>> 	for_each_available_child_of_node(adap->dev.of_node, node)
>> 		of_i2c_register_device(adap, node);
>>
>> already honors status properties by using for_each_available_foo.
>> Therefore, i2c-core will also skip i2c device nodes disabled by
>> status property.
>
> Yes, but only child nodes, not the complete bus. Here is an RFC of what
> I mean:
>
> From: Wolfram Sang <wsa@the-dreams.de>
> Subject: [RFC] i2c: of: always check if busses are enabled
>
> Allow all busses to have a "status" property which allows busses to not
> be probed when set to "disabled". Needed for DTS overlays with i2c mux
> scenarios.

> diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c

> @@ -1305,8 +1305,8 @@ static void of_i2c_register_devices(struct i2c_adapter *adap)
>   {
>   	struct device_node *node;
>
> -	/* Only register child devices if the adapter has a node pointer set */
> -	if (!adap->dev.of_node)
> +	/* Only register childs if adapter has a node pointer with enabled status */
> +	if (!adap->dev.of_node || !of_device_is_available(adap->dev.of_node))
>   		return;

That feels a bit odd to me. For a regular non-mux I2C controller, that 
extra case would never trigger if the controller node was disabled, 
since the device core would never probe the controller device itself. 
So, we'd end up with inconsistent paths through the I2C core for regular 
controllers and muxes.

Perhaps better would be to have a mux-specific function to iterate over 
a mux's child nodes and instantiate buses for those. That function would 
check whether each bus node was disabled or not. That'd isolate the 
special case into the place where it was relevant.

  parent reply	other threads:[~2015-03-19 15:47 UTC|newest]

Thread overview: 122+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-17 18:52 [PATCH 0/8] Add proper support for Compulab CM-A510/SBC-A510 Sebastian Hesselbarth
2015-02-17 18:52 ` Sebastian Hesselbarth
2015-02-17 18:52 ` Sebastian Hesselbarth
2015-02-17 18:52 ` [PATCH 1/8] i2c: mux-pinctrl: Rework to honor disabled child nodes Sebastian Hesselbarth
2015-02-17 18:52   ` Sebastian Hesselbarth
2015-02-17 18:52   ` Sebastian Hesselbarth
     [not found]   ` <1424199129-22099-2-git-send-email-sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-02-17 20:46     ` Stephen Warren
2015-02-17 20:46       ` Stephen Warren
2015-02-17 20:46       ` Stephen Warren
     [not found]       ` <54E3A8A7.8080703-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2015-02-17 21:08         ` Sebastian Hesselbarth
2015-02-17 21:08           ` Sebastian Hesselbarth
2015-02-17 21:08           ` Sebastian Hesselbarth
2015-02-17 21:15           ` Stephen Warren
2015-02-17 21:15             ` Stephen Warren
2015-02-17 21:19             ` Sebastian Hesselbarth
2015-02-17 21:19               ` Sebastian Hesselbarth
2015-02-26 21:46   ` Stephen Warren
2015-02-26 21:46     ` Stephen Warren
2015-02-17 18:52 ` [PATCH 2/8] devicetree: vendor-prefixes: Add CompuLab to known vendors Sebastian Hesselbarth
2015-02-17 18:52   ` Sebastian Hesselbarth
2015-02-17 19:37   ` Rob Herring
2015-02-17 19:37     ` Rob Herring
2015-02-17 18:52 ` [PATCH 3/8] ARM: dts: dove: Fix uart[23] reg property Sebastian Hesselbarth
2015-02-17 18:52   ` Sebastian Hesselbarth
2015-02-23 14:54   ` Gregory CLEMENT
2015-02-23 14:54     ` Gregory CLEMENT
2015-02-17 18:52 ` [PATCH 4/8] ARM: dts: dove: Always include gpio and interrupt-controller headers Sebastian Hesselbarth
2015-02-17 18:52   ` Sebastian Hesselbarth
2015-02-23 14:54   ` Gregory CLEMENT
2015-02-23 14:54     ` Gregory CLEMENT
2015-02-17 18:52 ` [PATCH 5/8] ARM: dts: dove: Add node labels for PCIe ports 0 and 1 Sebastian Hesselbarth
2015-02-17 18:52   ` Sebastian Hesselbarth
2015-02-23 14:55   ` Gregory CLEMENT
2015-02-23 14:55     ` Gregory CLEMENT
2015-02-17 18:52 ` [PATCH 6/8] ARM: dts: dove: Add some more common pinctrl settings Sebastian Hesselbarth
2015-02-17 18:52   ` Sebastian Hesselbarth
2015-02-23 14:56   ` Gregory CLEMENT
2015-02-23 14:56     ` Gregory CLEMENT
2015-02-17 18:52 ` [PATCH 7/8] ARM: dts: dove: Add internal i2c multiplexer node Sebastian Hesselbarth
2015-02-17 18:52   ` Sebastian Hesselbarth
     [not found]   ` <1424199129-22099-8-git-send-email-sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-02-23 15:07     ` Gregory CLEMENT
2015-02-23 15:07       ` Gregory CLEMENT
2015-02-23 15:07       ` Gregory CLEMENT
2015-02-17 18:52 ` [PATCH 8/8] ARM: dts: dove: Add proper support for Compulab CM-A510/SBC-A510 Sebastian Hesselbarth
2015-02-17 18:52   ` Sebastian Hesselbarth
     [not found] ` <1424199129-22099-1-git-send-email-sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-02-26 17:55   ` [PATCH 0/8] " Gregory CLEMENT
2015-02-26 17:55     ` Gregory CLEMENT
2015-02-26 17:55     ` Gregory CLEMENT
2015-02-26 19:39     ` Sebastian Hesselbarth
2015-02-26 19:39       ` Sebastian Hesselbarth
2015-02-26 20:01       ` Stephen Warren
2015-02-26 20:01         ` Stephen Warren
2015-02-26 20:35         ` Sebastian Hesselbarth
2015-02-26 20:35           ` Sebastian Hesselbarth
2015-02-27 12:24   ` [PATCH v2 0/4] " Sebastian Hesselbarth
2015-02-27 12:24     ` Sebastian Hesselbarth
2015-02-27 12:24     ` Sebastian Hesselbarth
     [not found]     ` <1425039885-5137-1-git-send-email-sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-02-27 12:24       ` [PATCH v2 1/4] i2c: mux-pinctrl: Rework to honor disabled child nodes Sebastian Hesselbarth
2015-02-27 12:24         ` Sebastian Hesselbarth
2015-02-27 12:24         ` Sebastian Hesselbarth
     [not found]         ` <1425039885-5137-2-git-send-email-sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-03-02 20:01           ` Stephen Warren
2015-03-02 20:01             ` Stephen Warren
2015-03-02 20:01             ` Stephen Warren
     [not found]             ` <54F4C185.9080808-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2015-03-04  9:10               ` Sebastian Hesselbarth
2015-03-04  9:10                 ` Sebastian Hesselbarth
2015-03-04  9:10                 ` Sebastian Hesselbarth
2015-03-09 12:21           ` [PATCH v3 " Sebastian Hesselbarth
2015-03-09 12:21             ` Sebastian Hesselbarth
2015-03-09 12:21             ` Sebastian Hesselbarth
     [not found]             ` <1425903665-19343-1-git-send-email-sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-03-10 16:28               ` Stephen Warren
2015-03-10 16:28                 ` Stephen Warren
2015-03-10 16:28                 ` Stephen Warren
     [not found]                 ` <54FF1BAA.3060409-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2015-03-16 20:15                   ` Sebastian Hesselbarth
2015-03-16 20:15                     ` Sebastian Hesselbarth
2015-03-16 20:15                     ` Sebastian Hesselbarth
2015-03-18 12:30             ` Wolfram Sang
2015-03-18 12:30               ` Wolfram Sang
2015-03-18 13:23               ` Sebastian Hesselbarth
2015-03-18 13:23                 ` Sebastian Hesselbarth
2015-03-18 13:23                 ` Sebastian Hesselbarth
2015-03-18 14:00                 ` Wolfram Sang
2015-03-18 14:00                   ` Wolfram Sang
2015-03-18 23:10                   ` Sebastian Hesselbarth
2015-03-18 23:10                     ` Sebastian Hesselbarth
     [not found]                     ` <550A05E5.3050100-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-03-19 10:09                       ` Wolfram Sang
2015-03-19 10:09                         ` Wolfram Sang
2015-03-19 10:09                         ` Wolfram Sang
2015-03-19 10:48                         ` Wolfram Sang
2015-03-19 10:48                           ` Wolfram Sang
2015-03-19 10:48                           ` Wolfram Sang
2015-03-19 15:47                         ` Stephen Warren [this message]
2015-03-19 15:47                           ` Stephen Warren
2015-03-19 15:47                           ` Stephen Warren
     [not found]                           ` <550AEF9D.6090307-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2015-03-19 16:02                             ` Wolfram Sang
2015-03-19 16:02                               ` Wolfram Sang
2015-03-19 16:02                               ` Wolfram Sang
2015-03-19 16:49                               ` Stephen Warren
2015-03-19 16:49                                 ` Stephen Warren
2015-03-19 20:52                               ` Sebastian Hesselbarth
2015-03-19 20:52                                 ` Sebastian Hesselbarth
2015-03-20 10:19                                 ` Wolfram Sang
2015-03-20 10:19                                   ` Wolfram Sang
2015-03-21 21:00                                   ` Wolfram Sang
2015-03-21 21:00                                     ` Wolfram Sang
2015-03-21 21:00                                     ` Wolfram Sang
2015-03-22 13:03                                     ` Sebastian Hesselbarth
2015-03-22 13:03                                       ` Sebastian Hesselbarth
2015-03-22 13:03                                       ` Sebastian Hesselbarth
     [not found]                                       ` <550EBDBC.9000903-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-03-23 18:32                                         ` Wolfram Sang
2015-03-23 18:32                                           ` Wolfram Sang
2015-03-23 18:32                                           ` Wolfram Sang
2015-03-27 21:08                                           ` Sebastian Hesselbarth
2015-03-27 21:08                                             ` Sebastian Hesselbarth
     [not found]                                             ` <5515C6B6.7080903-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-04-03 18:17                                               ` Wolfram Sang
2015-04-03 18:17                                                 ` Wolfram Sang
2015-04-03 18:17                                                 ` Wolfram Sang
2015-02-27 12:24     ` [PATCH v2 2/4] devicetree: vendor-prefixes: Add CompuLab to known vendors Sebastian Hesselbarth
2015-02-27 12:24       ` Sebastian Hesselbarth
2015-02-27 12:24     ` [PATCH v2 3/4] ARM: dts: dove: Add internal i2c multiplexer node Sebastian Hesselbarth
2015-02-27 12:24       ` Sebastian Hesselbarth
2015-02-27 12:24     ` [PATCH v2 4/4] ARM: dts: dove: Add proper support for Compulab CM-A510/SBC-A510 Sebastian Hesselbarth
2015-02-27 12:24       ` Sebastian Hesselbarth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=550AEF9D.6090307@wwwdotorg.org \
    --to=swarren-3lzwwm7+weoh9zmkesr00q@public.gmane.org \
    --cc=andrew-g2DYL2Zd6BY@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=dobatog-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
    --cc=jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.