hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/mfd/max8925-i2c.c
....@@ -1,12 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * I2C driver for Maxim MAX8925
34 *
45 * Copyright (C) 2009 Marvell International Ltd.
56 * Haojian Zhuang <haojian.zhuang@marvell.com>
6
- *
7
- * This program is free software; you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License version 2 as
9
- * published by the Free Software Foundation.
107 */
118 #include <linux/kernel.h>
129 #include <linux/init.h>
....@@ -179,18 +176,18 @@
179176 dev_set_drvdata(chip->dev, chip);
180177 mutex_init(&chip->io_lock);
181178
182
- chip->rtc = i2c_new_dummy(chip->i2c->adapter, RTC_I2C_ADDR);
183
- if (!chip->rtc) {
179
+ chip->rtc = i2c_new_dummy_device(chip->i2c->adapter, RTC_I2C_ADDR);
180
+ if (IS_ERR(chip->rtc)) {
184181 dev_err(chip->dev, "Failed to allocate I2C device for RTC\n");
185
- return -ENODEV;
182
+ return PTR_ERR(chip->rtc);
186183 }
187184 i2c_set_clientdata(chip->rtc, chip);
188185
189
- chip->adc = i2c_new_dummy(chip->i2c->adapter, ADC_I2C_ADDR);
190
- if (!chip->adc) {
186
+ chip->adc = i2c_new_dummy_device(chip->i2c->adapter, ADC_I2C_ADDR);
187
+ if (IS_ERR(chip->adc)) {
191188 dev_err(chip->dev, "Failed to allocate I2C device for ADC\n");
192189 i2c_unregister_device(chip->rtc);
193
- return -ENODEV;
190
+ return PTR_ERR(chip->adc);
194191 }
195192 i2c_set_clientdata(chip->adc, chip);
196193