diff options
author | Wolfram Sang <wsa+renesas@sang-engineering.com> | 2018-04-19 17:06:14 +0300 |
---|---|---|
committer | Alexandre Belloni <alexandre.belloni@bootlin.com> | 2018-05-03 23:08:00 +0300 |
commit | 85368bb9de6366654f442e26fdd571981f205291 (patch) | |
tree | 807385ec3a590efc12b24fe22b3ee7f8fd204e0f /drivers/rtc/rtc-m48t59.c | |
parent | 36d91a4d401c284ab21213622c85cd855725f10f (diff) | |
download | linux-85368bb9de6366654f442e26fdd571981f205291.tar.xz |
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-m48t59.c')
-rw-r--r-- | drivers/rtc/rtc-m48t59.c | 41 |
1 files changed, 16 insertions, 25 deletions
diff --git a/drivers/rtc/rtc-m48t59.c b/drivers/rtc/rtc-m48t59.c index 216fac62c888..1053a406b3aa 100644 --- a/drivers/rtc/rtc-m48t59.c +++ b/drivers/rtc/rtc-m48t59.c @@ -47,8 +47,7 @@ struct m48t59_private { static void m48t59_mem_writeb(struct device *dev, u32 ofs, u8 val) { - struct platform_device *pdev = to_platform_device(dev); - struct m48t59_private *m48t59 = platform_get_drvdata(pdev); + struct m48t59_private *m48t59 = dev_get_drvdata(dev); writeb(val, m48t59->ioaddr+ofs); } @@ -56,8 +55,7 @@ m48t59_mem_writeb(struct device *dev, u32 ofs, u8 val) static u8 m48t59_mem_readb(struct device *dev, u32 ofs) { - struct platform_device *pdev = to_platform_device(dev); - struct m48t59_private *m48t59 = platform_get_drvdata(pdev); + struct m48t59_private *m48t59 = dev_get_drvdata(dev); return readb(m48t59->ioaddr+ofs); } @@ -67,9 +65,8 @@ m48t59_mem_readb(struct device *dev, u32 ofs) */ static int m48t59_rtc_read_time(struct device *dev, struct rtc_time *tm) { - struct platform_device *pdev = to_platform_device(dev); - struct m48t59_plat_data *pdata = dev_get_platdata(&pdev->dev); - struct m48t59_private *m48t59 = platform_get_drvdata(pdev); + struct m48t59_plat_data *pdata = dev_get_platdata(dev); + struct m48t59_private *m48t59 = dev_get_drvdata(dev); unsigned long flags; u8 val; @@ -110,9 +107,8 @@ static int m48t59_rtc_read_time(struct device *dev, struct rtc_time *tm) static int m48t59_rtc_set_time(struct device *dev, struct rtc_time *tm) { - struct platform_device *pdev = to_platform_device(dev); - struct m48t59_plat_data *pdata = dev_get_platdata(&pdev->dev); - struct m48t59_private *m48t59 = platform_get_drvdata(pdev); + struct m48t59_plat_data *pdata = dev_get_platdata(dev); + struct m48t59_private *m48t59 = dev_get_drvdata(dev); unsigned long flags; u8 val = 0; int year = tm->tm_year; @@ -157,9 +153,8 @@ static int m48t59_rtc_set_time(struct device *dev, struct rtc_time *tm) */ static int m48t59_rtc_readalarm(struct device *dev, struct rtc_wkalrm *alrm) { - struct platform_device *pdev = to_platform_device(dev); - struct m48t59_plat_data *pdata = dev_get_platdata(&pdev->dev); - struct m48t59_private *m48t59 = platform_get_drvdata(pdev); + struct m48t59_plat_data *pdata = dev_get_platdata(dev); + struct m48t59_private *m48t59 = dev_get_drvdata(dev); struct rtc_time *tm = &alrm->time; unsigned long flags; u8 val; @@ -204,9 +199,8 @@ static int m48t59_rtc_readalarm(struct device *dev, struct rtc_wkalrm *alrm) */ static int m48t59_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm) { - struct platform_device *pdev = to_platform_device(dev); - struct m48t59_plat_data *pdata = dev_get_platdata(&pdev->dev); - struct m48t59_private *m48t59 = platform_get_drvdata(pdev); + struct m48t59_plat_data *pdata = dev_get_platdata(dev); + struct m48t59_private *m48t59 = dev_get_drvdata(dev); struct rtc_time *tm = &alrm->time; u8 mday, hour, min, sec; unsigned long flags; @@ -265,9 +259,8 @@ static int m48t59_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm) */ static int m48t59_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) { - struct platform_device *pdev = to_platform_device(dev); - struct m48t59_plat_data *pdata = dev_get_platdata(&pdev->dev); - struct m48t59_private *m48t59 = platform_get_drvdata(pdev); + struct m48t59_plat_data *pdata = dev_get_platdata(dev); + struct m48t59_private *m48t59 = dev_get_drvdata(dev); unsigned long flags; spin_lock_irqsave(&m48t59->lock, flags); @@ -282,9 +275,8 @@ static int m48t59_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) static int m48t59_rtc_proc(struct device *dev, struct seq_file *seq) { - struct platform_device *pdev = to_platform_device(dev); - struct m48t59_plat_data *pdata = dev_get_platdata(&pdev->dev); - struct m48t59_private *m48t59 = platform_get_drvdata(pdev); + struct m48t59_plat_data *pdata = dev_get_platdata(dev); + struct m48t59_private *m48t59 = dev_get_drvdata(dev); unsigned long flags; u8 val; @@ -303,9 +295,8 @@ static int m48t59_rtc_proc(struct device *dev, struct seq_file *seq) static irqreturn_t m48t59_rtc_interrupt(int irq, void *dev_id) { struct device *dev = (struct device *)dev_id; - struct platform_device *pdev = to_platform_device(dev); - struct m48t59_plat_data *pdata = dev_get_platdata(&pdev->dev); - struct m48t59_private *m48t59 = platform_get_drvdata(pdev); + struct m48t59_plat_data *pdata = dev_get_platdata(dev); + struct m48t59_private *m48t59 = dev_get_drvdata(dev); u8 event; spin_lock(&m48t59->lock); |