[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aAE7akcsktz1wc2w@smile.fi.intel.com>
Date: Thu, 17 Apr 2025 20:33:30 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Thomas Richard <thomas.richard@...tlin.com>
Cc: Linus Walleij <linus.walleij@...aro.org>,
Bartosz Golaszewski <brgl@...ev.pl>,
Geert Uytterhoeven <geert+renesas@...der.be>,
linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org,
thomas.petazzoni@...tlin.com, DanieleCleri@...on.eu,
GaryWang@...on.com.tw
Subject: Re: [PATCH v3 07/10] gpio: aggregator: export symbols of the GPIO
forwarder library
On Wed, Apr 16, 2025 at 04:08:15PM +0200, Thomas Richard wrote:
> Export all symbols and create header file for the GPIO forwarder library.
...
> -struct gpiochip_fwd_timing {
> - u32 ramp_up_us;
> - u32 ramp_down_us;
> -};
> -
> -struct gpiochip_fwd {
> - struct gpio_chip chip;
> - struct gpio_desc **descs;
> - union {
> - struct mutex mlock; /* protects tmp[] if can_sleep */
> - spinlock_t slock; /* protects tmp[] if !can_sleep */
> - };
> - struct gpiochip_fwd_timing *delay_timings;
> - unsigned long tmp[]; /* values and descs for multiple ops */
> -};
I don't like this piece at all. It will repeat one of the biggest mistake done
with many (old) subsystems and core.
Looking at the last patch ahead, I can tell that this is not needed. Instead
add a couple of APIs:
- getter for the gpiochip
- getter for the specific private data
and use the error code filtering for the existed GPIO descriptor, I actually
don't understand why for the existed descriptor you return there 0 and not an
error.
TL;DR: Follow OOP and make this an opaque pointer, no need to move it to the
header. The rest looks okay on the first glance.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists