[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aG-ftUl7l2zNm_eH@gmail.com>
Date: Thu, 10 Jul 2025 13:10:45 +0200
From: Marcus Folkesson <marcus.folkesson@...il.com>
To: Javier Martinez Canillas <javierm@...hat.com>
Cc: linux-kernel@...r.kernel.org, ipedrosa@...hat.com,
David Airlie <airlied@...il.com>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>, Simona Vetter <simona@...ll.ch>,
Thomas Zimmermann <tzimmermann@...e.de>,
dri-devel@...ts.freedesktop.org
Subject: Re: [PATCH 2/3] drm/sitronix/st7571-i2c: Make the reset GPIO to be
optional
Hello Javier,
On Thu, Jul 10, 2025 at 01:00:41PM +0200, Javier Martinez Canillas wrote:
> >
> > devm_gpiod_get_optional() returns -ENOENT when the GPIO is not found,
> > and that is no error we want to propagage upwards.
> >
> > Maybe something like this instead:
> > if (IS_ERR(st7571->reset) && IS_ERR(st7571->reset) != -ENOENT)
> >
>
> Are you sure about that? As far as I know, that is exactly the
> difference between gpiod_get() and gpiod_get_optional() variants.
>
> From the gpiod_get_optional() function helper kernel-doc [0]:
>
> /**
> * gpiod_get_optional - obtain an optional GPIO for a given GPIO function
> * @dev: GPIO consumer, can be NULL for system-global GPIOs
> * @con_id: function within the GPIO consumer
> * @flags: optional GPIO initialization flags
> *
> * This is equivalent to gpiod_get(), except that when no GPIO was assigned to
> * the requested function it will return NULL. This is convenient for drivers
> * that need to handle optional GPIOs.
> *
> * Returns:
> * The GPIO descriptor corresponding to the function @con_id of device
> * dev, NULL if no GPIO has been assigned to the requested function, or
> * another IS_ERR() code if an error occurred while trying to acquire the GPIO.
> */
>
> while the gpiod_get() kernel-doc says the following:
>
> /**
> * gpiod_get - obtain a GPIO for a given GPIO function
> * @dev: GPIO consumer, can be NULL for system-global GPIOs
> * @con_id: function within the GPIO consumer
> * @flags: optional GPIO initialization flags
> *
> * Returns:
> * The GPIO descriptor corresponding to the function @con_id of device
> * dev, -ENOENT if no GPIO has been assigned to the requested function, or
> * another IS_ERR() code if an error occurred while trying to acquire the GPIO.
> */
>
You are completely righ.
Reviewed-by: Marcus Folkesson <marcus.folkesson@...il.com>
Best regards,
Marcus Folkesson
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists