| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * I2C driver for Maxim MAX8925 |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2009 Marvell International Ltd. |
|---|
| 5 | 6 | * 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. |
|---|
| 10 | 7 | */ |
|---|
| 11 | 8 | #include <linux/kernel.h> |
|---|
| 12 | 9 | #include <linux/init.h> |
|---|
| .. | .. |
|---|
| 179 | 176 | dev_set_drvdata(chip->dev, chip); |
|---|
| 180 | 177 | mutex_init(&chip->io_lock); |
|---|
| 181 | 178 | |
|---|
| 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)) { |
|---|
| 184 | 181 | dev_err(chip->dev, "Failed to allocate I2C device for RTC\n"); |
|---|
| 185 | | - return -ENODEV; |
|---|
| 182 | + return PTR_ERR(chip->rtc); |
|---|
| 186 | 183 | } |
|---|
| 187 | 184 | i2c_set_clientdata(chip->rtc, chip); |
|---|
| 188 | 185 | |
|---|
| 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)) { |
|---|
| 191 | 188 | dev_err(chip->dev, "Failed to allocate I2C device for ADC\n"); |
|---|
| 192 | 189 | i2c_unregister_device(chip->rtc); |
|---|
| 193 | | - return -ENODEV; |
|---|
| 190 | + return PTR_ERR(chip->adc); |
|---|
| 194 | 191 | } |
|---|
| 195 | 192 | i2c_set_clientdata(chip->adc, chip); |
|---|
| 196 | 193 | |
|---|