hc
2024-05-10 23fa18eaa71266feff7ba8d83022d9e1cc83c65a
kernel/drivers/net/ethernet/sfc/falcon/falcon_boards.c
....@@ -1,10 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /****************************************************************************
23 * Driver for Solarflare network controllers and boards
34 * 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.
85 */
96
107 #include <linux/rtnetlink.h>
....@@ -91,11 +88,11 @@
9188 const u8 *reg_values)
9289 {
9390 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);
9592 int rc;
9693
97
- if (!client)
98
- return -EIO;
94
+ if (IS_ERR(client))
95
+ return PTR_ERR(client);
9996
10097 /* Read-to-clear alarm/interrupt status */
10198 i2c_smbus_read_byte_data(client, LM87_REG_ALARMS1);
....@@ -360,7 +357,7 @@
360357 static ssize_t show_phy_flash_cfg(struct device *dev,
361358 struct device_attribute *attr, char *buf)
362359 {
363
- struct ef4_nic *efx = pci_get_drvdata(to_pci_dev(dev));
360
+ struct ef4_nic *efx = dev_get_drvdata(dev);
364361 return sprintf(buf, "%d\n", !!(efx->phy_mode & PHY_MODE_SPECIAL));
365362 }
366363
....@@ -368,7 +365,7 @@
368365 struct device_attribute *attr,
369366 const char *buf, size_t count)
370367 {
371
- struct ef4_nic *efx = pci_get_drvdata(to_pci_dev(dev));
368
+ struct ef4_nic *efx = dev_get_drvdata(dev);
372369 enum ef4_phy_mode old_mode, new_mode;
373370 int err;
374371
....@@ -457,13 +454,13 @@
457454
458455 #if IS_ENABLED(CONFIG_SENSORS_LM90)
459456 board->hwmon_client =
460
- i2c_new_device(&board->i2c_adap, &sfe4001_hwmon_info);
457
+ i2c_new_client_device(&board->i2c_adap, &sfe4001_hwmon_info);
461458 #else
462459 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);
464461 #endif
465
- if (!board->hwmon_client)
466
- return -EIO;
462
+ if (IS_ERR(board->hwmon_client))
463
+ return PTR_ERR(board->hwmon_client);
467464
468465 /* Raise board/PHY high limit from 85 to 90 degrees Celsius */
469466 rc = i2c_smbus_write_byte_data(board->hwmon_client,
....@@ -471,9 +468,9 @@
471468 if (rc)
472469 goto fail_hwmon;
473470
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);
477474 goto fail_hwmon;
478475 }
479476