diff options
author | Wolfram Sang <wsa+renesas@sang-engineering.com> | 2018-04-19 10:06:14 -0400 |
---|---|---|
committer | Alexandre Belloni <alexandre.belloni@bootlin.com> | 2018-05-03 16:08:00 -0400 |
commit | 85368bb9de6366654f442e26fdd571981f205291 (patch) | |
tree | 807385ec3a590efc12b24fe22b3ee7f8fd204e0f /drivers/rtc/rtc-sh.c | |
parent | 36d91a4d401c284ab21213622c85cd855725f10f (diff) |
rtc: simplify getting .drvdata
We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: Michal Simek <michal.simek@xilinx.com> (for zynqmp)
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Diffstat (limited to 'drivers/rtc/rtc-sh.c')
-rw-r--r-- | drivers/rtc/rtc-sh.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/rtc/rtc-sh.c b/drivers/rtc/rtc-sh.c index 4e8ab370ce63..4f98543d1ea5 100644 --- a/drivers/rtc/rtc-sh.c +++ b/drivers/rtc/rtc-sh.c | |||
@@ -359,8 +359,7 @@ static int sh_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) | |||
359 | 359 | ||
360 | static int sh_rtc_read_time(struct device *dev, struct rtc_time *tm) | 360 | static int sh_rtc_read_time(struct device *dev, struct rtc_time *tm) |
361 | { | 361 | { |
362 | struct platform_device *pdev = to_platform_device(dev); | 362 | struct sh_rtc *rtc = dev_get_drvdata(dev); |
363 | struct sh_rtc *rtc = platform_get_drvdata(pdev); | ||
364 | unsigned int sec128, sec2, yr, yr100, cf_bit; | 363 | unsigned int sec128, sec2, yr, yr100, cf_bit; |
365 | 364 | ||
366 | do { | 365 | do { |
@@ -419,8 +418,7 @@ static int sh_rtc_read_time(struct device *dev, struct rtc_time *tm) | |||
419 | 418 | ||
420 | static int sh_rtc_set_time(struct device *dev, struct rtc_time *tm) | 419 | static int sh_rtc_set_time(struct device *dev, struct rtc_time *tm) |
421 | { | 420 | { |
422 | struct platform_device *pdev = to_platform_device(dev); | 421 | struct sh_rtc *rtc = dev_get_drvdata(dev); |
423 | struct sh_rtc *rtc = platform_get_drvdata(pdev); | ||
424 | unsigned int tmp; | 422 | unsigned int tmp; |
425 | int year; | 423 | int year; |
426 | 424 | ||
@@ -475,8 +473,7 @@ static inline int sh_rtc_read_alarm_value(struct sh_rtc *rtc, int reg_off) | |||
475 | 473 | ||
476 | static int sh_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *wkalrm) | 474 | static int sh_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *wkalrm) |
477 | { | 475 | { |
478 | struct platform_device *pdev = to_platform_device(dev); | 476 | struct sh_rtc *rtc = dev_get_drvdata(dev); |
479 | struct sh_rtc *rtc = platform_get_drvdata(pdev); | ||
480 | struct rtc_time *tm = &wkalrm->time; | 477 | struct rtc_time *tm = &wkalrm->time; |
481 | 478 | ||
482 | spin_lock_irq(&rtc->lock); | 479 | spin_lock_irq(&rtc->lock); |
@@ -509,8 +506,7 @@ static inline void sh_rtc_write_alarm_value(struct sh_rtc *rtc, | |||
509 | 506 | ||
510 | static int sh_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *wkalrm) | 507 | static int sh_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *wkalrm) |
511 | { | 508 | { |
512 | struct platform_device *pdev = to_platform_device(dev); | 509 | struct sh_rtc *rtc = dev_get_drvdata(dev); |
513 | struct sh_rtc *rtc = platform_get_drvdata(pdev); | ||
514 | unsigned int rcr1; | 510 | unsigned int rcr1; |
515 | struct rtc_time *tm = &wkalrm->time; | 511 | struct rtc_time *tm = &wkalrm->time; |
516 | int mon; | 512 | int mon; |
@@ -723,8 +719,7 @@ static int __exit sh_rtc_remove(struct platform_device *pdev) | |||
723 | 719 | ||
724 | static void sh_rtc_set_irq_wake(struct device *dev, int enabled) | 720 | static void sh_rtc_set_irq_wake(struct device *dev, int enabled) |
725 | { | 721 | { |
726 | struct platform_device *pdev = to_platform_device(dev); | 722 | struct sh_rtc *rtc = dev_get_drvdata(dev); |
727 | struct sh_rtc *rtc = platform_get_drvdata(pdev); | ||
728 | 723 | ||
729 | irq_set_irq_wake(rtc->periodic_irq, enabled); | 724 | irq_set_irq_wake(rtc->periodic_irq, enabled); |
730 | 725 | ||