Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Paul Burton <paul.burton@imgtec.com>
Cc: netdev@vger.kernel.org, "David S . Miller" <davem@davemloft.net>,
	linux-mips@linux-mips.org, Eric Dumazet <edumazet@google.com>,
	Jarod Wilson <jarod@redhat.com>,
	Tobias Klauser <tklauser@distanz.ch>
Subject: Re: [PATCH v4 4/7] net: pch_gbe: Add device tree support
Date: Mon, 5 Jun 2017 20:54:51 +0200	[thread overview]
Message-ID: <20170605185451.GE5235@lunn.ch> (raw)
In-Reply-To: <20170605173136.10795-5-paul.burton@imgtec.com>

> +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

  parent reply	other threads:[~2017-06-05 18:55 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-02 23:40 [PATCH v3 0/7] net: pch_gbe: Fixes & MIPS support Paul Burton
2017-06-02 23:40 ` Paul Burton
2017-06-02 23:40 ` [PATCH v3 1/7] net: pch_gbe: Mark Minnow PHY reset GPIO active low Paul Burton
2017-06-02 23:40   ` Paul Burton
2017-06-02 23:40 ` [PATCH v3 2/7] net: pch_gbe: Pull PHY GPIO handling out of Minnow code Paul Burton
2017-06-02 23:40   ` Paul Burton
2017-06-03 17:52   ` Andrew Lunn
2017-06-05 17:21     ` Paul Burton
2017-06-05 17:21       ` Paul Burton
2017-06-05 18:43       ` Andrew Lunn
2017-06-02 23:40 ` [PATCH v3 3/7] dt-bindings: net: Document Intel pch_gbe binding Paul Burton
2017-06-02 23:40   ` Paul Burton
2017-06-02 23:40 ` [PATCH v3 4/7] net: pch_gbe: Add device tree support Paul Burton
2017-06-02 23:40   ` Paul Burton
2017-06-03  6:36   ` [PATCH] net: pch_gbe: fix err_cast.cocci warnings kbuild test robot
2017-06-03  6:36     ` kbuild test robot
2017-06-03  6:36   ` [PATCH v3 4/7] net: pch_gbe: Add device tree support kbuild test robot
2017-06-03  6:36     ` kbuild test robot
2017-06-02 23:40 ` [PATCH v3 5/7] net: pch_gbe: Always reset PHY along with MAC Paul Burton
2017-06-02 23:40   ` Paul Burton
2017-06-02 23:40 ` [PATCH v3 6/7] net: pch_gbe: Allow longer for resets Paul Burton
2017-06-02 23:40   ` Paul Burton
2017-06-06 14:10   ` Marcin Nowakowski
2017-06-06 14:10     ` Marcin Nowakowski
2017-06-02 23:40 ` [PATCH v3 7/7] net: pch_gbe: Allow build on MIPS platforms Paul Burton
2017-06-02 23:40   ` Paul Burton
2017-06-05 17:31 ` [PATCH v4 0/7] net: pch_gbe: Fixes & MIPS support Paul Burton
2017-06-05 17:31   ` Paul Burton
2017-06-05 17:31   ` [PATCH v4 1/7] net: pch_gbe: Mark Minnow PHY reset GPIO active low Paul Burton
2017-06-05 17:31     ` Paul Burton
2017-06-05 17:31   ` [PATCH v4 2/7] net: pch_gbe: Pull PHY GPIO handling out of Minnow code Paul Burton
2017-06-05 17:31     ` Paul Burton
2017-06-05 18:55     ` Andrew Lunn
2017-06-05 17:31   ` [PATCH v4 3/7] dt-bindings: net: Document Intel pch_gbe binding Paul Burton
2017-06-05 17:31     ` Paul Burton
2017-06-05 18:45     ` Sergei Shtylyov
2017-06-09 13:21     ` Rob Herring
2017-06-05 17:31   ` [PATCH v4 4/7] net: pch_gbe: Add device tree support Paul Burton
2017-06-05 17:31     ` Paul Burton
2017-06-05 18:54     ` Andrew Lunn [this message]
2017-06-05 17:31   ` [PATCH v4 5/7] net: pch_gbe: Always reset PHY along with MAC Paul Burton
2017-06-05 17:31     ` Paul Burton
2017-06-05 17:31   ` [PATCH v4 6/7] net: pch_gbe: Allow longer for resets Paul Burton
2017-06-05 17:31     ` Paul Burton
2017-06-05 17:31   ` [PATCH v4 7/7] net: pch_gbe: Allow build on MIPS platforms Paul Burton
2017-06-05 17:31     ` Paul Burton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170605185451.GE5235@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jarod@redhat.com \
    --cc=linux-mips@linux-mips.org \
    --cc=netdev@vger.kernel.org \
    --cc=paul.burton@imgtec.com \
    --cc=tklauser@distanz.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox