[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170605185451.GE5235@lunn.ch>
Date: Mon, 5 Jun 2017 20:54:51 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Paul Burton <paul.burton@...tec.com>
Cc: netdev@...r.kernel.org, "David S . Miller" <davem@...emloft.net>,
linux-mips@...ux-mips.org, Eric Dumazet <edumazet@...gle.com>,
Jarod Wilson <jarod@...hat.com>,
Tobias Klauser <tklauser@...tanz.ch>
Subject: Re: [PATCH v4 4/7] net: pch_gbe: Add device tree support
> +static struct pch_gbe_privdata *
> +pch_gbe_get_priv(struct pci_dev *pdev, const struct pci_device_id *pci_id)
> +{
> + struct pch_gbe_privdata *pdata;
> + struct gpio_desc *gpio;
> +
> + if (!IS_ENABLED(CONFIG_OF))
> + return (struct pch_gbe_privdata *)pci_id->driver_data;
It is possible to enable CONFIG_OF on all architectures, including x86
used by Minnow. If somebody was to do this, i think Minnow breaks. What
i think you really want is:
if pci_id->driver_data;
return (struct pch_gbe_privdata *)pci_id->driver_data;
> +
> + pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
> + if (!pdata)
> + return ERR_PTR(-ENOMEM);
> +
> + gpio = devm_gpiod_get(&pdev->dev, "phy-reset", GPIOD_ASIS);
> + if (!IS_ERR(gpio))
> + pdata->phy_reset_gpio = gpio;
> + else if (PTR_ERR(gpio) != -ENOENT)
> + return ERR_CAST(gpio);
> +
> + return pdata;
> +}
There should not be a need to protect for !CONFIG_OF, and
devm_gpiod_get() knows how to look in ACPI tables, if an intel or
ARM64 platform it using that to list its GPIOs.
Andrew
Powered by blists - more mailing lists