Module: xenomai-head
Branch: master
Commit: d22fd231db7eb0af8e77ec570efb89e578e13781
URL:    
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=d22fd231db7eb0af8e77ec570efb89e578e13781

Author: Gilles Chanteperdrix <[email protected]>
Date:   Tue Sep 27 23:58:02 2011 +0200

rtcan: fix compilation of mscan on ppc52xx with linux 3.0

---

 include/asm-powerpc/wrappers.h               |    6 ++++++
 ksrc/drivers/can/mscan/rtcan_mscan_mpc5xxx.c |   15 ++++++++++++++-
 2 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/include/asm-powerpc/wrappers.h b/include/asm-powerpc/wrappers.h
index 7437f31..15dda13 100644
--- a/include/asm-powerpc/wrappers.h
+++ b/include/asm-powerpc/wrappers.h
@@ -198,4 +198,10 @@ typedef irq_handler_t rthal_irq_host_handler_t;
 #define of_device platform_device
 #endif
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0)
+#define of_platform_driver platform_driver
+#define of_register_platform_driver platform_driver_register
+#define of_unregister_platform_driver platform_driver_unregister
+#endif
+
 #endif /* _XENO_ASM_POWERPC_WRAPPERS_H */
diff --git a/ksrc/drivers/can/mscan/rtcan_mscan_mpc5xxx.c 
b/ksrc/drivers/can/mscan/rtcan_mscan_mpc5xxx.c
index d1d0e63..82aea37 100644
--- a/ksrc/drivers/can/mscan/rtcan_mscan_mpc5xxx.c
+++ b/ksrc/drivers/can/mscan/rtcan_mscan_mpc5xxx.c
@@ -250,16 +250,29 @@ static u32 __devinit mpc512x_can_get_clock(struct 
of_device *ofdev,
 }
 #endif /* CONFIG_PPC_MPC512x */
 
+static struct of_device_id mpc5xxx_can_table[];
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0)
 static int __devinit mpc5xxx_can_probe(struct of_device *ofdev,
                                       const struct of_device_id *id)
+#else /* Linux >= 3.0 */
+static int __devinit mpc5xxx_can_probe(struct of_device *ofdev)
+#endif /* Linux >= 3.0 */
 {
-       struct mpc5xxx_can_data *data = (struct mpc5xxx_can_data *)id->data;
        struct device_node *np = mpc5xxx_get_of_node(ofdev);
+       struct mpc5xxx_can_data *data;
        struct rtcan_device *dev;
        void __iomem *base;
        const char *clock_name = NULL;
        int irq, mscan_clksrc = 0;
        int err = -ENOMEM;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0)
+       const struct of_device_id *id;
+
+       id = of_match_device(mpc5xxx_can_table, &ofdev->dev);
+       if (!id)
+               return -EINVAL;
+#endif /* Linux >= 3.0 */
+       data = (struct mpc5xxx_can_data *)id->data;
 
        base = of_iomap(np, 0);
        if (!base) {


_______________________________________________
Xenomai-git mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-git

Reply via email to