[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BANLkTinbPGMyBxK+zo6ZtFhisSSkU7daYA@mail.gmail.com>
Date: Sun, 19 Jun 2011 12:43:30 -0600
From: Grant Likely <grant.likely@...retlab.ca>
To: Rob Herring <robherring2@...il.com>
Cc: Arnd Bergmann <arnd@...db.de>, Shawn Guo <shawn.guo@...aro.org>,
linux-arm-kernel@...ts.infradead.org,
Greg Ungerer <gerg@...pgear.com>, patches@...aro.org,
netdev@...r.kernel.org, devicetree-discuss@...ts.ozlabs.org,
Jason Liu <jason.hui@...aro.org>, linux-kernel@...r.kernel.org,
"David S. Miller" <davem@...emloft.net>
Subject: Re: [PATCH 2/3] net/fec: add device tree support
On Sun, Jun 19, 2011 at 9:09 AM, Rob Herring <robherring2@...il.com> wrote:
> On 06/19/2011 07:11 AM, Arnd Bergmann wrote:
>> On Sunday 19 June 2011 13:39:32 Greg Ungerer wrote:
>>>> +#ifdef CONFIG_OF
>>>> +static const struct of_device_id fec_dt_ids[] = {
>>>> + { .compatible = "fsl,fec", .data =&fec_devtype[0], },
>>>> + {},
>>>> +};
>>>> +
>>>> +static const struct of_device_id *
>>>> +fec_get_of_device_id(struct platform_device *pdev)
>>>> +{
>>>> + return of_match_device(fec_dt_ids,&pdev->dev);
>>>> +}
>>>> +#else
>>>> +#define fec_dt_ids NULL
>>>> +static inline struct of_device_id *
>>>> +fec_get_of_device_id(struct platform_device *pdev)
>>>> +{
>>>> + return NULL;
>>>> +}
>>>> +#endif
>>>> +
>>>> static unsigned char macaddr[ETH_ALEN];
>>>> module_param_array(macaddr, byte, NULL, 0);
>>>> MODULE_PARM_DESC(macaddr, "FEC Ethernet MAC address");
>>>> @@ -1363,6 +1385,11 @@ fec_probe(struct platform_device *pdev)
>>>> struct net_device *ndev;
>>>> int i, irq, ret = 0;
>>>> struct resource *r;
>>>> + const struct of_device_id *of_id;
>>>> +
>>>> + of_id = fec_get_of_device_id(pdev);
>>>
>>> fec_get_of_device_id() is defined inside of "#ifdef CONFIG_OF". This
>>> use of it will break compilation when this is not defined.
>>>
>>
>>
>> Why? Note the #else path defining an empty function.
>>
>
> None of this is necessary in the first place. Just call of_match_device
> directly. There is already an empty function to return NULL when
> CONFIG_OF is not defined.
Heh, right you are. I should have caught on to that. :-)
g.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists