summaryrefslogtreecommitdiff
path: root/drivers/rtc/rtc-pcap.c
diff options
context:
space:
mode:
authorWolfram Sang <wsa+renesas@sang-engineering.com>2018-04-19 17:06:14 +0300
committerAlexandre Belloni <alexandre.belloni@bootlin.com>2018-05-03 23:08:00 +0300
commit85368bb9de6366654f442e26fdd571981f205291 (patch)
tree807385ec3a590efc12b24fe22b3ee7f8fd204e0f /drivers/rtc/rtc-pcap.c
parent36d91a4d401c284ab21213622c85cd855725f10f (diff)
downloadlinux-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-pcap.c')
-rw-r--r--drivers/rtc/rtc-pcap.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/rtc/rtc-pcap.c b/drivers/rtc/rtc-pcap.c
index c05f524ba9af..f176cb9d0dbc 100644
--- a/drivers/rtc/rtc-pcap.c
+++ b/drivers/rtc/rtc-pcap.c
@@ -43,8 +43,7 @@ static irqreturn_t pcap_rtc_irq(int irq, void *_pcap_rtc)
static int pcap_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct pcap_rtc *pcap_rtc = platform_get_drvdata(pdev);
+ struct pcap_rtc *pcap_rtc = dev_get_drvdata(dev);
struct rtc_time *tm = &alrm->time;
unsigned long secs;
u32 tod; /* time of day, seconds since midnight */
@@ -63,8 +62,7 @@ static int pcap_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
static int pcap_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct pcap_rtc *pcap_rtc = platform_get_drvdata(pdev);
+ struct pcap_rtc *pcap_rtc = dev_get_drvdata(dev);
struct rtc_time *tm = &alrm->time;
unsigned long secs;
u32 tod, days;
@@ -82,8 +80,7 @@ static int pcap_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
static int pcap_rtc_read_time(struct device *dev, struct rtc_time *tm)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct pcap_rtc *pcap_rtc = platform_get_drvdata(pdev);
+ struct pcap_rtc *pcap_rtc = dev_get_drvdata(dev);
unsigned long secs;
u32 tod, days;
@@ -100,8 +97,7 @@ static int pcap_rtc_read_time(struct device *dev, struct rtc_time *tm)
static int pcap_rtc_set_mmss(struct device *dev, unsigned long secs)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct pcap_rtc *pcap_rtc = platform_get_drvdata(pdev);
+ struct pcap_rtc *pcap_rtc = dev_get_drvdata(dev);
u32 tod, days;
tod = secs % SEC_PER_DAY;
@@ -115,8 +111,7 @@ static int pcap_rtc_set_mmss(struct device *dev, unsigned long secs)
static int pcap_rtc_irq_enable(struct device *dev, int pirq, unsigned int en)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct pcap_rtc *pcap_rtc = platform_get_drvdata(pdev);
+ struct pcap_rtc *pcap_rtc = dev_get_drvdata(dev);
if (en)
enable_irq(pcap_to_irq(pcap_rtc->pcap, pirq));