lkml.org 
[lkml]   [2011]   [Jun]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 2/3] net/fec: add device tree support
    On 19/06/11 22:11, 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.

    Sorry, missed that :-)

    Regards
    Greg


    ------------------------------------------------------------------------
    Greg Ungerer -- Principal Engineer EMAIL: gerg@snapgear.com
    SnapGear Group, McAfee PHONE: +61 7 3435 2888
    8 Gardner Close FAX: +61 7 3217 5323
    Milton, QLD, 4064, Australia WEB: http://www.SnapGear.com


    \
     
     \ /
      Last update: 2011-06-20 02:09    [W:2.883 / U:0.016 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site