On Fri, Mar 25, 2011 at 03:13:58PM +0800, Shawn Guo wrote:
> After fec dt support is added, the following compile error will be
> seen when building a pure non-dt kernel.
> 
> drivers/net/fec.c: In function ‘fec_probe’:
> drivers/net/fec.c:1383: error: implicit declaration of function 
> ‘of_match_device’
> drivers/net/fec.c:1383: warning: assignment makes pointer from integer 
> without a cast

Earlier today I suggested fixing this by adding an empty
implementation of of_match_device, but I forgot that an .of_match
pointer has been added to struct device for exactly this purpose.  You
can use that instead.

That change is currently in mainline, but it has not been backported
to the Linaro 2.6.38 tree (yet).

g.

> 
> This patch is to fix the error.
> 
> Signed-off-by: Shawn Guo <shawn....@linaro.org>
> ---
>  drivers/net/fec.c |   13 ++++++++++++-
>  1 files changed, 12 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/net/fec.c b/drivers/net/fec.c
> index b57f879..ffb1e75 100644
> --- a/drivers/net/fec.c
> +++ b/drivers/net/fec.c
> @@ -85,8 +85,19 @@ static const struct of_device_id fec_dt_ids[] = {
>       { .compatible = "fsl,imx51-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];
> @@ -1380,7 +1391,7 @@ fec_probe(struct platform_device *pdev)
>       struct resource *r;
>       const struct of_device_id *of_id;
>  
> -     of_id = of_match_device(fec_dt_ids, &pdev->dev);
> +     of_id = fec_get_of_device_id(pdev);
>       if (of_id)
>               pdev->id_entry = (struct platform_device_id *)of_id->data;
>  
> -- 
> 1.7.1
> 
> 
> _______________________________________________
> linaro-dev mailing list
> linaro-dev@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/linaro-dev

_______________________________________________
linaro-dev mailing list
linaro-dev@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-dev

Reply via email to