Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755076AbbEBTWO (ORCPT ); Sat, 2 May 2015 15:22:14 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:45082 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1945973AbbEBTWI (ORCPT ); Sat, 2 May 2015 15:22:08 -0400 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wolfram Sang , Wolfram Sang Subject: [PATCH 4.0 185/220] i2c: mux: use proper dev when removing "channel-X" symlinks Date: Sat, 2 May 2015 21:01:40 +0200 Message-Id: <20150502185902.302312412@linuxfoundation.org> X-Mailer: git-send-email 2.3.7 In-Reply-To: <20150502185854.333748961@linuxfoundation.org> References: <20150502185854.333748961@linuxfoundation.org> User-Agent: quilt/0.64 MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2193 Lines: 64 4.0-stable review patch. If anyone has any objections, please let me know. ------------------ From: Wolfram Sang commit 133778482ec6c8fde69406be380333963627c17a upstream. Those symlinks are created for the mux_dev, so we need to remove it from there. Currently, it breaks for muxes where the mux_dev is not the device of the parent adapter like this: [ 78.234644] WARNING: CPU: 0 PID: 365 at fs/sysfs/dir.c:31 sysfs_warn_dup+0x5c/0x78() [ 78.242438] sysfs: cannot create duplicate filename '/devices/platform/i2cbus@8/channel-0' Remove confusing comments while we are here. Signed-off-by: Wolfram Sang Signed-off-by: Wolfram Sang Fixes: c9449affad2ae0 Signed-off-by: Greg Kroah-Hartman --- drivers/i2c/i2c-mux.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) --- a/drivers/i2c/i2c-mux.c +++ b/drivers/i2c/i2c-mux.c @@ -32,8 +32,9 @@ struct i2c_mux_priv { struct i2c_algorithm algo; struct i2c_adapter *parent; - void *mux_priv; /* the mux chip/device */ - u32 chan_id; /* the channel id */ + struct device *mux_dev; + void *mux_priv; + u32 chan_id; int (*select)(struct i2c_adapter *, void *mux_priv, u32 chan_id); int (*deselect)(struct i2c_adapter *, void *mux_priv, u32 chan_id); @@ -119,6 +120,7 @@ struct i2c_adapter *i2c_add_mux_adapter( /* Set up private adapter data */ priv->parent = parent; + priv->mux_dev = mux_dev; priv->mux_priv = mux_priv; priv->chan_id = chan_id; priv->select = select; @@ -203,7 +205,7 @@ void i2c_del_mux_adapter(struct i2c_adap char symlink_name[20]; snprintf(symlink_name, sizeof(symlink_name), "channel-%u", priv->chan_id); - sysfs_remove_link(&adap->dev.parent->kobj, symlink_name); + sysfs_remove_link(&priv->mux_dev->kobj, symlink_name); sysfs_remove_link(&priv->adap.dev.kobj, "mux_device"); i2c_del_adapter(adap); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/