From: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Cc: Hauke Mehrtens <hauke-5/S+JYg5SzeELgA04lAiVw@public.gmane.org>,
linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-mips-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org,
zajec5-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Subject: Re: [RFC 6/7] bcma: get sprom from devicetree
Date: Mon, 25 Aug 2014 10:04:33 +0200 [thread overview]
Message-ID: <4882662.VtlSfZ0rSN@wuerfel> (raw)
In-Reply-To: <1408915485-8078-8-git-send-email-hauke-5/S+JYg5SzeELgA04lAiVw@public.gmane.org>
On Sunday 24 August 2014 23:24:44 Hauke Mehrtens wrote:
> +#ifdef CONFIG_OF
> +static int bcma_fill_sprom_with_dt(struct bcma_bus *bus,
> + struct ssb_sprom *out)
> +{
> + const __be32 *handle;
> + struct device_node *sprom_node;
> + struct platform_device *sprom_dev;
> + struct ssb_sprom *sprom;
> +
> + if (!bus->host_pdev || !bus->host_pdev->dev.of_node)
> + return -ENOENT;
You can remove the #ifdef above if you change this into
if (!IS_ENABLED(CONFIG_OF) || !bus->host_pdev ||
!bus->host_pdev->dev.of_node)
return -ENOENT;
> + handle = of_get_property(bus->host_pdev->dev.of_node, "sprom", NULL);
> + if (!handle)
> + return -ENOENT;
> +
> + sprom_node = of_find_node_by_phandle(be32_to_cpup(handle));
> + if (!sprom_node)
> + return -ENOENT;
> +
> + sprom_dev = of_find_device_by_node(sprom_node);
> + if (!sprom_dev)
> + return -ENOENT;
> +
> + sprom = platform_get_drvdata(sprom_dev);
> + if (!sprom)
> + return -ENOENT;
> +
> + memcpy(out, sprom, sizeof(*out));
> +
> + return 0;
> +}
missing of_node_put().
Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2014-08-25 8:04 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-24 21:24 [RFC 0/7] bcma: add device tree support Hauke Mehrtens
[not found] ` <1408915485-8078-1-git-send-email-hauke-5/S+JYg5SzeELgA04lAiVw@public.gmane.org>
2014-08-24 21:24 ` Hauke Mehrtens
2014-08-24 21:24 ` [RFC 1/7] MIPS: BCM47XX: move the nvram header file into common space Hauke Mehrtens
2014-08-24 21:24 ` [RFC 2/7] bcm47xx-nvram: add new broadcom nvram driver with dt support Hauke Mehrtens
[not found] ` <1408915485-8078-4-git-send-email-hauke-5/S+JYg5SzeELgA04lAiVw@public.gmane.org>
2014-08-24 21:45 ` Rafał Miłecki
2014-08-27 5:54 ` Rafał Miłecki
2014-08-27 18:20 ` Florian Fainelli
[not found] ` <53FE217B.7000401-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-08-27 18:43 ` Rafał Miłecki
2014-08-24 21:24 ` [RFC 3/7] bcm47xx-sprom: add Broadcom sprom parser driver Hauke Mehrtens
[not found] ` <1408915485-8078-5-git-send-email-hauke-5/S+JYg5SzeELgA04lAiVw@public.gmane.org>
2014-08-25 7:52 ` Arnd Bergmann
2014-08-25 15:01 ` Jonas Gorski
2014-08-26 21:32 ` Hauke Mehrtens
[not found] ` <53FCFCF0.2010704-5/S+JYg5SzeELgA04lAiVw@public.gmane.org>
2014-09-01 9:24 ` Rafał Miłecki
2014-08-24 21:24 ` [RFC 4/7] bcma: register bcma as device tree driver Hauke Mehrtens
[not found] ` <1408915485-8078-6-git-send-email-hauke-5/S+JYg5SzeELgA04lAiVw@public.gmane.org>
2014-08-25 7:57 ` Arnd Bergmann
2014-08-26 21:25 ` Hauke Mehrtens
2014-08-24 21:24 ` [RFC 5/7] bcma: get IRQ numbers from dt Hauke Mehrtens
[not found] ` <1408915485-8078-7-git-send-email-hauke-5/S+JYg5SzeELgA04lAiVw@public.gmane.org>
2014-08-25 8:00 ` Arnd Bergmann
2014-08-24 21:24 ` [RFC 6/7] bcma: get sprom from devicetree Hauke Mehrtens
[not found] ` <1408915485-8078-8-git-send-email-hauke-5/S+JYg5SzeELgA04lAiVw@public.gmane.org>
2014-08-25 8:04 ` Arnd Bergmann [this message]
2014-08-24 21:24 ` [RFC 7/7] ARM: BCM5301X: register bcma bus Hauke Mehrtens
[not found] ` <1408915485-8078-9-git-send-email-hauke-5/S+JYg5SzeELgA04lAiVw@public.gmane.org>
2014-08-27 18:22 ` Florian Fainelli
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=4882662.VtlSfZ0rSN@wuerfel \
--to=arnd-r2ngtmty4d4@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=hauke-5/S+JYg5SzeELgA04lAiVw@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-mips-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org \
--cc=linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=zajec5-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
/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).