Message ID | 20141104143309.GA12933@katana |
---|---|
State | Superseded |
Headers | show |
On 11/04/2014 06:33 AM, Wolfram Sang wrote: > >> Ok, I think I know the problem. In my case, the parent adapter >> and the mux device are the same (since both are on the same chip >> and the mux is really merged into the i2c controller). >> >> I'll have to figure out how to fix that. > > Maybe something like this on top helps already? It skips link creation > if the parent device is the parent i2c adapter. We should have this > anyway... > I'll test tonight ... I'll be in meetings all day :-(. Guenter > --- a/drivers/i2c/i2c-mux.c > +++ b/drivers/i2c/i2c-mux.c > @@ -184,8 +184,11 @@ struct i2c_adapter *i2c_add_mux_adapter(struct i2c_adapter *parent, > return NULL; > } > > - WARN(sysfs_create_link(&parent->dev.kobj, &priv->adap.dev.kobj, priv->adap.dev.kobj.name), > - "can't create compatibility link for old mux name scheme\n"); > + /* If necessary, create symlink to match old mux name scheme */ > + if (mux_dev != &parent->dev) > + WARN(sysfs_create_link(&parent->dev.kobj, &priv->adap.dev.kobj, > + dev_name(&priv->adap.dev)), > + "can't create compatibility link for old mux name scheme\n"); > > dev_info(&parent->dev, "Added multiplexed i2c bus %d\n", > i2c_adapter_id(&priv->adap)); > @@ -198,7 +201,8 @@ void i2c_del_mux_adapter(struct i2c_adapter *adap) > { > struct i2c_mux_priv *priv = adap->algo_data; > > - sysfs_remove_link(&priv->parent->dev.kobj, adap->dev.kobj.name); > + if (priv->adap.dev.parent != &priv->parent->dev) > + sysfs_remove_link(&priv->parent->dev.kobj, dev_name(&adap->dev)); > i2c_del_adapter(adap); > kfree(priv); > } > -- 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
On Tue, Nov 04, 2014 at 03:33:09PM +0100, Wolfram Sang wrote: > > > Ok, I think I know the problem. In my case, the parent adapter > > and the mux device are the same (since both are on the same chip > > and the mux is really merged into the i2c controller). > > > > I'll have to figure out how to fix that. > > Maybe something like this on top helps already? It skips link creation > if the parent device is the parent i2c adapter. We should have this > anyway... > It fixes the tracebacks, but application code still fails. I'll have to track that down; most likely it uses a means to find the i2c root adapter which no longer works. I'll also try your other patch. Guenter -- 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
--- a/drivers/i2c/i2c-mux.c +++ b/drivers/i2c/i2c-mux.c @@ -184,8 +184,11 @@ struct i2c_adapter *i2c_add_mux_adapter(struct i2c_adapter *parent, return NULL; } - WARN(sysfs_create_link(&parent->dev.kobj, &priv->adap.dev.kobj, priv->adap.dev.kobj.name), - "can't create compatibility link for old mux name scheme\n"); + /* If necessary, create symlink to match old mux name scheme */ + if (mux_dev != &parent->dev) + WARN(sysfs_create_link(&parent->dev.kobj, &priv->adap.dev.kobj, + dev_name(&priv->adap.dev)), + "can't create compatibility link for old mux name scheme\n"); dev_info(&parent->dev, "Added multiplexed i2c bus %d\n", i2c_adapter_id(&priv->adap)); @@ -198,7 +201,8 @@ void i2c_del_mux_adapter(struct i2c_adapter *adap) { struct i2c_mux_priv *priv = adap->algo_data; - sysfs_remove_link(&priv->parent->dev.kobj, adap->dev.kobj.name); + if (priv->adap.dev.parent != &priv->parent->dev) + sysfs_remove_link(&priv->parent->dev.kobj, dev_name(&adap->dev)); i2c_del_adapter(adap); kfree(priv); }