diff mbox series

[29/43] rtc: m48t86: add DT support for m48t86

Message ID 20230424123522.18302-30-nikita.shubin@maquefel.me
State Changes Requested
Headers show
Series ep93xx device tree conversion | expand

Commit Message

Nikita Shubin April 24, 2023, 12:34 p.m. UTC
- get regs from device tree

Signed-off-by: Nikita Shubin <nikita.shubin@maquefel.me>
---
 drivers/rtc/rtc-m48t86.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Nikita Shubin April 28, 2023, 2:31 p.m. UTC | #1
On Wed, 2023-04-26 at 16:36 +0300, andy.shevchenko@gmail.com wrote:
> Mon, Apr 24, 2023 at 03:34:45PM +0300, Nikita Shubin kirjoitti:
> > - get regs from device tree
> 
> ...
> 
> > +#include <linux/of.h>
> 
> mod_devicetable.h and drop ugly ifdeffery along with of_match_ptr().
> 
> ...
> 
> > +static const struct of_device_id m48t86_rtc_of_ids[] = {
> > +       { .compatible = "dallas,rtc-m48t86" },
> > +       { /* end of table */ },
> 
> No comma for the terminator entry
> 
> > +};
> 

Thanks you for all your comments and effort!

All will be fixed conforming your comments.
diff mbox series

Patch

diff --git a/drivers/rtc/rtc-m48t86.c b/drivers/rtc/rtc-m48t86.c
index 481c9525b1dd..d65727ac283a 100644
--- a/drivers/rtc/rtc-m48t86.c
+++ b/drivers/rtc/rtc-m48t86.c
@@ -15,6 +15,7 @@ 
 #include <linux/platform_device.h>
 #include <linux/bcd.h>
 #include <linux/io.h>
+#include <linux/of.h>
 
 #define M48T86_SEC		0x00
 #define M48T86_SECALRM		0x01
@@ -269,9 +270,18 @@  static int m48t86_rtc_probe(struct platform_device *pdev)
 	return 0;
 }
 
+#ifdef CONFIG_OF
+static const struct of_device_id m48t86_rtc_of_ids[] = {
+	{ .compatible = "dallas,rtc-m48t86" },
+	{ /* end of table */ },
+};
+MODULE_DEVICE_TABLE(of, m48t86_rtc_of_ids);
+#endif
+
 static struct platform_driver m48t86_rtc_platform_driver = {
 	.driver		= {
 		.name	= "rtc-m48t86",
+		.of_match_table = of_match_ptr(m48t86_rtc_of_ids),
 	},
 	.probe		= m48t86_rtc_probe,
 };