[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75Vc=4zyRUpeZ_-P4VZpSyX5tRbw6Bj6iKR0FHgOM=vic9g@mail.gmail.com>
Date: Fri, 7 Oct 2022 19:26:43 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Jean-Jacques Hiblot <jjhiblot@...phandler.com>
Cc: lee.jones@...aro.org, pavel@....cz, robh+dt@...nel.org,
sven.schwermer@...ruptive-technologies.com,
krzysztof.kozlowski+dt@...aro.org, johan+linaro@...nel.org,
marijn.suijten@...ainline.org, bjorn.andersson@...aro.org,
jacek.anaszewski@...il.com, linux-leds@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 4/6] leds: class: store the color index in struct led_classdev
On Fri, Oct 7, 2022 at 6:03 PM Jean-Jacques Hiblot
<jjhiblot@...phandler.com> wrote:
>
> This information might be useful for more than only deriving the led's
> name.
> And since we have this information, we can expose it in the sysfs.
Not sure why you haven't continued a new sentence on the previous line.
...
> +static ssize_t color_show(struct device *dev,
> + struct device_attribute *attr, char *buf)
> +{
> + const char *color_text = "invalid";
> + struct led_classdev *led_cdev = dev_get_drvdata(dev);
> +
> + if (led_cdev->color < LED_COLOR_ID_MAX)
> + color_text = led_colors[led_cdev->color];
> + return sprintf(buf, "%s\n", color_text);
According to the Documentation you must use sysfs_emit() here. It
might be good to update existing code as well (as a separate change).
> +}
> +static DEVICE_ATTR_RO(color);
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists