Re: [PATCH] leds: trigger/tty: feature data direction

From: Uwe Kleine-König
Date: Thu Apr 22 2021 - 10:39:51 EST


Hello Greg,

On Thu, Apr 22, 2021 at 10:05:28AM +0200, Greg Kroah-Hartman wrote:
> On Thu, Apr 22, 2021 at 09:47:02AM +0200, Juergen Borleis wrote:
> > +static ssize_t dirfilter_show(struct device *dev,
> > + struct device_attribute *attr, char *buf)
> > +{
> > + struct ledtrig_tty_data *trigger_data = led_trigger_get_drvdata(dev);
> > +
> > + if (trigger_data->indirection)
> > + return (ssize_t)sprintf(buf, "in\n");
> > + if (trigger_data->outdirection)
> > + return (ssize_t)sprintf(buf, "out\n");
> > + return (ssize_t)sprintf(buf, "inout\n");
>
> sysfs_emit() please.
>
> And you are adding new sysfs files, that requires an update to
> Documentation/ABI/ please do so.

I agree to these two suggestions.

> But why are you adding random new sysfs values to a class device? That
> feels really wrong.

This is quite usual for triggers and there is IMHO no way around this.
And it is also save as led_trigger_set() emits an uevent after a trigger
was activated.

Best regards
Uwe

--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |

Attachment: signature.asc
Description: PGP signature