From mboxrd@z Thu Jan 1 00:00:00 1970 From: Simon Glass Date: Fri, 6 Nov 2020 11:50:31 -0700 Subject: [PATCH v2 3/3] mmc: Only retrieve cd pin when GPIO is enabled In-Reply-To: References: Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Harm, On Fri, 6 Nov 2020 at 05:20, 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 > CC: Simon Glass > --- > 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 > > return 0; > } > -- > 2.29.2 >