diff options
author | Wolfram Sang <wsa+renesas@sang-engineering.com> | 2018-04-19 16:06:14 +0200 |
---|---|---|
committer | Alexandre Belloni <alexandre.belloni@bootlin.com> | 2018-05-03 22:08:00 +0200 |
commit | 85368bb9de6366654f442e26fdd571981f205291 (patch) | |
tree | 807385ec3a590efc12b24fe22b3ee7f8fd204e0f /drivers/rtc/rtc-mxc.c | |
parent | 36d91a4d401c284ab21213622c85cd855725f10f (diff) | |
download | talos-obmc-linux-85368bb9de6366654f442e26fdd571981f205291.tar.gz talos-obmc-linux-85368bb9de6366654f442e26fdd571981f205291.zip |
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-mxc.c')
-rw-r--r-- | drivers/rtc/rtc-mxc.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/drivers/rtc/rtc-mxc.c b/drivers/rtc/rtc-mxc.c index bce427d202ee..822ebe4be3c3 100644 --- a/drivers/rtc/rtc-mxc.c +++ b/drivers/rtc/rtc-mxc.c @@ -109,8 +109,7 @@ static inline int is_imx1_rtc(struct rtc_plat_data *data) */ static time64_t get_alarm_or_time(struct device *dev, int time_alarm) { - struct platform_device *pdev = to_platform_device(dev); - struct rtc_plat_data *pdata = platform_get_drvdata(pdev); + struct rtc_plat_data *pdata = dev_get_drvdata(dev); void __iomem *ioaddr = pdata->ioaddr; u32 day = 0, hr = 0, min = 0, sec = 0, hr_min = 0; @@ -139,8 +138,7 @@ static time64_t get_alarm_or_time(struct device *dev, int time_alarm) static void set_alarm_or_time(struct device *dev, int time_alarm, time64_t time) { u32 tod, day, hr, min, sec, temp; - struct platform_device *pdev = to_platform_device(dev); - struct rtc_plat_data *pdata = platform_get_drvdata(pdev); + struct rtc_plat_data *pdata = dev_get_drvdata(dev); void __iomem *ioaddr = pdata->ioaddr; day = div_s64_rem(time, 86400, &tod); @@ -176,8 +174,7 @@ static void set_alarm_or_time(struct device *dev, int time_alarm, time64_t time) static void rtc_update_alarm(struct device *dev, struct rtc_time *alrm) { time64_t time; - struct platform_device *pdev = to_platform_device(dev); - struct rtc_plat_data *pdata = platform_get_drvdata(pdev); + struct rtc_plat_data *pdata = dev_get_drvdata(dev); void __iomem *ioaddr = pdata->ioaddr; time = rtc_tm_to_time64(alrm); @@ -190,8 +187,7 @@ static void rtc_update_alarm(struct device *dev, struct rtc_time *alrm) static void mxc_rtc_irq_enable(struct device *dev, unsigned int bit, unsigned int enabled) { - struct platform_device *pdev = to_platform_device(dev); - struct rtc_plat_data *pdata = platform_get_drvdata(pdev); + struct rtc_plat_data *pdata = dev_get_drvdata(dev); void __iomem *ioaddr = pdata->ioaddr; u32 reg; @@ -266,8 +262,7 @@ static int mxc_rtc_read_time(struct device *dev, struct rtc_time *tm) */ static int mxc_rtc_set_mmss(struct device *dev, time64_t time) { - struct platform_device *pdev = to_platform_device(dev); - struct rtc_plat_data *pdata = platform_get_drvdata(pdev); + struct rtc_plat_data *pdata = dev_get_drvdata(dev); /* * TTC_DAYR register is 9-bit in MX1 SoC, save time and day of year only @@ -295,8 +290,7 @@ static int mxc_rtc_set_mmss(struct device *dev, time64_t time) */ static int mxc_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) { - struct platform_device *pdev = to_platform_device(dev); - struct rtc_plat_data *pdata = platform_get_drvdata(pdev); + struct rtc_plat_data *pdata = dev_get_drvdata(dev); void __iomem *ioaddr = pdata->ioaddr; rtc_time64_to_tm(get_alarm_or_time(dev, MXC_RTC_ALARM), &alrm->time); @@ -310,8 +304,7 @@ static int mxc_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) */ static int mxc_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) { - struct platform_device *pdev = to_platform_device(dev); - struct rtc_plat_data *pdata = platform_get_drvdata(pdev); + struct rtc_plat_data *pdata = dev_get_drvdata(dev); rtc_update_alarm(dev, &alrm->time); |