All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfram Sang <wsa@the-dreams.de>
To: linux-sh@vger.kernel.org
Subject: Re: [RFC V2 2/4] i2c: mux: add function to reparent a mux
Date: Thu, 19 Mar 2015 15:39:49 +0000	[thread overview]
Message-ID: <20150319153949.GD7657@katana> (raw)
In-Reply-To: <1426576524-22315-3-git-send-email-wsa@the-dreams.de>

[-- Attachment #1: Type: text/plain, Size: 2264 bytes --]

On Tue, Mar 17, 2015 at 08:15:22AM +0100, Wolfram Sang wrote:
> From: Wolfram Sang <wsa+renesas@sang-engineering.com>
> 
> Used for n-to-1 demuxes. Needs discussion.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

So, I'll discuss this with myself ;)

While this works, it is abusing the driver model quite much.
sysfs-representation will not notice the new parent and it does not look
possible to mark instantiated slaves as "kernel-driven" for the
currently active bus. They will only be marked for the bus they were
attached during instantiation.

It is nice to have some working code in case you need core switching and
leaving the childs active. However, I think an approach with
de/re-registering will be much cleaner.

I will hack something for that next week taking the DT binding from this
approach. I think we are quite OK with that one, or?

> ---
> 
> Changes since RFC V1: none, only rebased
> 
>  drivers/i2c/i2c-mux.c   | 8 ++++++++
>  include/linux/i2c-mux.h | 2 ++
>  2 files changed, 10 insertions(+)
> 
> diff --git a/drivers/i2c/i2c-mux.c b/drivers/i2c/i2c-mux.c
> index 593f7ca9adc783..c64f3fc9bb3750 100644
> --- a/drivers/i2c/i2c-mux.c
> +++ b/drivers/i2c/i2c-mux.c
> @@ -100,6 +100,14 @@ static unsigned int i2c_mux_parent_classes(struct i2c_adapter *parent)
>  	return class;
>  }
>  
> +void i2c_mux_reparent(struct i2c_adapter *adap, struct i2c_adapter *new_parent)
> +{
> +	struct i2c_mux_priv *priv = adap->algo_data;
> +
> +	priv->parent = new_parent;
> +}
> +EXPORT_SYMBOL_GPL(i2c_mux_reparent);
> +
>  struct i2c_adapter *i2c_add_mux_adapter(struct i2c_adapter *parent,
>  				struct device *mux_dev,
>  				void *mux_priv, u32 force_nr, u32 chan_id,
> diff --git a/include/linux/i2c-mux.h b/include/linux/i2c-mux.h
> index b5f9a007a3abdd..488a7744732853 100644
> --- a/include/linux/i2c-mux.h
> +++ b/include/linux/i2c-mux.h
> @@ -44,6 +44,8 @@ struct i2c_adapter *i2c_add_mux_adapter(struct i2c_adapter *parent,
>  
>  void i2c_del_mux_adapter(struct i2c_adapter *adap);
>  
> +void i2c_mux_reparent(struct i2c_adapter *adap, struct i2c_adapter *new_parent);
> +
>  #endif /* __KERNEL__ */
>  
>  #endif /* _LINUX_I2C_MUX_H */
> -- 
> 2.1.4
> 

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-17  7:15 [RFC V2 2/4] i2c: mux: add function to reparent a mux Wolfram Sang
2015-03-19 15:39 ` Wolfram Sang [this message]

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=20150319153949.GD7657@katana \
    --to=wsa@the-dreams.de \
    --cc=linux-sh@vger.kernel.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.