hc
2024-01-31 f9004dbfff8a3fbbd7e2a88c8a4327c7f2f8e5b2
kernel/drivers/i2c/busses/i2c-cht-wc.c
....@@ -1,19 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Intel CHT Whiskey Cove PMIC I2C Master driver
34 * Copyright (C) 2017 Hans de Goede <hdegoede@redhat.com>
45 *
56 * Based on various non upstream patches to support the CHT Whiskey Cove PMIC:
67 * 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.
178 */
189
1910 #include <linux/acpi.h>
....@@ -323,10 +314,8 @@
323314 int ret, reg, irq;
324315
325316 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;
330319
331320 adap = devm_kzalloc(&pdev->dev, sizeof(*adap), GFP_KERNEL);
332321 if (!adap)
....@@ -397,9 +386,9 @@
397386 */
398387 if (acpi_dev_present("INT33FE", NULL, -1)) {
399388 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);
403392 goto del_adapter;
404393 }
405394 }
....@@ -418,8 +407,7 @@
418407 {
419408 struct cht_wc_i2c_adap *adap = platform_get_drvdata(pdev);
420409
421
- if (adap->client)
422
- i2c_unregister_device(adap->client);
410
+ i2c_unregister_device(adap->client);
423411 i2c_del_adapter(&adap->adapter);
424412 irq_domain_remove(adap->irq_domain);
425413