rtc: at91rm9200: use of_device_get_match_data()
authorClaudiu Beznea <claudiu.beznea@microchip.com>
Thu, 26 Sep 2019 12:15:32 +0000 (15:15 +0300)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Thu, 3 Oct 2019 19:50:47 +0000 (21:50 +0200)
Use of_device_get_match_data() since all platforms should now use DT
bindings. AVR32 architecture has been removed in
commit 26202873bb51 ("avr32: remove support for AVR32 architecture").

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Link: https://lore.kernel.org/r/1569500132-21164-1-git-send-email-claudiu.beznea@microchip.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/rtc/Kconfig
drivers/rtc/rtc-at91rm9200.c

index 1adf9f8..7f9fc90 100644 (file)
@@ -1459,6 +1459,7 @@ config RTC_DRV_PL031
 config RTC_DRV_AT91RM9200
        tristate "AT91RM9200 or some AT91SAM9 RTC"
        depends on ARCH_AT91 || COMPILE_TEST
+       depends on OF
        help
          Driver for the internal RTC (Realtime Clock) module found on
          Atmel AT91RM9200's and some  AT91SAM9 chips. On AT91SAM9 chips
index d119c6e..3b833e0 100644 (file)
@@ -319,7 +319,6 @@ static const struct at91_rtc_config at91sam9x5_config = {
        .use_shadow_imr = true,
 };
 
-#ifdef CONFIG_OF
 static const struct of_device_id at91_rtc_dt_ids[] = {
        {
                .compatible = "atmel,at91rm9200-rtc",
@@ -332,22 +331,6 @@ static const struct of_device_id at91_rtc_dt_ids[] = {
        }
 };
 MODULE_DEVICE_TABLE(of, at91_rtc_dt_ids);
-#endif
-
-static const struct at91_rtc_config *
-at91_rtc_get_config(struct platform_device *pdev)
-{
-       const struct of_device_id *match;
-
-       if (pdev->dev.of_node) {
-               match = of_match_node(at91_rtc_dt_ids, pdev->dev.of_node);
-               if (!match)
-                       return NULL;
-               return (const struct at91_rtc_config *)match->data;
-       }
-
-       return &at91rm9200_config;
-}
 
 static const struct rtc_class_ops at91_rtc_ops = {
        .read_time      = at91_rtc_readtime,
@@ -367,7 +350,7 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
        struct resource *regs;
        int ret = 0;
 
-       at91_rtc_config = at91_rtc_get_config(pdev);
+       at91_rtc_config = of_device_get_match_data(&pdev->dev);
        if (!at91_rtc_config)
                return -ENODEV;