Re: [PATCH v1] leds: trigger: pattern: notify userpace if pattern finished

From: Martin Kurbanov
Date: Thu Aug 25 2022 - 17:17:18 EST


Hi. Thank you for quick reply.

On 2022-08-24 18:51, Andy Shevchenko wrote:
...
>> +static void pattern_trig_remove_pattern_ended(struct led_classdev *led_cdev)
>> +{
>> + struct pattern_trig_data *data = led_get_trigger_data(led_cdev);
>> +
>> + sysfs_put(data->pattern_ended);
>> + device_remove_file(led_cdev->dev, &dev_attr_pattern_ended);
>> +}
>
> I'm wondering if you can always have a file and instead provide a
> value there, so user space may use epoll() mechanism on that. It will
> simplify your code here.
>
Do you mean to add 'dev_attr_pattern_ended' to 'pattern_trig_attrs',
and use 'sysfs_notify' instead of 'sysfs_notify_dirent' call'?

--
Best Regards,
Kurbanov Martin