hc
2023-12-06 08f87f769b595151be1afeff53e144f543faa614
kernel/drivers/iio/light/cm36651.c
....@@ -1,10 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (C) 2013 Samsung Electronics Co., Ltd.
34 * Author: Beomho Seo <beomho.seo@samsung.com>
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.
85 */
96
107 #include <linux/delay.h>
....@@ -535,7 +532,7 @@
535532 int state)
536533 {
537534 struct cm36651_data *cm36651 = iio_priv(indio_dev);
538
- int cmd, ret = -EINVAL;
535
+ int cmd, ret;
539536
540537 mutex_lock(&cm36651->lock);
541538
....@@ -649,23 +646,22 @@
649646 i2c_set_clientdata(client, indio_dev);
650647
651648 cm36651->client = client;
652
- cm36651->ps_client = i2c_new_dummy(client->adapter,
649
+ cm36651->ps_client = i2c_new_dummy_device(client->adapter,
653650 CM36651_I2C_ADDR_PS);
654
- if (!cm36651->ps_client) {
651
+ if (IS_ERR(cm36651->ps_client)) {
655652 dev_err(&client->dev, "%s: new i2c device failed\n", __func__);
656
- ret = -ENODEV;
653
+ ret = PTR_ERR(cm36651->ps_client);
657654 goto error_disable_reg;
658655 }
659656
660
- cm36651->ara_client = i2c_new_dummy(client->adapter, CM36651_ARA);
661
- if (!cm36651->ara_client) {
657
+ cm36651->ara_client = i2c_new_dummy_device(client->adapter, CM36651_ARA);
658
+ if (IS_ERR(cm36651->ara_client)) {
662659 dev_err(&client->dev, "%s: new i2c device failed\n", __func__);
663
- ret = -ENODEV;
660
+ ret = PTR_ERR(cm36651->ara_client);
664661 goto error_i2c_unregister_ps;
665662 }
666663
667664 mutex_init(&cm36651->lock);
668
- indio_dev->dev.parent = &client->dev;
669665 indio_dev->channels = cm36651_channels;
670666 indio_dev->num_channels = ARRAY_SIZE(cm36651_channels);
671667 indio_dev->info = &cm36651_info;