Re: [RFC] i2c: mux: add mux device to the adapter name

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Nov 03, 2014 at 10:00:56PM +0100, Wolfram Sang wrote:
> If there are multiple muxes on one bus, then specifying the channel only
> is not sufficient for a distinguishable name. We need the actual device,
> too.
> 
> Signed-off-by: Wolfram Sang <wsa@xxxxxxxxxxxxx>
> Cc: Jean Delvare <jdelvare@xxxxxxx>
> Cc: Guenter Roeck <linux@xxxxxxxxxxxx>
> Cc: Martin Belanger <martin.belanger@xxxxxxxxxxx>
> Cc: Rodolfo Giometti <giometti@xxxxxxxxxxxx>
> Cc: Michael Lawnick <ml.lawnick@xxxxxx>
> Cc: Jeroen De Wachter <jeroen.de.wachter@xxxxxxxxxx>
> ---
> 
> This is probably the least "ABI" breaking solution? RFC for now...
> 
>  drivers/i2c/i2c-mux.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/i2c/i2c-mux.c b/drivers/i2c/i2c-mux.c
> index 5b482ea32faf..26aa84902ada 100644
> --- a/drivers/i2c/i2c-mux.c
> +++ b/drivers/i2c/i2c-mux.c
> @@ -134,7 +134,8 @@ struct i2c_adapter *i2c_add_mux_adapter(struct i2c_adapter *parent,
>  
>  	/* Now fill out new adapter structure */
>  	snprintf(priv->adap.name, sizeof(priv->adap.name),
> -		 "i2c-%d-mux (chan_id %d)", i2c_adapter_id(parent), chan_id);
> +		 "i2c-%d-mux (chan_id %d) (mux_device %s)",
> +		 i2c_adapter_id(parent), chan_id, dev_name(mux_dev));

This yields pretty long names, longer than the maximum supported length,
if the mux is not an i2c adapter (eg i2c-mux-pinctrl).

i2c-17-mux (chan_id 5) (mux_device i2c-mux-pinctrl)

has 52 characters, and the maximum name length is 48.
Maybe just use "mux" instead of "mux_adapter" ?

The result still fails for me because the application code doesn't expect
to see "(mux...)", but I guess there will always be some problem :-(.

I still need to figure out what causes the failure with the other patch.

Guenter

>  	priv->adap.owner = THIS_MODULE;
>  	priv->adap.algo = &priv->algo;
>  	priv->adap.algo_data = priv;
> -- 
> 2.1.1
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux