On Tue, Mar 17, 2015 at 08:15:22AM +0100, Wolfram Sang wrote: > From: Wolfram Sang > > Used for n-to-1 demuxes. Needs discussion. > > Signed-off-by: Wolfram Sang 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 >