lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aGKdwmjlzVXsLhVX@smile.fi.intel.com>
Date: Mon, 30 Jun 2025 17:22:58 +0300
From: Andy Shevchenko <andriy.shevchenko@...el.com>
To: Bartosz Golaszewski <brgl@...ev.pl>
Cc: Ahmad Fatoum <a.fatoum@...gutronix.de>,
	Kent Gibson <warthog618@...il.com>,
	Jan Lübbe <jlu@...gutronix.de>,
	Marek Vasut <marex@...x.de>,
	Geert Uytterhoeven <geert+renesas@...der.be>,
	Linus Walleij <linus.walleij@...aro.org>,
	linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org,
	Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
Subject: Re: [PATCH v3 06/10] gpio: sysfs: don't use driver data in sysfs
 callbacks for line attributes

On Mon, Jun 30, 2025 at 03:39:20PM +0200, Bartosz Golaszewski wrote:
> On Mon, Jun 30, 2025 at 3:28 PM Andy Shevchenko
> <andriy.shevchenko@...el.com> wrote:
> > On Mon, Jun 30, 2025 at 02:37:13PM +0200, Bartosz Golaszewski wrote:

...

> > > -     struct gpiod_data *data = dev_get_drvdata(dev);
> > > +     struct gpiod_data *data = container_of(attr, struct gpiod_data,
> > > +                                            dir_attr);
> >
> > > -     struct gpiod_data *data = dev_get_drvdata(dev);
> > > +     struct gpiod_data *data = container_of(attr, struct gpiod_data,
> > > +                                            dir_attr);
> >
> > I still think that bunch of definitions to wrap contaner_of():s will help.
> > Note, two of them you are using even in the code below, besides the attribute
> > show()/store() cases.
> 
> I think this is overkill, the container_of() macro is pretty explicit
> and having 4 new macros will result in more LOC in the end.

I don't know how you counted. I counted as first one takes the same +4/-4 LoCs,
second one will gain already 1 LoC if we stack them as

#define foo_attr_to_gpiod_data(a)	container_of(...)
#define bar_attr_to_gpiod_data(a)	container_of(...)

...and so on...

But yes, some people are still fans of 80, and this might distort
the calculations I made.

> I'll allow myself to keep this as is.

Fair enough.

-- 
With Best Regards,
Andy Shevchenko



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ