[PATCH] net/fec: fix compile error introduced by dt support
Shawn Guo
shawn.guo at linaro.org
Fri Mar 25 18:13:58 EST 2011
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
This patch is to fix the error.
Signed-off-by: Shawn Guo <shawn.guo at 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
More information about the devicetree-discuss
mailing list