.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * Intel CHT Whiskey Cove PMIC I2C Master driver |
---|
3 | 4 | * Copyright (C) 2017 Hans de Goede <hdegoede@redhat.com> |
---|
4 | 5 | * |
---|
5 | 6 | * Based on various non upstream patches to support the CHT Whiskey Cove PMIC: |
---|
6 | 7 | * Copyright (C) 2011 - 2014 Intel Corporation. All rights reserved. |
---|
7 | | - * |
---|
8 | | - * This program is free software; you can redistribute it and/or |
---|
9 | | - * modify it under the terms of the GNU General Public License version |
---|
10 | | - * 2 as published by the Free Software Foundation, or (at your option) |
---|
11 | | - * any later version. |
---|
12 | | - * |
---|
13 | | - * This program is distributed in the hope that it will be useful, |
---|
14 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
16 | | - * GNU General Public License for more details. |
---|
17 | 8 | */ |
---|
18 | 9 | |
---|
19 | 10 | #include <linux/acpi.h> |
---|
.. | .. |
---|
323 | 314 | int ret, reg, irq; |
---|
324 | 315 | |
---|
325 | 316 | irq = platform_get_irq(pdev, 0); |
---|
326 | | - if (irq < 0) { |
---|
327 | | - dev_err(&pdev->dev, "Error missing irq resource\n"); |
---|
328 | | - return -EINVAL; |
---|
329 | | - } |
---|
| 317 | + if (irq < 0) |
---|
| 318 | + return irq; |
---|
330 | 319 | |
---|
331 | 320 | adap = devm_kzalloc(&pdev->dev, sizeof(*adap), GFP_KERNEL); |
---|
332 | 321 | if (!adap) |
---|
.. | .. |
---|
397 | 386 | */ |
---|
398 | 387 | if (acpi_dev_present("INT33FE", NULL, -1)) { |
---|
399 | 388 | board_info.irq = adap->client_irq; |
---|
400 | | - adap->client = i2c_new_device(&adap->adapter, &board_info); |
---|
401 | | - if (!adap->client) { |
---|
402 | | - ret = -ENOMEM; |
---|
| 389 | + adap->client = i2c_new_client_device(&adap->adapter, &board_info); |
---|
| 390 | + if (IS_ERR(adap->client)) { |
---|
| 391 | + ret = PTR_ERR(adap->client); |
---|
403 | 392 | goto del_adapter; |
---|
404 | 393 | } |
---|
405 | 394 | } |
---|
.. | .. |
---|
418 | 407 | { |
---|
419 | 408 | struct cht_wc_i2c_adap *adap = platform_get_drvdata(pdev); |
---|
420 | 409 | |
---|
421 | | - if (adap->client) |
---|
422 | | - i2c_unregister_device(adap->client); |
---|
| 410 | + i2c_unregister_device(adap->client); |
---|
423 | 411 | i2c_del_adapter(&adap->adapter); |
---|
424 | 412 | irq_domain_remove(adap->irq_domain); |
---|
425 | 413 | |
---|