summaryrefslogtreecommitdiff
path: root/drivers/rtc/rtc-ds1347.c
diff options
context:
space:
mode:
authorAlexandre Belloni <alexandre.belloni@bootlin.com>2019-10-07 16:47:18 +0300
committerAlexandre Belloni <alexandre.belloni@bootlin.com>2019-10-07 16:49:28 +0300
commitff7f9e0533ffb47a18090b8cfd6fe69ef757d7e7 (patch)
treee1d50915d6eb4ba2ac0d546ab1a83889c7b612f4 /drivers/rtc/rtc-ds1347.c
parent1d84eca6d5b320b9c0a2f7c107aac40bb8989785 (diff)
downloadlinux-ff7f9e0533ffb47a18090b8cfd6fe69ef757d7e7.tar.xz
rtc: ds1347: simplify getting .driver_data
Get 'driver_data' from 'struct device' directly. Going via spi_device is an unnecessary step. Link: https://lore.kernel.org/r/20191007134724.15505-4-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Diffstat (limited to 'drivers/rtc/rtc-ds1347.c')
-rw-r--r--drivers/rtc/rtc-ds1347.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/drivers/rtc/rtc-ds1347.c b/drivers/rtc/rtc-ds1347.c
index 013c5df13765..06abf0b47e16 100644
--- a/drivers/rtc/rtc-ds1347.c
+++ b/drivers/rtc/rtc-ds1347.c
@@ -43,13 +43,10 @@ static const struct regmap_access_table ds1347_access_table = {
static int ds1347_read_time(struct device *dev, struct rtc_time *dt)
{
- struct spi_device *spi = to_spi_device(dev);
- struct regmap *map;
+ struct regmap *map = dev_get_drvdata(dev);
int err;
unsigned char buf[8];
- map = spi_get_drvdata(spi);
-
err = regmap_bulk_read(map, DS1347_CLOCK_BURST, buf, 8);
if (err)
return err;
@@ -67,12 +64,9 @@ static int ds1347_read_time(struct device *dev, struct rtc_time *dt)
static int ds1347_set_time(struct device *dev, struct rtc_time *dt)
{
- struct spi_device *spi = to_spi_device(dev);
- struct regmap *map;
+ struct regmap *map = dev_get_drvdata(dev);
unsigned char buf[8];
- map = spi_get_drvdata(spi);
-
buf[0] = bin2bcd(dt->tm_sec);
buf[1] = bin2bcd(dt->tm_min);
buf[2] = (bin2bcd(dt->tm_hour) & 0x3F);