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-ds1685.c | |
parent | rtc: cmos: introduce quirks to enable use_acpi_alarm mode (diff) | |
download | linux-85368bb9de6366654f442e26fdd571981f205291.tar.xz 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-ds1685.c')
-rw-r--r-- | drivers/rtc/rtc-ds1685.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/drivers/rtc/rtc-ds1685.c b/drivers/rtc/rtc-ds1685.c index 1a39829d2b40..f0f8011dce3d 100644 --- a/drivers/rtc/rtc-ds1685.c +++ b/drivers/rtc/rtc-ds1685.c @@ -267,8 +267,7 @@ ds1685_rtc_get_ssn(struct ds1685_priv *rtc, u8 *ssn) static int ds1685_rtc_read_time(struct device *dev, struct rtc_time *tm) { - struct platform_device *pdev = to_platform_device(dev); - struct ds1685_priv *rtc = platform_get_drvdata(pdev); + struct ds1685_priv *rtc = dev_get_drvdata(dev); u8 ctrlb, century; u8 seconds, minutes, hours, wday, mday, month, years; @@ -317,8 +316,7 @@ ds1685_rtc_read_time(struct device *dev, struct rtc_time *tm) static int ds1685_rtc_set_time(struct device *dev, struct rtc_time *tm) { - struct platform_device *pdev = to_platform_device(dev); - struct ds1685_priv *rtc = platform_get_drvdata(pdev); + struct ds1685_priv *rtc = dev_get_drvdata(dev); u8 ctrlb, seconds, minutes, hours, wday, mday, month, years, century; /* Fetch the time info from rtc_time. */ @@ -394,8 +392,7 @@ ds1685_rtc_set_time(struct device *dev, struct rtc_time *tm) static int ds1685_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) { - struct platform_device *pdev = to_platform_device(dev); - struct ds1685_priv *rtc = platform_get_drvdata(pdev); + struct ds1685_priv *rtc = dev_get_drvdata(dev); u8 seconds, minutes, hours, mday, ctrlb, ctrlc; int ret; @@ -453,8 +450,7 @@ ds1685_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) static int ds1685_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) { - struct platform_device *pdev = to_platform_device(dev); - struct ds1685_priv *rtc = platform_get_drvdata(pdev); + struct ds1685_priv *rtc = dev_get_drvdata(dev); u8 ctrlb, seconds, minutes, hours, mday; int ret; @@ -1119,8 +1115,7 @@ static ssize_t ds1685_rtc_sysfs_battery_show(struct device *dev, struct device_attribute *attr, char *buf) { - struct platform_device *pdev = to_platform_device(dev); - struct ds1685_priv *rtc = platform_get_drvdata(pdev); + struct ds1685_priv *rtc = dev_get_drvdata(dev); u8 ctrld; ctrld = rtc->read(rtc, RTC_CTRL_D); @@ -1140,8 +1135,7 @@ static ssize_t ds1685_rtc_sysfs_auxbatt_show(struct device *dev, struct device_attribute *attr, char *buf) { - struct platform_device *pdev = to_platform_device(dev); - struct ds1685_priv *rtc = platform_get_drvdata(pdev); + struct ds1685_priv *rtc = dev_get_drvdata(dev); u8 ctrl4a; ds1685_rtc_switch_to_bank1(rtc); @@ -1163,8 +1157,7 @@ static ssize_t ds1685_rtc_sysfs_serial_show(struct device *dev, struct device_attribute *attr, char *buf) { - struct platform_device *pdev = to_platform_device(dev); - struct ds1685_priv *rtc = platform_get_drvdata(pdev); + struct ds1685_priv *rtc = dev_get_drvdata(dev); u8 ssn[8]; ds1685_rtc_switch_to_bank1(rtc); |