diff mbox series

[3/3] mmc: Only retrieve cd pin when GPIO is enabled

Message ID f5807f4cdc2271a2c9cffcce955d6a32ccd31d07.camel@nedap.com
State Superseded
Delegated to: Tom Rini
Headers show
Series mmc support for QEMU | expand

Commit Message

Harm Berntsen Oct. 30, 2020, 8:45 a.m. UTC
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(+)

Comments

Simon Glass Nov. 3, 2020, 3:12 p.m. UTC | #1
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
diff mbox series

Patch

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;
 }