From: Marcus Folkesson <marcus.folkesson@gmail.com>
To: Javier Martinez Canillas <javierm@redhat.com>
Cc: linux-kernel@vger.kernel.org, ipedrosa@redhat.com,
David Airlie <airlied@gmail.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Simona Vetter <simona@ffwll.ch>,
Thomas Zimmermann <tzimmermann@suse.de>,
dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 2/3] drm/sitronix/st7571-i2c: Make the reset GPIO to be optional
Date: Thu, 10 Jul 2025 13:10:45 +0200 [thread overview]
Message-ID: <aG-ftUl7l2zNm_eH@gmail.com> (raw)
In-Reply-To: <87jz4gfgyu.fsf@minerva.mail-host-address-is-not-set>
[-- Attachment #1: Type: text/plain, Size: 1956 bytes --]
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@gmail.com>
Best regards,
Marcus Folkesson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2025-07-10 11:10 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-10 10:24 [PATCH 0/3] drm/sitronix/st7571-i2c: Add support for the ST7567 Controller Javier Martinez Canillas
2025-07-10 10:24 ` [PATCH 1/3] dt-bindings: display: Add Sitronix ST7567 LCD Controller Javier Martinez Canillas
2025-07-10 22:51 ` Rob Herring (Arm)
2025-07-10 10:24 ` [PATCH 2/3] drm/sitronix/st7571-i2c: Make the reset GPIO to be optional Javier Martinez Canillas
2025-07-10 10:47 ` Marcus Folkesson
2025-07-10 11:00 ` Javier Martinez Canillas
2025-07-10 11:10 ` Marcus Folkesson [this message]
2025-07-11 19:25 ` Javier Martinez Canillas
2025-07-14 8:45 ` Thomas Zimmermann
2025-07-14 9:42 ` Javier Martinez Canillas
2025-07-14 8:55 ` Thomas Zimmermann
2025-07-14 9:47 ` Javier Martinez Canillas
2025-07-10 10:24 ` [PATCH 3/3] drm/sitronix/st7571-i2c: Add support for the ST7567 Controller Javier Martinez Canillas
2025-07-11 20:23 ` [PATCH 0/3] " Marcus Folkesson
2025-07-11 20:51 ` Javier Martinez Canillas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aG-ftUl7l2zNm_eH@gmail.com \
--to=marcus.folkesson@gmail.com \
--cc=airlied@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=ipedrosa@redhat.com \
--cc=javierm@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.