Commit 55c24316 authored by Wolfram Sang's avatar Wolfram Sang Committed by Alexandre Belloni

rtc: fm3130: simplify getting the adapter of a client

We have a dedicated pointer for that, so use it. Much easier to read and
less computation involved.
Signed-off-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
parent 59ab3f40
...@@ -107,8 +107,7 @@ static int fm3130_get_time(struct device *dev, struct rtc_time *t) ...@@ -107,8 +107,7 @@ static int fm3130_get_time(struct device *dev, struct rtc_time *t)
fm3130_rtc_mode(dev, FM3130_MODE_READ); fm3130_rtc_mode(dev, FM3130_MODE_READ);
/* read the RTC date and time registers all at once */ /* read the RTC date and time registers all at once */
tmp = i2c_transfer(to_i2c_adapter(fm3130->client->dev.parent), tmp = i2c_transfer(fm3130->client->adapter, fm3130->msg, 2);
fm3130->msg, 2);
if (tmp != 2) { if (tmp != 2) {
dev_err(dev, "%s error %d\n", "read", tmp); dev_err(dev, "%s error %d\n", "read", tmp);
return -EIO; return -EIO;
...@@ -200,8 +199,7 @@ static int fm3130_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) ...@@ -200,8 +199,7 @@ static int fm3130_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
} }
/* read the RTC alarm registers all at once */ /* read the RTC alarm registers all at once */
tmp = i2c_transfer(to_i2c_adapter(fm3130->client->dev.parent), tmp = i2c_transfer(fm3130->client->adapter, &fm3130->msg[2], 2);
&fm3130->msg[2], 2);
if (tmp != 2) { if (tmp != 2) {
dev_err(dev, "%s error %d\n", "read", tmp); dev_err(dev, "%s error %d\n", "read", tmp);
return -EIO; return -EIO;
...@@ -351,7 +349,7 @@ static int fm3130_probe(struct i2c_client *client, ...@@ -351,7 +349,7 @@ static int fm3130_probe(struct i2c_client *client,
struct fm3130 *fm3130; struct fm3130 *fm3130;
int err = -ENODEV; int err = -ENODEV;
int tmp; int tmp;
struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); struct i2c_adapter *adapter = client->adapter;
if (!i2c_check_functionality(adapter, if (!i2c_check_functionality(adapter,
I2C_FUNC_I2C | I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) I2C_FUNC_I2C | I2C_FUNC_SMBUS_WRITE_BYTE_DATA))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment