| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* Copyright (c) 2009-2013, The Linux Foundation. All rights reserved. |
|---|
| 2 | 3 | * Copyright (c) 2010, Google Inc. |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * Author: Dima Zavin <dima@android.com> |
|---|
| 7 | 8 | * - Largely rewritten from original to not be an i2c driver. |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 10 | | - * it under the terms of the GNU General Public License version 2 and |
|---|
| 11 | | - * only version 2 as published by the Free Software Foundation. |
|---|
| 12 | | - * |
|---|
| 13 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 14 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 15 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 16 | | - * GNU General Public License for more details. |
|---|
| 17 | 9 | */ |
|---|
| 18 | 10 | |
|---|
| 19 | 11 | #define pr_fmt(fmt) "%s: " fmt, __func__ |
|---|
| .. | .. |
|---|
| 79 | 71 | int (*read)(struct ssbi *, u16 addr, u8 *buf, int len); |
|---|
| 80 | 72 | int (*write)(struct ssbi *, u16 addr, const u8 *buf, int len); |
|---|
| 81 | 73 | }; |
|---|
| 82 | | - |
|---|
| 83 | | -#define to_ssbi(dev) platform_get_drvdata(to_platform_device(dev)) |
|---|
| 84 | 74 | |
|---|
| 85 | 75 | static inline u32 ssbi_readl(struct ssbi *ssbi, u32 reg) |
|---|
| 86 | 76 | { |
|---|
| .. | .. |
|---|
| 243 | 233 | |
|---|
| 244 | 234 | int ssbi_read(struct device *dev, u16 addr, u8 *buf, int len) |
|---|
| 245 | 235 | { |
|---|
| 246 | | - struct ssbi *ssbi = to_ssbi(dev); |
|---|
| 236 | + struct ssbi *ssbi = dev_get_drvdata(dev); |
|---|
| 247 | 237 | unsigned long flags; |
|---|
| 248 | 238 | int ret; |
|---|
| 249 | 239 | |
|---|
| .. | .. |
|---|
| 257 | 247 | |
|---|
| 258 | 248 | int ssbi_write(struct device *dev, u16 addr, const u8 *buf, int len) |
|---|
| 259 | 249 | { |
|---|
| 260 | | - struct ssbi *ssbi = to_ssbi(dev); |
|---|
| 250 | + struct ssbi *ssbi = dev_get_drvdata(dev); |
|---|
| 261 | 251 | unsigned long flags; |
|---|
| 262 | 252 | int ret; |
|---|
| 263 | 253 | |
|---|