| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * rtc-fm3130.c - RTC driver for Ramtron FM3130 I2C chip. |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2008 Sergey Lapin |
|---|
| 5 | 6 | * 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. |
|---|
| 10 | 7 | */ |
|---|
| 11 | 8 | |
|---|
| 12 | 9 | #include <linux/module.h> |
|---|
| .. | .. |
|---|
| 107 | 104 | fm3130_rtc_mode(dev, FM3130_MODE_READ); |
|---|
| 108 | 105 | |
|---|
| 109 | 106 | /* 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); |
|---|
| 112 | 108 | if (tmp != 2) { |
|---|
| 113 | 109 | dev_err(dev, "%s error %d\n", "read", tmp); |
|---|
| 114 | 110 | return -EIO; |
|---|
| .. | .. |
|---|
| 200 | 196 | } |
|---|
| 201 | 197 | |
|---|
| 202 | 198 | /* 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); |
|---|
| 205 | 200 | if (tmp != 2) { |
|---|
| 206 | 201 | dev_err(dev, "%s error %d\n", "read", tmp); |
|---|
| 207 | 202 | return -EIO; |
|---|
| .. | .. |
|---|
| 351 | 346 | struct fm3130 *fm3130; |
|---|
| 352 | 347 | int err = -ENODEV; |
|---|
| 353 | 348 | int tmp; |
|---|
| 354 | | - struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); |
|---|
| 349 | + struct i2c_adapter *adapter = client->adapter; |
|---|
| 355 | 350 | |
|---|
| 356 | 351 | if (!i2c_check_functionality(adapter, |
|---|
| 357 | 352 | I2C_FUNC_I2C | I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) |
|---|