mmc: Only retrieve cd pin when GPIO is enabled
PATCH 3/3 mmc: Only retrieve cd pin when GPIO is enabled
The driver only needs to retrieve the pin for the ACPI info. The driver itself works without depending on GPIO.
---
?drivers/mmc/pci_mmc.c | 2 ++
?1 file changed, 2 insertions(+)
drivers/mmc/pci_mmc.c +0 -0
@@ -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;
?}
PATCH 3/3 mmc: Only retrieve cd pin when GPIO is enabled
Hi Harm,
Quoted 17 lines · Harm Berntsen
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 <[email protected]>CC Simon Glass <[email protected]>---
drivers/mmc/pci_mmc.c | 2 ++ 1 file changed, 2 insertions(+)drivers/mmc/pci_mmc.c +0
-0
drivers/mmc/pci_mmc.c static int pci_mmc_probe(struct udevice *dev) · line 55
Quoted 4 lines
drivers/mmc/pci_mmc.c +1
-0@@ -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.
drivers/mmc/pci_mmc.c static int pci_mmc_probe(struct udevice *dev) · line 62
Quoted 8 lines
drivers/mmc/pci_mmc.c +1
-0struct 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
PATCH v2 3/3 mmc: Only retrieve cd pin when GPIO is enabled
The driver only needs to retrieve the pin for the ACPI info. The driver itself works without depending on GPIO.
---
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(-)
drivers/mmc/pci_mmc.c +4 -2
@@ -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 ; }
Signature · 1 line
2.29.2
PATCH v2 3/3 mmc: Only retrieve cd pin when GPIO is enabled
Hi Harm,
Quoted 18 lines · Harm Berntsen
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 <[email protected]>CC Simon Glass <[email protected]>---
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(-)drivers/mmc/pci_mmc.c +0
-0
drivers/mmc/pci_mmc.c static int pci_mmc_probe(struct udevice *dev) · line 59
Quoted 10 lines
drivers/mmc/pci_mmc.c +4
-2@@ -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
Quoted 7 lines
drivers/mmc/pci_mmc.c +0
-1return 0 ; } --2.29.2
PATCH v2 3/3 mmc: Only retrieve cd pin when GPIO is enabled
In reply to Harm BerntsenQuoted 6 lines · Harm Berntsen
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 <[email protected]>CC Simon Glass <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
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>