Re: [PATCH v8] platform: x86: Add ChromeOS ACPI device driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux