diff mbox

[v2,6/8] i2c: mux: inform the i2c mux core about how it is used

Message ID 1471268431-5148-7-git-send-email-peda@axentia.se
State Accepted
Headers show

Commit Message

Peter Rosin Aug. 15, 2016, 1:40 p.m. UTC
The i2c mux core can then take appropriate action depending on if it is
used for an actual i2c mux, for a gate or for an arbitrator (the last
is the case for these drivers). This adds support for the new clearer
and more compact devicetree bindings that was added recently.

Signed-off-by: Peter Rosin <peda@axentia.se>
---
 drivers/i2c/muxes/i2c-arb-gpio-challenge.c | 2 +-
 drivers/i2c/muxes/i2c-mux-pca9541.c        | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

Comments

Wolfram Sang Aug. 25, 2016, 4:19 p.m. UTC | #1
> diff --git a/drivers/i2c/muxes/i2c-mux-pca9541.c b/drivers/i2c/muxes/i2c-mux-pca9541.c
> index 3cb8af635db5..f052c3067791 100644
> --- a/drivers/i2c/muxes/i2c-mux-pca9541.c
> +++ b/drivers/i2c/muxes/i2c-mux-pca9541.c
> @@ -349,7 +349,8 @@ static int pca9541_probe(struct i2c_client *client,
>  	force = 0;
>  	if (pdata)
>  		force = pdata->modes[0].adap_id;
> -	muxc = i2c_mux_alloc(adap, &client->dev, 1, sizeof(*data), 0,
> +	muxc = i2c_mux_alloc(adap, &client->dev, 1, sizeof(*data),
> +			     I2C_MUX_ARBITRATOR,

Does it make sense to rename the file to i2c-arb-* somewhen then? Just
asking, I'll apply the patch anyhow.
Peter Rosin Aug. 25, 2016, 4:22 p.m. UTC | #2
On 2016-08-25 18:19, Wolfram Sang wrote:
> 
>> diff --git a/drivers/i2c/muxes/i2c-mux-pca9541.c b/drivers/i2c/muxes/i2c-mux-pca9541.c
>> index 3cb8af635db5..f052c3067791 100644
>> --- a/drivers/i2c/muxes/i2c-mux-pca9541.c
>> +++ b/drivers/i2c/muxes/i2c-mux-pca9541.c
>> @@ -349,7 +349,8 @@ static int pca9541_probe(struct i2c_client *client,
>>  	force = 0;
>>  	if (pdata)
>>  		force = pdata->modes[0].adap_id;
>> -	muxc = i2c_mux_alloc(adap, &client->dev, 1, sizeof(*data), 0,
>> +	muxc = i2c_mux_alloc(adap, &client->dev, 1, sizeof(*data),
>> +			     I2C_MUX_ARBITRATOR,
> 
> Does it make sense to rename the file to i2c-arb-* somewhen then? Just
> asking, I'll apply the patch anyhow.

There should be a clean branch with /only/ this series that both i2c and
iio can share, to prevent merge problems. I said I'd make such a branch
in the i2c-mux repo, but you are of course also welcome to provide that
branch if you prefer...

Cheers,
Peter
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Wolfram Sang Aug. 25, 2016, 4:24 p.m. UTC | #3
On Thu, Aug 25, 2016 at 06:22:37PM +0200, Peter Rosin wrote:
> On 2016-08-25 18:19, Wolfram Sang wrote:
> > 
> >> diff --git a/drivers/i2c/muxes/i2c-mux-pca9541.c b/drivers/i2c/muxes/i2c-mux-pca9541.c
> >> index 3cb8af635db5..f052c3067791 100644
> >> --- a/drivers/i2c/muxes/i2c-mux-pca9541.c
> >> +++ b/drivers/i2c/muxes/i2c-mux-pca9541.c
> >> @@ -349,7 +349,8 @@ static int pca9541_probe(struct i2c_client *client,
> >>  	force = 0;
> >>  	if (pdata)
> >>  		force = pdata->modes[0].adap_id;
> >> -	muxc = i2c_mux_alloc(adap, &client->dev, 1, sizeof(*data), 0,
> >> +	muxc = i2c_mux_alloc(adap, &client->dev, 1, sizeof(*data),
> >> +			     I2C_MUX_ARBITRATOR,
> > 
> > Does it make sense to rename the file to i2c-arb-* somewhen then? Just
> > asking, I'll apply the patch anyhow.
> 
> There should be a clean branch with /only/ this series that both i2c and
> iio can share, to prevent merge problems. I said I'd make such a branch
> in the i2c-mux repo, but you are of course also welcome to provide that
> branch if you prefer...

No, this is fine. Send me a pull request and I'll merge.
Peter Rosin Aug. 25, 2016, 4:28 p.m. UTC | #4
On 2016-08-25 18:24, Wolfram Sang wrote:
> On Thu, Aug 25, 2016 at 06:22:37PM +0200, Peter Rosin wrote:
>> On 2016-08-25 18:19, Wolfram Sang wrote:
>>>
>>>> diff --git a/drivers/i2c/muxes/i2c-mux-pca9541.c b/drivers/i2c/muxes/i2c-mux-pca9541.c
>>>> index 3cb8af635db5..f052c3067791 100644
>>>> --- a/drivers/i2c/muxes/i2c-mux-pca9541.c
>>>> +++ b/drivers/i2c/muxes/i2c-mux-pca9541.c
>>>> @@ -349,7 +349,8 @@ static int pca9541_probe(struct i2c_client *client,
>>>>  	force = 0;
>>>>  	if (pdata)
>>>>  		force = pdata->modes[0].adap_id;
>>>> -	muxc = i2c_mux_alloc(adap, &client->dev, 1, sizeof(*data), 0,
>>>> +	muxc = i2c_mux_alloc(adap, &client->dev, 1, sizeof(*data),
>>>> +			     I2C_MUX_ARBITRATOR,
>>>
>>> Does it make sense to rename the file to i2c-arb-* somewhen then? Just
>>> asking, I'll apply the patch anyhow.
>>
>> There should be a clean branch with /only/ this series that both i2c and
>> iio can share, to prevent merge problems. I said I'd make such a branch
>> in the i2c-mux repo, but you are of course also welcome to provide that
>> branch if you prefer...
> 
> No, this is fine. Send me a pull request and I'll merge.

Right, I was waiting for some confirmation if v4.8-rc3 was a good base,
but I'm running out of patience...

Anyway, I'll send the pull request no later that tomorrow morning (CEST).

I assume I can add your ack?

Cheers,
Peter
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Wolfram Sang Aug. 25, 2016, 4:38 p.m. UTC | #5
> Right, I was waiting for some confirmation if v4.8-rc3 was a good base,
> but I'm running out of patience...

For me, it is perfect.

> Anyway, I'll send the pull request no later that tomorrow morning (CEST).

Thanks!

> I assume I can add your ack?

Rather this:

Reviewed-by: Wolfram Sang <wsa@the-dreams.de>
diff mbox

Patch

diff --git a/drivers/i2c/muxes/i2c-arb-gpio-challenge.c b/drivers/i2c/muxes/i2c-arb-gpio-challenge.c
index a90bbc4037dd..86fc2d4c081b 100644
--- a/drivers/i2c/muxes/i2c-arb-gpio-challenge.c
+++ b/drivers/i2c/muxes/i2c-arb-gpio-challenge.c
@@ -130,7 +130,7 @@  static int i2c_arbitrator_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
-	muxc = i2c_mux_alloc(NULL, dev, 1, sizeof(*arb), 0,
+	muxc = i2c_mux_alloc(NULL, dev, 1, sizeof(*arb), I2C_MUX_ARBITRATOR,
 			     i2c_arbitrator_select, i2c_arbitrator_deselect);
 	if (!muxc)
 		return -ENOMEM;
diff --git a/drivers/i2c/muxes/i2c-mux-pca9541.c b/drivers/i2c/muxes/i2c-mux-pca9541.c
index 3cb8af635db5..f052c3067791 100644
--- a/drivers/i2c/muxes/i2c-mux-pca9541.c
+++ b/drivers/i2c/muxes/i2c-mux-pca9541.c
@@ -349,7 +349,8 @@  static int pca9541_probe(struct i2c_client *client,
 	force = 0;
 	if (pdata)
 		force = pdata->modes[0].adap_id;
-	muxc = i2c_mux_alloc(adap, &client->dev, 1, sizeof(*data), 0,
+	muxc = i2c_mux_alloc(adap, &client->dev, 1, sizeof(*data),
+			     I2C_MUX_ARBITRATOR,
 			     pca9541_select_chan, pca9541_release_chan);
 	if (!muxc)
 		return -ENOMEM;