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

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

 



[...]

> > +static int pattern_trig_add_pattern_ended(struct led_classdev *led_cdev)
> > +{
> > +       struct pattern_trig_data *data = led_get_trigger_data(led_cdev);
> > +       struct device *dev = led_cdev->dev;
> > +       int ret;
> > +
> > +       ret = device_create_file(dev, &dev_attr_pattern_ended);
> > +       if (ret) {
> > +               dev_err(dev,
> > +                       "Error creating pattern_ended (%pe)\n", ERR_PTR(ret));
> > +               return ret;
> > +       }
> > +
> > +       data->pattern_ended = sysfs_get_dirent(dev->kobj.sd, "pattern_ended");
> > +       if (!data->pattern_ended) {
> > +               dev_err(dev, "Error getting pattern_ended kernelfs\n");
> > +               device_remove_file(dev, &dev_attr_pattern_ended);
> > +               return -ENXIO;
> > +       }
> > +
> > +       return 0;
> > +}
> > +
> > +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.

Could you please explain what you mean? In the current implementation
userspace can use epoll() already.

-- 
Thank you,
Dmitry



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux