Re: [PATCH 5/7] hwmon: iio: Add helper function for creating attributes
From: Andy Shevchenko
Date: Wed Jul 16 2025 - 06:00:38 EST
On Tue, Jul 15, 2025 at 11:55:08AM -0400, Sean Anderson wrote:
> On 7/15/25 04:38, Andy Shevchenko wrote:
> > On Mon, Jul 14, 2025 at 09:20:21PM -0400, Sean Anderson wrote:
...
> >> +static int add_device_attr(struct device *dev, struct iio_hwmon_state *st,
> >
> > This should hint that this is managed:
> >
> > add_device_managed_attr()
>
> That just makes it more difficult to format the calling code within 80 columns...
Choose your name, but important that it should hint the caller that it's only
for the ->probe() stages.
...
> >> + ssize_t (*show)(struct device *dev,
> >> + struct device_attribute *attr,
> >> + char *buf),
> >> + int i, const char *fmt, ...)
> >
> > __printf() attribute is missing.
>
> It's static, so I thought the compiler could infer it but I guess not.
TBH, I haven't checked, but I think it might be the good style to add.
--
With Best Regards,
Andy Shevchenko