From patchwork Fri Oct 9 21:47:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 7364181 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id AD0D09F32B for ; Fri, 9 Oct 2015 21:47:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DDC902085B for ; Fri, 9 Oct 2015 21:47:48 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id AE10820851 for ; Fri, 9 Oct 2015 21:47:47 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 584B3266955; Fri, 9 Oct 2015 23:47:44 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 9445E265238; Fri, 9 Oct 2015 23:47:36 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 37488265238; Fri, 9 Oct 2015 23:47:35 +0200 (CEST) Received: from pokefinder.org (sauhun.de [89.238.76.85]) by alsa0.perex.cz (Postfix) with ESMTP id 28A8C2651F0 for ; Fri, 9 Oct 2015 23:47:28 +0200 (CEST) Received: from [109.79.89.57] (port=52330 helo=katana) by pokefinder.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1ZkfVc-0004eD-5P; Fri, 09 Oct 2015 23:47:25 +0200 Date: Fri, 9 Oct 2015 22:47:13 +0100 From: Wolfram Sang To: Jarkko Nikula Message-ID: <20151009214712.GD1481@katana> References: <1440413522-7855-1-git-send-email-jarkko.nikula@linux.intel.com> <20151001203744.GA7514@katana> <560E4DF4.4000901@linux.intel.com> MIME-Version: 1.0 In-Reply-To: <560E4DF4.4000901@linux.intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) Cc: alsa-devel@alsa-project.org, Jean Delvare , "Rafael J. Wysocki" , Liam Girdwood , lm-sensors@lm-sensors.org, linux-acpi@vger.kernel.org, Mark Brown , linux-i2c@vger.kernel.org, linux@roeck-us.net, Dustin Byford Subject: Re: [alsa-devel] [RFC] i2c: Revert back to old device naming for ACPI enumerated I2C slaves X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP On Fri, Oct 02, 2015 at 12:27:16PM +0300, Jarkko Nikula wrote: > On 10/01/2015 11:37 PM, Wolfram Sang wrote: > > > >>This is for discussion so I didn't cc stable@vger.kernel.org yet. I was > >>thinking would it work if we'd keep the stable name but have an another > >>symlink in /sys/bus/i2c/devices/ that uses "x-00yz" name. However this > >>feels ill-use of devices directory and probably causes more troubles > >>elsewhere. > > > >Do you foresee troubles already? I am still in favour of a symlink. > > > I haven't looked at this for a while but one problem was that devices/ > directory belongs to private structure of struct bus_type and in order to > create a symlink there it needs to done in drivers/base/bus.c: > bus_add_device() which felt quite hackish to me. This is just a quick prototype and untested; but I did something similar in the i2c-mux code: Shouldn't something like this be enough? diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 5f89f1e3c2f24f..715dca57ba68fd 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c @@ -970,13 +970,15 @@ static void i2c_dev_set_name(struct i2c_adapter *adap, { struct acpi_device *adev = ACPI_COMPANION(&client->dev); - if (adev) { - dev_set_name(&client->dev, "i2c-%s", acpi_dev_name(adev)); - return; - } - dev_set_name(&client->dev, "%d-%04x", i2c_adapter_id(adap), i2c_encode_flags_to_addr(client)); + + if (adev) { + char symlink_name[256]; + + snprintf(symlink_name, sizeof(symlink_name), "i2c-%s", acpi_dev_name(adev)); + sysfs_create_link(&client->dev.kobj, &adap->dev.kobj, symlink_name); + } } /**