[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8acef982-0aec-aaf0-7e26-b02cf024cdf8@collabora.com>
Date: Thu, 28 Apr 2022 13:06:48 +0500
From: Muhammad Usama Anjum <usama.anjum@...labora.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: usama.anjum@...labora.com, "Rafael J. Wysocki" <rafael@...nel.org>,
Len Brown <lenb@...nel.org>,
Hans de Goede <hdegoede@...hat.com>,
Mark Gross <markgross@...nel.org>,
Collabora Kernel ML <kernel@...labora.com>,
groeck@...omium.org, bleung@...omium.org, dtor@...omium.org,
gwendal@...omium.org, vbendeb@...omium.org, andy@...radead.org,
Ayman Bagabas <ayman.bagabas@...il.com>,
Benjamin Tissoires <benjamin.tissoires@...hat.com>,
Blaž Hrastnik <blaz@...n.io>,
Darren Hart <dvhart@...radead.org>,
Dmitry Torokhov <dmitry.torokhov@...il.com>,
Jeremy Soller <jeremy@...tem76.com>,
Mattias Jacobsson <2pi@....nu>,
Mauro Carvalho Chehab <mchehab+samsung@...nel.org>,
Rajat Jain <rajatja@...gle.com>,
Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>,
platform-driver-x86@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-acpi@...r.kernel.org,
"Rafael J . Wysocki" <rafael.j.wysocki@...el.com>,
Enric Balletbo i Serra <eballetbo@...il.com>
Subject: Re: [PATCH v8] platform: x86: Add ChromeOS ACPI device driver
On 4/24/22 1:43 PM, Greg Kroah-Hartman wrote:
> On Fri, Apr 15, 2022 at 10:08:15PM +0500, Muhammad Usama Anjum wrote:
>> + i = 0;
>> + list_for_each_entry(aag, &chromeos_acpi.groups, list) {
>> + chromeos_acpi.dev_groups[i] = &aag->group;
>> + i++;
>> + }
>> +
>> + ret = sysfs_create_groups(&dev->kobj, chromeos_acpi.dev_groups);
>
> You have raced with userspace and lost here :(
>
> Use the default groups pointer in the platform driver for this, and use
> the is_visible() callback to know to show, or not show, the attribute
> instead of building up dynamic lists of attributes at runtime. That
> will save you lots of crazy logic and housekeeping _AND_ userspace tools
> will work properly as well.
>
Yeah, using dev_group pointer in platform driver makes it simple. We
need to define the attributes at compile time. At run time, we can only
make decision to show or not to show the attribute. This simplifies
logic for the static attributes which will always be there. But there
are some set of attributes which may be 1 to N depending upon the
platform such as GPIO.0, GPIO.2 .... and GPIO.N. I'm working on
overcoming this. Once this is done, the driver is going to be very simple.
> thanks,
>
> greg k-h
--
Muhammad Usama Anjum
Powered by blists - more mailing lists