| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * mcp3021.c - driver for Microchip MCP3021 and MCP3221 |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 9 | 10 | * This driver export the value of analog input voltage to sysfs, the |
|---|
| 10 | 11 | * voltage unit is mV. Through the sysfs interface, lm-sensors tool |
|---|
| 11 | 12 | * can also display the input voltage. |
|---|
| 12 | | - * |
|---|
| 13 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 14 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 15 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 16 | | - * (at your option) any later version. |
|---|
| 17 | 13 | */ |
|---|
| 18 | 14 | |
|---|
| 19 | 15 | #include <linux/kernel.h> |
|---|
| .. | .. |
|---|
| 104 | 100 | |
|---|
| 105 | 101 | static DEVICE_ATTR_RO(in0_input); |
|---|
| 106 | 102 | |
|---|
| 107 | | -static int mcp3021_probe(struct i2c_client *client, |
|---|
| 108 | | - const struct i2c_device_id *id) |
|---|
| 103 | +static const struct i2c_device_id mcp3021_id[]; |
|---|
| 104 | + |
|---|
| 105 | +static int mcp3021_probe(struct i2c_client *client) |
|---|
| 109 | 106 | { |
|---|
| 110 | 107 | int err; |
|---|
| 111 | 108 | struct mcp3021_data *data = NULL; |
|---|
| .. | .. |
|---|
| 136 | 133 | data->vdd = MCP3021_VDD_REF_DEFAULT; |
|---|
| 137 | 134 | } |
|---|
| 138 | 135 | |
|---|
| 139 | | - switch (id->driver_data) { |
|---|
| 136 | + switch (i2c_match_id(mcp3021_id, client)->driver_data) { |
|---|
| 140 | 137 | case mcp3021: |
|---|
| 141 | 138 | data->sar_shift = MCP3021_SAR_SHIFT; |
|---|
| 142 | 139 | data->sar_mask = MCP3021_SAR_MASK; |
|---|
| .. | .. |
|---|
| 201 | 198 | .name = "mcp3021", |
|---|
| 202 | 199 | .of_match_table = of_match_ptr(of_mcp3021_match), |
|---|
| 203 | 200 | }, |
|---|
| 204 | | - .probe = mcp3021_probe, |
|---|
| 201 | + .probe_new = mcp3021_probe, |
|---|
| 205 | 202 | .remove = mcp3021_remove, |
|---|
| 206 | 203 | .id_table = mcp3021_id, |
|---|
| 207 | 204 | }; |
|---|