| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * max517.c - Support for Maxim MAX517, MAX518 and MAX519 |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2010, 2011 Roland Stigge <stigge@antcom.de> |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 7 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 8 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 9 | | - * (at your option) any later version. |
|---|
| 10 | | - * |
|---|
| 11 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 12 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 14 | | - * GNU General Public License for more details. |
|---|
| 15 | | - * |
|---|
| 16 | | - * You should have received a copy of the GNU General Public License |
|---|
| 17 | | - * along with this program; if not, write to the Free Software |
|---|
| 18 | | - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
|---|
| 19 | 6 | */ |
|---|
| 20 | 7 | |
|---|
| 21 | 8 | #include <linux/module.h> |
|---|
| .. | .. |
|---|
| 113 | 100 | return ret; |
|---|
| 114 | 101 | } |
|---|
| 115 | 102 | |
|---|
| 116 | | -#ifdef CONFIG_PM_SLEEP |
|---|
| 117 | | -static int max517_suspend(struct device *dev) |
|---|
| 103 | +static int __maybe_unused max517_suspend(struct device *dev) |
|---|
| 118 | 104 | { |
|---|
| 119 | 105 | u8 outbuf = COMMAND_PD; |
|---|
| 120 | 106 | |
|---|
| 121 | 107 | return i2c_master_send(to_i2c_client(dev), &outbuf, 1); |
|---|
| 122 | 108 | } |
|---|
| 123 | 109 | |
|---|
| 124 | | -static int max517_resume(struct device *dev) |
|---|
| 110 | +static int __maybe_unused max517_resume(struct device *dev) |
|---|
| 125 | 111 | { |
|---|
| 126 | 112 | u8 outbuf = 0; |
|---|
| 127 | 113 | |
|---|
| .. | .. |
|---|
| 129 | 115 | } |
|---|
| 130 | 116 | |
|---|
| 131 | 117 | static SIMPLE_DEV_PM_OPS(max517_pm_ops, max517_suspend, max517_resume); |
|---|
| 132 | | -#define MAX517_PM_OPS (&max517_pm_ops) |
|---|
| 133 | | -#else |
|---|
| 134 | | -#define MAX517_PM_OPS NULL |
|---|
| 135 | | -#endif |
|---|
| 136 | 118 | |
|---|
| 137 | 119 | static const struct iio_info max517_info = { |
|---|
| 138 | 120 | .read_raw = max517_read_raw, |
|---|
| .. | .. |
|---|
| 173 | 155 | data = iio_priv(indio_dev); |
|---|
| 174 | 156 | i2c_set_clientdata(client, indio_dev); |
|---|
| 175 | 157 | data->client = client; |
|---|
| 176 | | - |
|---|
| 177 | | - /* establish that the iio_dev is a child of the i2c device */ |
|---|
| 178 | | - indio_dev->dev.parent = &client->dev; |
|---|
| 179 | 158 | |
|---|
| 180 | 159 | switch (id->driver_data) { |
|---|
| 181 | 160 | case ID_MAX521: |
|---|
| .. | .. |
|---|
| 229 | 208 | static struct i2c_driver max517_driver = { |
|---|
| 230 | 209 | .driver = { |
|---|
| 231 | 210 | .name = MAX517_DRV_NAME, |
|---|
| 232 | | - .pm = MAX517_PM_OPS, |
|---|
| 211 | + .pm = &max517_pm_ops, |
|---|
| 233 | 212 | }, |
|---|
| 234 | 213 | .probe = max517_probe, |
|---|
| 235 | 214 | .remove = max517_remove, |
|---|