* [PATCH 3/3] mmc: Only retrieve cd pin when GPIO is enabled
@ 2020-10-30 8:45 Harm Berntsen
2020-11-03 15:12 ` Simon Glass
0 siblings, 1 reply; 5+ messages in thread
From: Harm Berntsen @ 2020-10-30 8:45 UTC (permalink / raw)
To: u-boot
The driver only needs to retrieve the pin for the ACPI info. The driver
itself works without depending on GPIO.
Signed-off-by: Harm Berntsen <harm.berntsen@nedap.com>
CC: Simon Glass <sjg@chromium.org>
---
?drivers/mmc/pci_mmc.c | 2 ++
?1 file changed, 2 insertions(+)
diff --git a/drivers/mmc/pci_mmc.c b/drivers/mmc/pci_mmc.c
index 0c45e1b893..dba6324247 100644
--- a/drivers/mmc/pci_mmc.c
+++ b/drivers/mmc/pci_mmc.c
@@ -52,9 +52,11 @@ static int pci_mmc_probe(struct udevice *dev)
?
?static int pci_mmc_ofdata_to_platdata(struct udevice *dev)
?{
+#if defined(CONFIG_DM_GPIO)
????????struct pci_mmc_priv *priv = dev_get_priv(dev);
?
????????gpio_request_by_name(dev, "cd-gpios", 0, &priv->cd_gpio, GPIOD_IS_IN);
+#endif
?
????????return 0;
?}
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] mmc: Only retrieve cd pin when GPIO is enabled
2020-10-30 8:45 [PATCH 3/3] mmc: Only retrieve cd pin when GPIO is enabled Harm Berntsen
@ 2020-11-03 15:12 ` Simon Glass
2020-11-06 12:20 ` [PATCH v2 " Harm Berntsen
0 siblings, 1 reply; 5+ messages in thread
From: Simon Glass @ 2020-11-03 15:12 UTC (permalink / raw)
To: u-boot
Hi Harm,
On Fri, 30 Oct 2020 at 02:45, Harm Berntsen <harm.berntsen@nedap.com> wrote:
>
> The driver only needs to retrieve the pin for the ACPI info. The driver
> itself works without depending on GPIO.
>
> Signed-off-by: Harm Berntsen <harm.berntsen@nedap.com>
> CC: Simon Glass <sjg@chromium.org>
>
> ---
>
> drivers/mmc/pci_mmc.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/mmc/pci_mmc.c b/drivers/mmc/pci_mmc.c
> index 0c45e1b893..dba6324247 100644
> --- a/drivers/mmc/pci_mmc.c
> +++ b/drivers/mmc/pci_mmc.c
> @@ -52,9 +52,11 @@ static int pci_mmc_probe(struct udevice *dev)
>
> static int pci_mmc_ofdata_to_platdata(struct udevice *dev)
> {
> +#if defined(CONFIG_DM_GPIO)
Can this be:
if (CONFIG_IS_ENABLED(DM_GPIO))
We try to avoid #ifdef in the code.
> struct pci_mmc_priv *priv = dev_get_priv(dev);
>
> gpio_request_by_name(dev, "cd-gpios", 0, &priv->cd_gpio, GPIOD_IS_IN);
> +#endif
>
> return 0;
> }
>
Regards,
Simon
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 3/3] mmc: Only retrieve cd pin when GPIO is enabled
2020-11-03 15:12 ` Simon Glass
@ 2020-11-06 12:20 ` Harm Berntsen
2020-11-06 18:50 ` Simon Glass
2021-01-19 13:03 ` Tom Rini
0 siblings, 2 replies; 5+ messages in thread
From: Harm Berntsen @ 2020-11-06 12:20 UTC (permalink / raw)
To: u-boot
The driver only needs to retrieve the pin for the ACPI info. The driver
itself works without depending on GPIO.
Signed-off-by: Harm Berntsen <harm.berntsen@nedap.com>
CC: Simon Glass <sjg@chromium.org>
---
Changes for v2:
- Changed ifdef to if (CONFIG_IS_ENABLED(DM_GPIO))
drivers/mmc/pci_mmc.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/pci_mmc.c b/drivers/mmc/pci_mmc.c
index 0c45e1b893..bd229693b0 100644
--- a/drivers/mmc/pci_mmc.c
+++ b/drivers/mmc/pci_mmc.c
@@ -52,9 +52,11 @@ static int pci_mmc_probe(struct udevice *dev)
static int pci_mmc_ofdata_to_platdata(struct udevice *dev)
{
- struct pci_mmc_priv *priv = dev_get_priv(dev);
+ if (CONFIG_IS_ENABLED(DM_GPIO)) {
+ struct pci_mmc_priv *priv = dev_get_priv(dev);
- gpio_request_by_name(dev, "cd-gpios", 0, &priv->cd_gpio, GPIOD_IS_IN);
+ gpio_request_by_name(dev, "cd-gpios", 0, &priv->cd_gpio, GPIOD_IS_IN);
+ }
return 0;
}
--
2.29.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 3/3] mmc: Only retrieve cd pin when GPIO is enabled
2020-11-06 12:20 ` [PATCH v2 " Harm Berntsen
@ 2020-11-06 18:50 ` Simon Glass
2021-01-19 13:03 ` Tom Rini
1 sibling, 0 replies; 5+ messages in thread
From: Simon Glass @ 2020-11-06 18:50 UTC (permalink / raw)
To: u-boot
Hi Harm,
On Fri, 6 Nov 2020 at 05:20, Harm Berntsen <harm.berntsen@nedap.com> wrote:
>
> The driver only needs to retrieve the pin for the ACPI info. The driver
> itself works without depending on GPIO.
>
> Signed-off-by: Harm Berntsen <harm.berntsen@nedap.com>
> CC: Simon Glass <sjg@chromium.org>
> ---
> Changes for v2:
> - Changed ifdef to if (CONFIG_IS_ENABLED(DM_GPIO))
>
> drivers/mmc/pci_mmc.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/pci_mmc.c b/drivers/mmc/pci_mmc.c
> index 0c45e1b893..bd229693b0 100644
> --- a/drivers/mmc/pci_mmc.c
> +++ b/drivers/mmc/pci_mmc.c
> @@ -52,9 +52,11 @@ static int pci_mmc_probe(struct udevice *dev)
>
> static int pci_mmc_ofdata_to_platdata(struct udevice *dev)
> {
> - struct pci_mmc_priv *priv = dev_get_priv(dev);
> + if (CONFIG_IS_ENABLED(DM_GPIO)) {
> + struct pci_mmc_priv *priv = dev_get_priv(dev);
>
> - gpio_request_by_name(dev, "cd-gpios", 0, &priv->cd_gpio, GPIOD_IS_IN);
> + gpio_request_by_name(dev, "cd-gpios", 0, &priv->cd_gpio, GPIOD_IS_IN);
> + }
This should work OK since priv is cleared to zeroes on init
Reviewed-by: Simon Glass <sjg@chromium.org>
>
> return 0;
> }
> --
> 2.29.2
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 3/3] mmc: Only retrieve cd pin when GPIO is enabled
2020-11-06 12:20 ` [PATCH v2 " Harm Berntsen
2020-11-06 18:50 ` Simon Glass
@ 2021-01-19 13:03 ` Tom Rini
1 sibling, 0 replies; 5+ messages in thread
From: Tom Rini @ 2021-01-19 13:03 UTC (permalink / raw)
To: u-boot
On Fri, Nov 06, 2020 at 12:20:44PM +0000, Harm Berntsen wrote:
> The driver only needs to retrieve the pin for the ACPI info. The driver
> itself works without depending on GPIO.
>
> Signed-off-by: Harm Berntsen <harm.berntsen@nedap.com>
> CC: Simon Glass <sjg@chromium.org>
> Reviewed-by: Simon Glass <sjg@chromium.org>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210119/e6518494/attachment.sig>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-01-19 13:03 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-30 8:45 [PATCH 3/3] mmc: Only retrieve cd pin when GPIO is enabled Harm Berntsen
2020-11-03 15:12 ` Simon Glass
2020-11-06 12:20 ` [PATCH v2 " Harm Berntsen
2020-11-06 18:50 ` Simon Glass
2021-01-19 13:03 ` Tom Rini
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.