| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /**************************************************************************** |
|---|
| 2 | 3 | * Driver for Solarflare network controllers and boards |
|---|
| 3 | 4 | * Copyright 2007-2012 Solarflare Communications Inc. |
|---|
| 4 | | - * |
|---|
| 5 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 6 | | - * under the terms of the GNU General Public License version 2 as published |
|---|
| 7 | | - * by the Free Software Foundation, incorporated herein by reference. |
|---|
| 8 | 5 | */ |
|---|
| 9 | 6 | |
|---|
| 10 | 7 | #include <linux/rtnetlink.h> |
|---|
| .. | .. |
|---|
| 91 | 88 | const u8 *reg_values) |
|---|
| 92 | 89 | { |
|---|
| 93 | 90 | struct falcon_board *board = falcon_board(efx); |
|---|
| 94 | | - struct i2c_client *client = i2c_new_device(&board->i2c_adap, info); |
|---|
| 91 | + struct i2c_client *client = i2c_new_client_device(&board->i2c_adap, info); |
|---|
| 95 | 92 | int rc; |
|---|
| 96 | 93 | |
|---|
| 97 | | - if (!client) |
|---|
| 98 | | - return -EIO; |
|---|
| 94 | + if (IS_ERR(client)) |
|---|
| 95 | + return PTR_ERR(client); |
|---|
| 99 | 96 | |
|---|
| 100 | 97 | /* Read-to-clear alarm/interrupt status */ |
|---|
| 101 | 98 | i2c_smbus_read_byte_data(client, LM87_REG_ALARMS1); |
|---|
| .. | .. |
|---|
| 360 | 357 | static ssize_t show_phy_flash_cfg(struct device *dev, |
|---|
| 361 | 358 | struct device_attribute *attr, char *buf) |
|---|
| 362 | 359 | { |
|---|
| 363 | | - struct ef4_nic *efx = pci_get_drvdata(to_pci_dev(dev)); |
|---|
| 360 | + struct ef4_nic *efx = dev_get_drvdata(dev); |
|---|
| 364 | 361 | return sprintf(buf, "%d\n", !!(efx->phy_mode & PHY_MODE_SPECIAL)); |
|---|
| 365 | 362 | } |
|---|
| 366 | 363 | |
|---|
| .. | .. |
|---|
| 368 | 365 | struct device_attribute *attr, |
|---|
| 369 | 366 | const char *buf, size_t count) |
|---|
| 370 | 367 | { |
|---|
| 371 | | - struct ef4_nic *efx = pci_get_drvdata(to_pci_dev(dev)); |
|---|
| 368 | + struct ef4_nic *efx = dev_get_drvdata(dev); |
|---|
| 372 | 369 | enum ef4_phy_mode old_mode, new_mode; |
|---|
| 373 | 370 | int err; |
|---|
| 374 | 371 | |
|---|
| .. | .. |
|---|
| 457 | 454 | |
|---|
| 458 | 455 | #if IS_ENABLED(CONFIG_SENSORS_LM90) |
|---|
| 459 | 456 | board->hwmon_client = |
|---|
| 460 | | - i2c_new_device(&board->i2c_adap, &sfe4001_hwmon_info); |
|---|
| 457 | + i2c_new_client_device(&board->i2c_adap, &sfe4001_hwmon_info); |
|---|
| 461 | 458 | #else |
|---|
| 462 | 459 | board->hwmon_client = |
|---|
| 463 | | - i2c_new_dummy(&board->i2c_adap, sfe4001_hwmon_info.addr); |
|---|
| 460 | + i2c_new_dummy_device(&board->i2c_adap, sfe4001_hwmon_info.addr); |
|---|
| 464 | 461 | #endif |
|---|
| 465 | | - if (!board->hwmon_client) |
|---|
| 466 | | - return -EIO; |
|---|
| 462 | + if (IS_ERR(board->hwmon_client)) |
|---|
| 463 | + return PTR_ERR(board->hwmon_client); |
|---|
| 467 | 464 | |
|---|
| 468 | 465 | /* Raise board/PHY high limit from 85 to 90 degrees Celsius */ |
|---|
| 469 | 466 | rc = i2c_smbus_write_byte_data(board->hwmon_client, |
|---|
| .. | .. |
|---|
| 471 | 468 | if (rc) |
|---|
| 472 | 469 | goto fail_hwmon; |
|---|
| 473 | 470 | |
|---|
| 474 | | - board->ioexp_client = i2c_new_dummy(&board->i2c_adap, PCA9539); |
|---|
| 475 | | - if (!board->ioexp_client) { |
|---|
| 476 | | - rc = -EIO; |
|---|
| 471 | + board->ioexp_client = i2c_new_dummy_device(&board->i2c_adap, PCA9539); |
|---|
| 472 | + if (IS_ERR(board->ioexp_client)) { |
|---|
| 473 | + rc = PTR_ERR(board->ioexp_client); |
|---|
| 477 | 474 | goto fail_hwmon; |
|---|
| 478 | 475 | } |
|---|
| 479 | 476 | |
|---|