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: <b5b24b98-ae89-4d50-90cb-c2bbc38aafba@bootlin.com>
Date: Mon, 12 May 2025 16:30:16 +0200
From: Thomas Richard <thomas.richard@...tlin.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Geert Uytterhoeven <geert@...ux-m68k.org>,
 Linus Walleij <linus.walleij@...aro.org>, Bartosz Golaszewski
 <brgl@...ev.pl>, Kees Cook <kees@...nel.org>, linux-gpio@...r.kernel.org,
 linux-kernel@...r.kernel.org, thomas.petazzoni@...tlin.com,
 DanieleCleri@...on.eu, GaryWang@...on.com.tw, linux-hardening@...r.kernel.org
Subject: Re: [PATCH v5 08/12] gpio: aggregator: export symbols of the GPIO
 forwarder library

On 5/12/25 16:11, Andy Shevchenko wrote:
> On Mon, May 12, 2025 at 04:08:35PM +0200, Thomas Richard wrote:
>> On 5/9/25 11:07, Geert Uytterhoeven wrote:
>>> On Tue, 6 May 2025 at 17:21, Thomas Richard <thomas.richard@...tlin.com> wrote:
> 
> ...
> 
>>>> +int gpio_fwd_set_config(struct gpio_chip *chip, unsigned int offset,
>>>> +                       unsigned long config);
>>>> +
>>>> +int gpio_fwd_to_irq(struct gpio_chip *chip, unsigned int offset);
>>>
>>> I would expect all of these to take gpiochip_fwd pointers instead of
>>> gpio_chip pointers.  What prevents you from passing a gpio_chip pointer
>>> that does not correspond to a gpiochip_fwd object, causing a crash?
>>
>> Indeed nothing prevents from passing gpio_chip pointer which does not
>> correspond to a gpiochip_fwd object.
>> And it is also a bit weird to pass a gpiochip_fwd pointer in some cases
>> (for example gpio_fwd_gpio_add()) and a gpio_chip in other cases.
>>
>> I can keep GPIO operations as is, and create exported wrappers which
>> take a gpiochip_fwd pointer as parameter, for example:
>>
>> int gpiochip_fwd_get_multiple(struct gpiochip_fwd *fwd,
>> 			      unsigned long *mask,
>> 			      unsigned long *bits)
>> {
>> 	struct gpio_chip *gc = gpiochip_fwd_get_gpiochip(fwd);
>>
>> 	return gpio_fwd_get_multiple_locked(chip, mask, bits);
>> }
>> EXPORT_SYMBOL_NS_GPL(gpiochip_fwd_get_multiple, "GPIO_FORWARDER");
>>
>> So exported functions are gpiochip_fwd_*().
> 
> Sounds good for me. Let's wait for Geert's opinoin on this.

Regarding Geert's comment for patch 9/12, an other proposal for naming:
As mentioned above, exported functions gpiochip_fwd_*() take a
gpiochip_fwd as parameter.

But for all functions corresponding to a GPIO operation add the gpio
word, and for functions to add/remove GPIO descriptor add the desc word:

devm_gpiochip_fwd_alloc()
gpiochip_fwd_register()

gpiochip_fwd_desc_add()
gpiochip_fwd_desc_free()

gpiochip_fwd_get_gpiochip()
gpiochip_fwd_get_data()

gpiochip_fwd_gpio_request()
gpiochip_fwd_gpio_get_direction()
gpiochip_fwd_gpio_direction_input()
gpiochip_fwd_gpio_direction_output()
gpiochip_fwd_gpio_get()
gpiochip_fwd_gpio_set()
gpiochip_fwd_gpio_set_multiple()
gpiochip_fwd_gpio_get_multiple()
gpiochip_fwd_gpio_set_config()
gpiochip_fwd_gpio_to_irq()

Regards,

Thomas

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ