From: Wolfram Sang <wsa@the-dreams.de>
To: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Cc: linux-i2c@vger.kernel.org, alsa-devel@alsa-project.org,
linux-acpi@vger.kernel.org, lm-sensors@lm-sensors.org,
Mark Brown <broonie@kernel.org>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
Jean Delvare <jdelvare@suse.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Dustin Byford <dustin@cumulusnetworks.com>,
linux@roeck-us.net
Subject: Re: [RFC] i2c: Revert back to old device naming for ACPI enumerated I2C slaves
Date: Fri, 9 Oct 2015 22:47:13 +0100 [thread overview]
Message-ID: <20151009214712.GD1481@katana> (raw)
In-Reply-To: <560E4DF4.4000901@linux.intel.com>
[-- Attachment #1: Type: text/plain, Size: 1671 bytes --]
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:
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);
+ }
}
/**
Shouldn't something like this be enough?
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2015-10-09 21:47 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-24 10:52 [RFC] i2c: Revert back to old device naming for ACPI enumerated I2C slaves Jarkko Nikula
[not found] ` <1440413522-7855-1-git-send-email-jarkko.nikula-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2015-08-24 13:26 ` Wolfram Sang
2015-08-25 0:19 ` Rafael J. Wysocki
2015-08-25 14:59 ` Wolfram Sang
2015-08-25 5:03 ` Dustin Byford
[not found] ` <20150825050306.GB21569-qUQiAmfTcIp+XZJcv9eMoEEOCMrvLtNR@public.gmane.org>
2015-08-25 14:50 ` Jarkko Nikula
2015-08-25 5:25 ` Mark Brown
2015-08-25 14:57 ` Wolfram Sang
[not found] ` <20150825145756.GA4066-oo5tB6JMkjKRinMKxDlMNPwbnWRJjS81@public.gmane.org>
2015-08-25 15:18 ` Guenter Roeck
[not found] ` <55DC8746.1060809-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
2015-08-25 16:18 ` Wolfram Sang
2015-08-25 16:22 ` Wolfram Sang
2015-08-25 17:12 ` Guenter Roeck
2015-08-25 16:14 ` Mark Brown
2015-10-01 20:37 ` Wolfram Sang
2015-10-02 9:27 ` Jarkko Nikula
2015-10-09 21:47 ` Wolfram Sang [this message]
2015-10-12 8:32 ` Jarkko Nikula
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=20151009214712.GD1481@katana \
--to=wsa@the-dreams.de \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=dustin@cumulusnetworks.com \
--cc=jarkko.nikula@linux.intel.com \
--cc=jdelvare@suse.com \
--cc=lgirdwood@gmail.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=lm-sensors@lm-sensors.org \
--cc=rjw@rjwysocki.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).