| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Driver for SMM665 Power Controller / Monitor |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2010 Ericsson AB. |
|---|
| 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; version 2 of the License. |
|---|
| 9 | 6 | * |
|---|
| 10 | 7 | * This driver should also work for SMM465, SMM764, and SMM766, but is untested |
|---|
| 11 | 8 | * for those chips. Only monitoring functionality is implemented. |
|---|
| .. | .. |
|---|
| 200 | 197 | if (rv != -ENXIO) { |
|---|
| 201 | 198 | /* |
|---|
| 202 | 199 | * We expect ENXIO to reflect NACK |
|---|
| 203 | | - * (per Documentation/i2c/fault-codes). |
|---|
| 200 | + * (per Documentation/i2c/fault-codes.rst). |
|---|
| 204 | 201 | * Everything else is an error. |
|---|
| 205 | 202 | */ |
|---|
| 206 | 203 | dev_dbg(&client->dev, |
|---|
| .. | .. |
|---|
| 565 | 562 | |
|---|
| 566 | 563 | ATTRIBUTE_GROUPS(smm665); |
|---|
| 567 | 564 | |
|---|
| 568 | | -static int smm665_probe(struct i2c_client *client, |
|---|
| 569 | | - const struct i2c_device_id *id) |
|---|
| 565 | +static const struct i2c_device_id smm665_id[]; |
|---|
| 566 | + |
|---|
| 567 | +static int smm665_probe(struct i2c_client *client) |
|---|
| 570 | 568 | { |
|---|
| 571 | 569 | struct i2c_adapter *adapter = client->adapter; |
|---|
| 572 | 570 | struct smm665_data *data; |
|---|
| .. | .. |
|---|
| 588 | 586 | mutex_init(&data->update_lock); |
|---|
| 589 | 587 | |
|---|
| 590 | 588 | data->client = client; |
|---|
| 591 | | - data->type = id->driver_data; |
|---|
| 592 | | - data->cmdreg = i2c_new_dummy(adapter, (client->addr & ~SMM665_REGMASK) |
|---|
| 589 | + data->type = i2c_match_id(smm665_id, client)->driver_data; |
|---|
| 590 | + data->cmdreg = i2c_new_dummy_device(adapter, (client->addr & ~SMM665_REGMASK) |
|---|
| 593 | 591 | | SMM665_CMDREG_BASE); |
|---|
| 594 | | - if (!data->cmdreg) |
|---|
| 595 | | - return -ENOMEM; |
|---|
| 592 | + if (IS_ERR(data->cmdreg)) |
|---|
| 593 | + return PTR_ERR(data->cmdreg); |
|---|
| 596 | 594 | |
|---|
| 597 | 595 | switch (data->type) { |
|---|
| 598 | 596 | case smm465: |
|---|
| .. | .. |
|---|
| 697 | 695 | .driver = { |
|---|
| 698 | 696 | .name = "smm665", |
|---|
| 699 | 697 | }, |
|---|
| 700 | | - .probe = smm665_probe, |
|---|
| 698 | + .probe_new = smm665_probe, |
|---|
| 701 | 699 | .remove = smm665_remove, |
|---|
| 702 | 700 | .id_table = smm665_id, |
|---|
| 703 | 701 | }; |
|---|