hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/rtc/rtc-fm3130.c
....@@ -1,12 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * rtc-fm3130.c - RTC driver for Ramtron FM3130 I2C chip.
34 *
45 * Copyright (C) 2008 Sergey Lapin
56 * Based on ds1307 driver by James Chapman and David Brownell
6
- *
7
- * This program is free software; you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License version 2 as
9
- * published by the Free Software Foundation.
107 */
118
129 #include <linux/module.h>
....@@ -107,8 +104,7 @@
107104 fm3130_rtc_mode(dev, FM3130_MODE_READ);
108105
109106 /* read the RTC date and time registers all at once */
110
- tmp = i2c_transfer(to_i2c_adapter(fm3130->client->dev.parent),
111
- fm3130->msg, 2);
107
+ tmp = i2c_transfer(fm3130->client->adapter, fm3130->msg, 2);
112108 if (tmp != 2) {
113109 dev_err(dev, "%s error %d\n", "read", tmp);
114110 return -EIO;
....@@ -200,8 +196,7 @@
200196 }
201197
202198 /* read the RTC alarm registers all at once */
203
- tmp = i2c_transfer(to_i2c_adapter(fm3130->client->dev.parent),
204
- &fm3130->msg[2], 2);
199
+ tmp = i2c_transfer(fm3130->client->adapter, &fm3130->msg[2], 2);
205200 if (tmp != 2) {
206201 dev_err(dev, "%s error %d\n", "read", tmp);
207202 return -EIO;
....@@ -351,7 +346,7 @@
351346 struct fm3130 *fm3130;
352347 int err = -ENODEV;
353348 int tmp;
354
- struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
349
+ struct i2c_adapter *adapter = client->adapter;
355350
356351 if (!i2c_check_functionality(adapter,
357352 I2C_FUNC_I2C | I2C_FUNC_SMBUS_WRITE_BYTE_DATA))