diff mbox series

[03/10] rtc: armada38x: Use of_device_get_match_data()

Message ID 20191004214334.149976-4-swboyd@chromium.org
State Not Applicable
Headers show
Series Stop NULLifying match pointer in of_match_device() | expand

Commit Message

Stephen Boyd Oct. 4, 2019, 9:43 p.m. UTC
Use the more modern API to get the match data out of the of match table.
This saves some code, lines, and nicely avoids referencing the match
table when it is undefined with configurations where CONFIG_OF=n.

Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Gregory Clement <gregory.clement@bootlin.com>
Cc: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Frank Rowand <frowand.list@gmail.com>
Cc: <linux-rtc@vger.kernel.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---

Please ack or pick for immediate merge so the last patch can be merged.

 drivers/rtc/rtc-armada38x.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

Comments

Alexandre Belloni Oct. 7, 2019, 1:53 p.m. UTC | #1
On 04/10/2019 14:43:27-0700, Stephen Boyd wrote:
> Use the more modern API to get the match data out of the of match table.
> This saves some code, lines, and nicely avoids referencing the match
> table when it is undefined with configurations where CONFIG_OF=n.
> 
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: Jason Cooper <jason@lakedaemon.net>
> Cc: Andrew Lunn <andrew@lunn.ch>
> Cc: Gregory Clement <gregory.clement@bootlin.com>
> Cc: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
> Cc: Alessandro Zummo <a.zummo@towertech.it>
> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Frank Rowand <frowand.list@gmail.com>
> Cc: <linux-rtc@vger.kernel.org>
> Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

> ---
> 
> Please ack or pick for immediate merge so the last patch can be merged.
> 
>  drivers/rtc/rtc-armada38x.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-armada38x.c b/drivers/rtc/rtc-armada38x.c
> index 9351bd52477e..94d7c22fc4f3 100644
> --- a/drivers/rtc/rtc-armada38x.c
> +++ b/drivers/rtc/rtc-armada38x.c
> @@ -74,7 +74,7 @@ struct armada38x_rtc {
>  	int		    irq;
>  	bool		    initialized;
>  	struct value_to_freq *val_to_freq;
> -	struct armada38x_rtc_data *data;
> +	const struct armada38x_rtc_data *data;
>  };
>  
>  #define ALARM1	0
> @@ -501,17 +501,14 @@ static __init int armada38x_rtc_probe(struct platform_device *pdev)
>  {
>  	struct resource *res;
>  	struct armada38x_rtc *rtc;
> -	const struct of_device_id *match;
> -
> -	match = of_match_device(armada38x_rtc_of_match_table, &pdev->dev);
> -	if (!match)
> -		return -ENODEV;
>  
>  	rtc = devm_kzalloc(&pdev->dev, sizeof(struct armada38x_rtc),
>  			    GFP_KERNEL);
>  	if (!rtc)
>  		return -ENOMEM;
>  
> +	rtc->data = of_device_get_match_data(&pdev->dev);
> +
>  	rtc->val_to_freq = devm_kcalloc(&pdev->dev, SAMPLE_NR,
>  				sizeof(struct value_to_freq), GFP_KERNEL);
>  	if (!rtc->val_to_freq)
> @@ -553,7 +550,6 @@ static __init int armada38x_rtc_probe(struct platform_device *pdev)
>  		 */
>  		rtc->rtc_dev->ops = &armada38x_rtc_ops_noirq;
>  	}
> -	rtc->data = (struct armada38x_rtc_data *)match->data;
>  
>  	/* Update RTC-MBUS bridge timing parameters */
>  	rtc->data->update_mbus_timing(rtc);
> -- 
> Sent by a computer through tubes
>
diff mbox series

Patch

diff --git a/drivers/rtc/rtc-armada38x.c b/drivers/rtc/rtc-armada38x.c
index 9351bd52477e..94d7c22fc4f3 100644
--- a/drivers/rtc/rtc-armada38x.c
+++ b/drivers/rtc/rtc-armada38x.c
@@ -74,7 +74,7 @@  struct armada38x_rtc {
 	int		    irq;
 	bool		    initialized;
 	struct value_to_freq *val_to_freq;
-	struct armada38x_rtc_data *data;
+	const struct armada38x_rtc_data *data;
 };
 
 #define ALARM1	0
@@ -501,17 +501,14 @@  static __init int armada38x_rtc_probe(struct platform_device *pdev)
 {
 	struct resource *res;
 	struct armada38x_rtc *rtc;
-	const struct of_device_id *match;
-
-	match = of_match_device(armada38x_rtc_of_match_table, &pdev->dev);
-	if (!match)
-		return -ENODEV;
 
 	rtc = devm_kzalloc(&pdev->dev, sizeof(struct armada38x_rtc),
 			    GFP_KERNEL);
 	if (!rtc)
 		return -ENOMEM;
 
+	rtc->data = of_device_get_match_data(&pdev->dev);
+
 	rtc->val_to_freq = devm_kcalloc(&pdev->dev, SAMPLE_NR,
 				sizeof(struct value_to_freq), GFP_KERNEL);
 	if (!rtc->val_to_freq)
@@ -553,7 +550,6 @@  static __init int armada38x_rtc_probe(struct platform_device *pdev)
 		 */
 		rtc->rtc_dev->ops = &armada38x_rtc_ops_noirq;
 	}
-	rtc->data = (struct armada38x_rtc_data *)match->data;
 
 	/* Update RTC-MBUS bridge timing parameters */
 	rtc->data->update_mbus_timing(rtc);