devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sylwester Nawrocki <sylvester.nawrocki@gmail.com>
To: Tomasz Figa <tomasz.figa@gmail.com>
Cc: netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	devicetree-discuss@lists.ozlabs.org,
	Grant Likely <grant.likely@linaro.org>,
	Rob Herring <rob.herring@calxeda.com>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	David Miller <davem@davemloft.net>,
	Francois Romieu <romieu@fr.zoreil.com>
Subject: Re: [PATCH v2] net: dm9000: Allow instantiation using device tree
Date: Sun, 19 May 2013 15:27:53 +0200	[thread overview]
Message-ID: <5198D359.5060608@gmail.com> (raw)
In-Reply-To: <1368962191-32594-1-git-send-email-tomasz.figa@gmail.com>

Hi,

On 05/19/2013 01:16 PM, Tomasz Figa wrote:
> +++ b/Documentation/devicetree/bindings/net/davicom-dm9000.txt
> @@ -0,0 +1,26 @@
> +Davicom DM9000 Fast Ethernet controller
> +
> +Required properties:
> +- compatible = "davicom,dm9000";
> +- reg : physical addresses and sizes of registers, must contain 2 entries:
> +    first entry : address register,
> +    second entry : address register.

Two address registers ? Shouldn't one of these be "data register" ?

> +Example:
> +
> +	ethernet@18000000 {
> +		compatible = "davicom,dm9000";
> +		reg =<0x18000000 0x2 0x18000004 0x2>;
> +		interrupt-parent =<&gpn>;
> +		interrupts =<7 4>;
> +		local-mac-address = [00 00 de ad be ef];
> +		davicom,no-eeprom;
> +	};

> +static struct dm9000_plat_data *dm9000_parse_dt(struct device *dev)
> +{
> +	struct dm9000_plat_data *pdata;
> +	struct device_node *np = dev->of_node;
> +	const void *mac_addr;
> +
> +	if (!IS_ENABLED(CONFIG_OF) || !np)
> +		return NULL;

Shouldn't ERR_PTR() value be returned here ?

> +	pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
> +	if (!pdata) {
> +		dev_err(dev, "failed to allocate platform data struct\n");

There is no need for this error log, k*alloc already logs any failures.

> @@ -1373,6 +1402,12 @@ dm9000_probe(struct platform_device *pdev)
>   	int i;
>   	u32 id_val;
>
> +	if (!pdata) {
> +		pdata = dm9000_parse_dt(&pdev->dev);
> +		if (IS_ERR(pdata))
> +			return PTR_ERR(pdata);
> +	}

Thanks,

Sylwester

  reply	other threads:[~2013-05-19 13:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-19 11:16 [PATCH v2] net: dm9000: Allow instantiation using device tree Tomasz Figa
2013-05-19 13:27 ` Sylwester Nawrocki [this message]
2013-05-19 13:41   ` Tomasz Figa
2013-05-19 17:18     ` Sylwester Nawrocki

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=5198D359.5060608@gmail.com \
    --to=sylvester.nawrocki@gmail.com \
    --cc=davem@davemloft.net \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=grant.likely@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=netdev@vger.kernel.org \
    --cc=rob.herring@calxeda.com \
    --cc=romieu@fr.zoreil.com \
    --cc=s.hauer@pengutronix.de \
    --cc=tomasz.figa@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).