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] [day] [month] [year] [list]
Message-ID: <aAe0pWa1Fzxb86HM@smile.fi.intel.com>
Date: Tue, 22 Apr 2025 18:24:21 +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 10/10] pinctrl: Add pin controller driver for AAEON UP
 boards

On Tue, Apr 22, 2025 at 04:36:33PM +0200, Thomas Richard wrote:

...

> >> +static int upboard_gpio_request(struct gpio_chip *gc, unsigned int offset)
> >> +{
> >> +	struct gpiochip_fwd *fwd = container_of(gc, struct gpiochip_fwd, chip);
> >> +	struct upboard_pinctrl *pctrl = fwd->data;
> > 
> > Yeah, something like
> > 
> > 	struct upboard_pinctrl *pctrl = gpio_fwd_get_data(fwd);
> > 
> >> +	unsigned int pin = pctrl->pctrl_data->pin_header[offset];
> >> +	struct gpio_desc *desc;
> >> +	int ret;
> >> +
> >> +	ret = pinctrl_gpio_request(gc, offset);
> >> +	if (ret)
> >> +		return ret;
> > 
> >> +	/* GPIO desc is already registered */
> >> +	if (fwd->descs[offset])
> >> +		return 0;
> > 
> > As mentioned in another reply, why 0 and even though, why can't it be simply
> > filtered by EEXIST from the below?
> > 
> > In worst scenario, you can add an API gpio_fwd_is_registered(fwd, offset).
> 
> I cannot filter using EEXIST, because I have to get the GPIO desc first.
> And using the retcode of gpiod_get_index() I cannot detect that I
> already requested the GPIO.
> 
> As now gpiochip_fwd is an opaque pointer, I will add the
> gpio_fwd_is_registered() helper.
> 
> It is due to the fact that the forwarder never releases a GPIO desc. An
> other solution could be to add the possibility to remove a GPIO desc.
> In upboard_gpio_free() the GPIO desc is free, and we can remove the check.
> 
> upboard_gpio_free()
> {
> 	gpio_fwd_free_desc(fwd, offset);
> 	pinctrl_gpio_free(gc, offset);
> }

>From given options I prefer to have the _gpio_free(), i.e. the latter one.

-- 
With Best Regards,
Andy Shevchenko



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ