drivers/rtc/rtc-em3027.c: add device tree support
authorPeter Robinson <pbrobinson@gmail.com>
Thu, 16 Apr 2015 19:45:07 +0000 (12:45 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 17 Apr 2015 13:03:59 +0000 (09:03 -0400)
Set the of_match_table for this driver so that devices can be described in
the device tree.  This device is used in the Trimslice and is already
defined in the Trimslice device tree.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
Cc: Mike Rapoport <mike@compulab.co.il>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Grant Likely <grant.likely@linaro.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/rtc/rtc-em3027.c

index fccf3669924540d13c3f8a2e9193a671fff8b396..4f4930a2004caa03d899b874b34081cc2d778907 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/rtc.h>
 #include <linux/bcd.h>
 #include <linux/module.h>
+#include <linux/of.h>
 
 /* Registers */
 #define EM3027_REG_ON_OFF_CTRL 0x00
@@ -135,10 +136,20 @@ static struct i2c_device_id em3027_id[] = {
        { "em3027", 0 },
        { }
 };
+MODULE_DEVICE_TABLE(i2c, em3027_id);
+
+#ifdef CONFIG_OF
+static const struct of_device_id em3027_of_match[] = {
+       { .compatible = "emmicro,em3027", },
+       {}
+};
+MODULE_DEVICE_TABLE(of, em3027_of_match);
+#endif
 
 static struct i2c_driver em3027_driver = {
        .driver = {
                   .name = "rtc-em3027",
+                  .of_match_table = of_match_ptr(em3027_of_match),
        },
        .probe = &em3027_probe,
        .id_table = em3027_id,