Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drivers/rtc/rtc-ds1742.c: add devicetree support

This patch allows the driver to be enabled with devicetree.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Alexander Shiyan and committed by
Linus Torvalds
663b3524 1b3d2243

+21 -1
+12
Documentation/devicetree/bindings/rtc/maxim,ds1742.txt
··· 1 + * Maxim (Dallas) DS1742/DS1743 Real Time Clock 2 + 3 + Required properties: 4 + - compatible: Should contain "maxim,ds1742". 5 + - reg: Physical base address of the RTC and length of memory 6 + mapped region. 7 + 8 + Example: 9 + rtc: rtc@10000000 { 10 + compatible = "maxim,ds1742"; 11 + reg = <0x10000000 0x800>; 12 + };
+9 -1
drivers/rtc/rtc-ds1742.c
··· 13 13 */ 14 14 15 15 #include <linux/bcd.h> 16 - #include <linux/init.h> 17 16 #include <linux/kernel.h> 18 17 #include <linux/gfp.h> 19 18 #include <linux/delay.h> 20 19 #include <linux/jiffies.h> 21 20 #include <linux/rtc.h> 21 + #include <linux/of.h> 22 + #include <linux/of_device.h> 22 23 #include <linux/platform_device.h> 23 24 #include <linux/io.h> 24 25 #include <linux/module.h> ··· 216 215 return 0; 217 216 } 218 217 218 + static struct of_device_id __maybe_unused ds1742_rtc_of_match[] = { 219 + { .compatible = "maxim,ds1742", }, 220 + { } 221 + }; 222 + MODULE_DEVICE_TABLE(of, ds1742_rtc_of_match); 223 + 219 224 static struct platform_driver ds1742_rtc_driver = { 220 225 .probe = ds1742_rtc_probe, 221 226 .remove = ds1742_rtc_remove, 222 227 .driver = { 223 228 .name = "rtc-ds1742", 224 229 .owner = THIS_MODULE, 230 + .of_match_table = of_match_ptr(ds1742_rtc_of_match), 225 231 }, 226 232 }; 227 233