diff mbox

[1/2] platform/x86: wmi: prefix sysfs files in /sys/bus/wmi with the ACPI device

Message ID 1512786861-1014-2-git-send-email-mario.limonciello@dell.com (mailing list archive)
State Changes Requested, archived
Delegated to: Darren Hart
Headers show

Commit Message

Limonciello, Mario Dec. 9, 2017, 2:34 a.m. UTC
It's possible for the same GUID to show up on as system twice.
This means using solely the GUID for identify the file will not
be sufficient.

Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
---
 drivers/platform/x86/wmi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Andy Lutomirski Dec. 9, 2017, 2:52 a.m. UTC | #1
--Andy

> On Dec 8, 2017, at 6:34 PM, Mario Limonciello <mario.limonciello@dell.com> wrote:
> 
> It's possible for the same GUID to show up on as system twice.
> This means using solely the GUID for identify the file will not
> be sufficient.

Isn't the file already in a per-bus directory?
Limonciello, Mario Dec. 9, 2017, 3:41 a.m. UTC | #2
>> On Dec 8, 2017, at 6:34 PM, Mario Limonciello <mario.limonciello@dell.com> wrote:
>>
>> It's possible for the same GUID to show up on as system twice.
>> This means using solely the GUID for identify the file will not
>> be sufficient.
>
>Isn't the file already in a per-bus directory?

Yep, but the symlink created in /sys/bus/wmi/devices isn't.
That's where the kernel complains about duplicate sysfs
attributes.

It's not exactly a pretty path I submitted, but it does avoid
those collisions.

Example (with this in place from /sys/bus/wmi/devices):
lrwxrwxrwx 1 root root 0 Dec  8 21:39 PNP0C14:04-70FE8229-D03B-4214-A1C6-1F884B1A892A -> ../../../devices/platform/PNP0C14:04/wmi_bus/wmi_bus-PNP0C14:04/PNP0C14:04-70FE8229-D03B-4214-A1C6-1F884B1A892A
Andy Lutomirski Dec. 9, 2017, 9:32 p.m. UTC | #3
On Fri, Dec 8, 2017 at 7:41 PM,  <Mario.Limonciello@dell.com> wrote:
>>> On Dec 8, 2017, at 6:34 PM, Mario Limonciello <mario.limonciello@dell.com> wrote:
>>>
>>> It's possible for the same GUID to show up on as system twice.
>>> This means using solely the GUID for identify the file will not
>>> be sufficient.
>>
>>Isn't the file already in a per-bus directory?
>
> Yep, but the symlink created in /sys/bus/wmi/devices isn't.
> That's where the kernel complains about duplicate sysfs
> attributes.
>
> It's not exactly a pretty path I submitted, but it does avoid
> those collisions.
>
> Example (with this in place from /sys/bus/wmi/devices):
> lrwxrwxrwx 1 root root 0 Dec  8 21:39 PNP0C14:04-70FE8229-D03B-4214-A1C6-1F884B1A892A -> ../../../devices/platform/PNP0C14:04/wmi_bus/wmi_bus-PNP0C14:04/PNP0C14:04-70FE8229-D03B-4214-A1C6-1F884B1A892A

Right, I saw that in the cover letter right after sending this.

Greg, is there a cleaner way to deal with this?  There are two
instances of the same bus type, each of which would like to have a
device called "70FE8229-D03B-4214-A1C6-1F884B1A892A".  Can we somehow
rename the symlinks without renaming the device, or are we just
supposed to prefix the device name like Mario is doing here?
Darren Hart July 6, 2018, 11 p.m. UTC | #4
On Sat, Dec 09, 2017 at 01:32:29PM -0800, Andy Lutomirski wrote:
> On Fri, Dec 8, 2017 at 7:41 PM,  <Mario.Limonciello@dell.com> wrote:
> >>> On Dec 8, 2017, at 6:34 PM, Mario Limonciello <mario.limonciello@dell.com> wrote:
> >>>
> >>> It's possible for the same GUID to show up on as system twice.
> >>> This means using solely the GUID for identify the file will not
> >>> be sufficient.
> >>
> >>Isn't the file already in a per-bus directory?
> >
> > Yep, but the symlink created in /sys/bus/wmi/devices isn't.
> > That's where the kernel complains about duplicate sysfs
> > attributes.
> >
> > It's not exactly a pretty path I submitted, but it does avoid
> > those collisions.
> >
> > Example (with this in place from /sys/bus/wmi/devices):
> > lrwxrwxrwx 1 root root 0 Dec  8 21:39 PNP0C14:04-70FE8229-D03B-4214-A1C6-1F884B1A892A -> ../../../devices/platform/PNP0C14:04/wmi_bus/wmi_bus-PNP0C14:04/PNP0C14:04-70FE8229-D03B-4214-A1C6-1F884B1A892A
> 
> Right, I saw that in the cover letter right after sending this.
> 
> Greg, is there a cleaner way to deal with this?  There are two
> instances of the same bus type, each of which would like to have a
> device called "70FE8229-D03B-4214-A1C6-1F884B1A892A".  Can we somehow
> rename the symlinks without renaming the device, or are we just
> supposed to prefix the device name like Mario is doing here?
> 

Mario,

This one has been lingering at the bottom of my patch stack for a while now -
sorry for not poking on this earlier. Is this still something you have a need
for?

If so, would you resend and add Greg to Cc - specifically directing Andy's
question above to him?
Darren Hart Nov. 29, 2018, 12:22 a.m. UTC | #5
On Sat, Dec 09, 2017 at 01:32:29PM -0800, Andy Lutomirski wrote:
> On Fri, Dec 8, 2017 at 7:41 PM,  <Mario.Limonciello@dell.com> wrote:
> >>> On Dec 8, 2017, at 6:34 PM, Mario Limonciello <mario.limonciello@dell.com> wrote:
> >>>
> >>> It's possible for the same GUID to show up on as system twice.
> >>> This means using solely the GUID for identify the file will not
> >>> be sufficient.
> >>
> >>Isn't the file already in a per-bus directory?
> >
> > Yep, but the symlink created in /sys/bus/wmi/devices isn't.
> > That's where the kernel complains about duplicate sysfs
> > attributes.
> >
> > It's not exactly a pretty path I submitted, but it does avoid
> > those collisions.
> >
> > Example (with this in place from /sys/bus/wmi/devices):
> > lrwxrwxrwx 1 root root 0 Dec  8 21:39 PNP0C14:04-70FE8229-D03B-4214-A1C6-1F884B1A892A -> ../../../devices/platform/PNP0C14:04/wmi_bus/wmi_bus-PNP0C14:04/PNP0C14:04-70FE8229-D03B-4214-A1C6-1F884B1A892A
> 
> Right, I saw that in the cover letter right after sending this.
> 
> Greg, is there a cleaner way to deal with this?  There are two
> instances of the same bus type, each of which would like to have a
> device called "70FE8229-D03B-4214-A1C6-1F884B1A892A".  Can we somehow
> rename the symlinks without renaming the device, or are we just
> supposed to prefix the device name like Mario is doing here?
> 

Mario, if this is still a concern (I presume it is) would you please
resend the patch Cc gregkh directly?
diff mbox

Patch

diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
index 791449a2370f..45d9010aafcf 100644
--- a/drivers/platform/x86/wmi.c
+++ b/drivers/platform/x86/wmi.c
@@ -1081,7 +1081,8 @@  static int wmi_create_device(struct device *wmi_bus_dev,
 	wblock->dev.dev.bus = &wmi_bus_type;
 	wblock->dev.dev.parent = wmi_bus_dev;
 
-	dev_set_name(&wblock->dev.dev, "%pUL", gblock->guid);
+	dev_set_name(&wblock->dev.dev, "%s-%pUL",
+		     dev_name(&wblock->acpi_device->dev), gblock->guid);
 
 	device_initialize(&wblock->dev.dev);