From patchwork Sun May 15 15:59:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 12850053 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71F37C433F5 for ; Sun, 15 May 2022 16:00:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237477AbiEOQAJ (ORCPT ); Sun, 15 May 2022 12:00:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233455AbiEOQAH (ORCPT ); Sun, 15 May 2022 12:00:07 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82BB615FD1 for ; Sun, 15 May 2022 09:00:06 -0700 (PDT) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nqGez-0001DO-2v; Sun, 15 May 2022 17:59:57 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1nqGex-002V2w-Vt; Sun, 15 May 2022 17:59:54 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1nqGew-009uFv-0Z; Sun, 15 May 2022 17:59:54 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jonathan Cameron Cc: Lars-Peter Clausen , Cai Huoqing , Alexandru Ardelean , linux-iio@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 1/8] iio:adc:ina2xx: Improve error reporting for problems during .remove() Date: Sun, 15 May 2022 17:59:22 +0200 Message-Id: <20220515155929.338656-2-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220515155929.338656-1-u.kleine-koenig@pengutronix.de> References: <20220515155929.338656-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1449; h=from:subject; bh=eSoAuM+RqK9CmLa4IQtEe24MxktVn2AHwMkORW+3VUk=; b=owEBbQGS/pANAwAKAcH8FHityuwJAcsmYgBigSMnVG5qTUKTzhEtT/KD8rGMbQUoRekEJ2WmyFOK BBCn8ByJATMEAAEKAB0WIQR+cioWkBis/z50pAvB/BR4rcrsCQUCYoEjJwAKCRDB/BR4rcrsCUO7B/ 9pPNJp395QnFzsMSUxNwNUw3ex0sfmbheVUOMz01FzhMantWtGoBCVtEwy9niZwybKtzp/1OmJnF4o TwOQAws0WS1dZOpxE+gJD+BDMCxG/GcB1FGS5DMqbxEWrsOT/l2uJTdOSouM7bFxxPvS4xC0G0KyDk y05UL39uQ3R+Y7k6jwtfmjFLUwbI2hVNSn382Q4fCXeJ/NGbbkJ0rZj0pb8RL9Qgtsvb5YC7CqomuM OsS1YVYjIpqjx8F8kqfEROk/Uwq8uRr1xlYuKB6eTh1ftUSLc4GG8d1nD8JRD0o1lT66k476xj4t93 Jtz1IuQ2DXaNOUBSh7g+uEy8BM9H7M X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-iio@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Returning an error value in an i2c remove callback results in a generic error message being emitted by the i2c core, but otherwise it doesn't make a difference. The device goes away anyhow and the devm cleanups are called. So instead of triggering the generic i2c error message, emit a more helpful message if a problem occurs and return 0 to suppress the generic message. This patch is a preparation for making i2c remove callbacks return void. Signed-off-by: Uwe Kleine-König --- drivers/iio/adc/ina2xx-adc.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/iio/adc/ina2xx-adc.c b/drivers/iio/adc/ina2xx-adc.c index 8d902a32a0fd..2eafe98cff3e 100644 --- a/drivers/iio/adc/ina2xx-adc.c +++ b/drivers/iio/adc/ina2xx-adc.c @@ -1039,12 +1039,18 @@ static int ina2xx_remove(struct i2c_client *client) { struct iio_dev *indio_dev = i2c_get_clientdata(client); struct ina2xx_chip_info *chip = iio_priv(indio_dev); + int ret; iio_device_unregister(indio_dev); /* Powerdown */ - return regmap_update_bits(chip->regmap, INA2XX_CONFIG, - INA2XX_MODE_MASK, 0); + ret = regmap_update_bits(chip->regmap, INA2XX_CONFIG, + INA2XX_MODE_MASK, 0); + if (ret) + dev_warn(&client->dev, "Failed to power down device (%pe)\n", + ERR_PTR(ret)); + + return 0; } static const struct i2c_device_id ina2xx_id[] = { From patchwork Sun May 15 15:59:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 12850057 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 918A6C43217 for ; Sun, 15 May 2022 16:00:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237597AbiEOQAM (ORCPT ); Sun, 15 May 2022 12:00:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237599AbiEOQAL (ORCPT ); Sun, 15 May 2022 12:00:11 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19B2515FDF for ; Sun, 15 May 2022 09:00:10 -0700 (PDT) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nqGez-0001DQ-2v; Sun, 15 May 2022 17:59:57 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1nqGey-002V34-HI; Sun, 15 May 2022 17:59:55 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1nqGew-009uFy-7x; Sun, 15 May 2022 17:59:54 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jonathan Cameron Cc: Lars-Peter Clausen , Mauro Carvalho Chehab , Andy Shevchenko , Gwendal Grignou , linux-iio@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 2/8] iio:adc:ti-ads1015: Improve error reporting for problems during .remove() Date: Sun, 15 May 2022 17:59:23 +0200 Message-Id: <20220515155929.338656-3-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220515155929.338656-1-u.kleine-koenig@pengutronix.de> References: <20220515155929.338656-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1484; h=from:subject; bh=ak8Y8sq731dMELFQ5nkm9vBb7hyEAU85OD6bWIqdHtk=; b=owEBbQGS/pANAwAKAcH8FHityuwJAcsmYgBigSMrWdSfl8gOwknD1ulfe1h5uDp4f/IOeEwFRNQz SnSDFzqJATMEAAEKAB0WIQR+cioWkBis/z50pAvB/BR4rcrsCQUCYoEjKwAKCRDB/BR4rcrsCRelCA CMnjeh4kxr3sPiG5G5wfEj1A9oLCiHzPzrSSaNbkZ1q2MkOVMgsluHIJFjxAvXDNZXlwJuNYOTQtqq 8uO7Nl3jwuG56C2fZGVWY1rrQZYprTfG8WAkOfxYJgBmVum8b+xbXpuWCC5ZFoy32Vod3kvvpPmCb1 cpXE2HzpnqhXObhioYvaF9f5cGiatKGRRDDNZHBap+kL7hEqDOaoLU6BEiDvvAf0Xu5lBpMsvnYbJD YkML/yuTMWnECjhgK5qyXnkgPlgyOL8oh9zhT8lLng6mpQaCDYpiWDDTa2ViIEZ2px7p+8trUdMf4t wr+GQ0RtdkgfWWRpUCzOTWmgt5sDmG X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-iio@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Returning an error value in an i2c remove callback results in a generic error message being emitted by the i2c core, but otherwise it doesn't make a difference. The device goes away anyhow and the devm cleanups are called. So instead of triggering the generic i2c error message, emit a more helpful message if a problem occurs and return 0 to suppress the generic message. This patch is a preparation for making i2c remove callbacks return void. Signed-off-by: Uwe Kleine-König --- drivers/iio/adc/ti-ads1015.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/iio/adc/ti-ads1015.c b/drivers/iio/adc/ti-ads1015.c index 068efbce1710..f8021d99db64 100644 --- a/drivers/iio/adc/ti-ads1015.c +++ b/drivers/iio/adc/ti-ads1015.c @@ -1061,6 +1061,7 @@ static int ads1015_remove(struct i2c_client *client) { struct iio_dev *indio_dev = i2c_get_clientdata(client); struct ads1015_data *data = iio_priv(indio_dev); + int ret; iio_device_unregister(indio_dev); @@ -1068,7 +1069,12 @@ static int ads1015_remove(struct i2c_client *client) pm_runtime_set_suspended(&client->dev); /* power down single shot mode */ - return ads1015_set_conv_mode(data, ADS1015_SINGLESHOT); + ret = ads1015_set_conv_mode(data, ADS1015_SINGLESHOT); + if (ret) + dev_warn(&client->dev, "Failed to power down (%pe)\n", + ERR_PTR(ret)); + + return 0; } #ifdef CONFIG_PM From patchwork Sun May 15 15:59:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 12850059 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 01A7BC433FE for ; Sun, 15 May 2022 16:00:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230421AbiEOQAN (ORCPT ); Sun, 15 May 2022 12:00:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237608AbiEOQAL (ORCPT ); Sun, 15 May 2022 12:00:11 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7F5515FE3 for ; Sun, 15 May 2022 09:00:10 -0700 (PDT) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nqGez-0001DR-2v; Sun, 15 May 2022 17:59:57 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1nqGey-002V37-Ng; Sun, 15 May 2022 17:59:55 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1nqGew-009uG1-EG; Sun, 15 May 2022 17:59:54 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jonathan Cameron Cc: Lars-Peter Clausen , Matt Ranostay , Paul Cercueil , Mauro Carvalho Chehab , linux-iio@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 3/8] iio:chemical:atlas: Improve error reporting for problems during .remove() Date: Sun, 15 May 2022 17:59:24 +0200 Message-Id: <20220515155929.338656-4-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220515155929.338656-1-u.kleine-koenig@pengutronix.de> References: <20220515155929.338656-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1553; h=from:subject; bh=fA1+FAIBHgw7zXaewwD+Dy2jNBzBzvYKbbXo+d8uLJo=; b=owEBbQGS/pANAwAKAcH8FHityuwJAcsmYgBigSMzvYAZvfuqKpnG5Xnn4a+b5jSqX5waN8ADthT1 NDjT0qiJATMEAAEKAB0WIQR+cioWkBis/z50pAvB/BR4rcrsCQUCYoEjMwAKCRDB/BR4rcrsCWG0B/ sGUca3Ikt61nMb3y9jXqyJr3JIgDM3hL0GreNIGUMiWRzIwa4NL7IhDRp4ur2s7F/B7BQIndyQTj6u 2vYMQbKH9X7SWMYHHVf/0HACd4hXUckgFtpDzUOPsyXLXKAfzviu5JBjhHoRpmMKElloBgA514HhB5 /CHocGkWCDg1JraK06WkhSYDCwyRxnP8udbBT4HM/EoicUXPmRIevlBkJJsXDvdCi+n6SCXLfwv8+K 14DcGuLjUls25twpQPoI85omMlSp3rqxiAQO5vlaCwmQcOj+tmUJlWx0cixuOtEEofE0TcLtg/quFc RjitRst40pDnLyCWvUIdJirKo/iFYw X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-iio@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Returning an error value in an i2c remove callback results in a generic error message being emitted by the i2c core, but otherwise it doesn't make a difference. The device goes away anyhow and the devm cleanups are called. So instead of triggering the generic i2c error message, emit a more helpful message if a problem occurs and return 0 to suppress the generic message. This patch is a preparation for making i2c remove callbacks return void. Signed-off-by: Uwe Kleine-König --- drivers/iio/chemical/atlas-sensor.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/iio/chemical/atlas-sensor.c b/drivers/iio/chemical/atlas-sensor.c index 56dea9734c8d..8378c00fa2ff 100644 --- a/drivers/iio/chemical/atlas-sensor.c +++ b/drivers/iio/chemical/atlas-sensor.c @@ -726,6 +726,7 @@ static int atlas_remove(struct i2c_client *client) { struct iio_dev *indio_dev = i2c_get_clientdata(client); struct atlas_data *data = iio_priv(indio_dev); + int ret; iio_device_unregister(indio_dev); iio_triggered_buffer_cleanup(indio_dev); @@ -734,7 +735,12 @@ static int atlas_remove(struct i2c_client *client) pm_runtime_disable(&client->dev); pm_runtime_set_suspended(&client->dev); - return atlas_set_powermode(data, 0); + ret = atlas_set_powermode(data, 0); + if (ret) + dev_err(&client->dev, "Failed to power down device (%pe)\n", + ERR_PTR(ret)); + + return 0; } static int atlas_runtime_suspend(struct device *dev) From patchwork Sun May 15 15:59:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 12850054 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 253B5C433FE for ; Sun, 15 May 2022 16:00:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237583AbiEOQAK (ORCPT ); Sun, 15 May 2022 12:00:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230421AbiEOQAH (ORCPT ); Sun, 15 May 2022 12:00:07 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACF6615FCB for ; Sun, 15 May 2022 09:00:05 -0700 (PDT) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nqGez-0001DS-2w; Sun, 15 May 2022 17:59:57 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1nqGey-002V3B-Rc; Sun, 15 May 2022 17:59:55 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1nqGew-009uG5-T3; Sun, 15 May 2022 17:59:54 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jonathan Cameron Cc: Lars-Peter Clausen , Alexandru Ardelean , linux-iio@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 4/8] iio:chemical:ccs811: Improve error reporting for problems during .remove() Date: Sun, 15 May 2022 17:59:25 +0200 Message-Id: <20220515155929.338656-5-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220515155929.338656-1-u.kleine-koenig@pengutronix.de> References: <20220515155929.338656-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1543; h=from:subject; bh=89uA/7vwbe1iOVDxMk9Y38leAYARGglu9ScMQPfqaXE=; b=owEBbQGS/pANAwAKAcH8FHityuwJAcsmYgBigSM8FWphPDm8P/q2nG8AdsWPYwBJQkbvj5IX/mOp Xy8KPaKJATMEAAEKAB0WIQR+cioWkBis/z50pAvB/BR4rcrsCQUCYoEjPAAKCRDB/BR4rcrsCZsSB/ 4gymhRZoE+W6pcksVF8FTuwu+0YbtexadtUsroa7HJb1ko3P2m0dSYWGO/l07ZVEF8HndHoD4a6nck OVY7g4Wo/S6GmFor7QWQ+8ZDYJFb6ligYB318jKLCJ68ikYAlOHHFcLZZjviUq2v7fOgetm5f8Vj+6 6VwW12UwdcTs6nPe6pLdkIdiN4wts7O+tstBt/bl/CYROveJjUjJxDxgrTbCB6Q+f8h94xcu06Z35d +Ul9n4xUwvdqpqkSNXhUG2erO023ybYQtpHCCBROemNkfxEyavTfRV+pJ5LUY4vbl3q8rKboAOP3by q8DZM9nHNRPMQQmrUxQPU4ly1EdPGr X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-iio@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Returning an error value in an i2c remove callback results in a generic error message being emitted by the i2c core, but otherwise it doesn't make a difference. The device goes away anyhow and the devm cleanups are called. So instead of triggering the generic i2c error message, emit a more helpful message if a problem occurs and return 0 to suppress the generic message. This patch is a preparation for making i2c remove callbacks return void. Signed-off-by: Uwe Kleine-König --- drivers/iio/chemical/ccs811.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/iio/chemical/ccs811.c b/drivers/iio/chemical/ccs811.c index 847194fa1e46..c38093e24fca 100644 --- a/drivers/iio/chemical/ccs811.c +++ b/drivers/iio/chemical/ccs811.c @@ -536,14 +536,20 @@ static int ccs811_remove(struct i2c_client *client) { struct iio_dev *indio_dev = i2c_get_clientdata(client); struct ccs811_data *data = iio_priv(indio_dev); + int ret; iio_device_unregister(indio_dev); iio_triggered_buffer_cleanup(indio_dev); if (data->drdy_trig) iio_trigger_unregister(data->drdy_trig); - return i2c_smbus_write_byte_data(client, CCS811_MEAS_MODE, - CCS811_MODE_IDLE); + ret = i2c_smbus_write_byte_data(client, CCS811_MEAS_MODE, + CCS811_MODE_IDLE); + if (ret) + dev_warn(&client->dev, "Failed to power down device (%pe)\n", + ERR_PTR(ret)); + + return 0; } static const struct i2c_device_id ccs811_id[] = { From patchwork Sun May 15 15:59:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 12850058 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4212CC433F5 for ; Sun, 15 May 2022 16:00:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237599AbiEOQAN (ORCPT ); Sun, 15 May 2022 12:00:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230421AbiEOQAL (ORCPT ); Sun, 15 May 2022 12:00:11 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED62315FDE for ; Sun, 15 May 2022 09:00:09 -0700 (PDT) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nqGez-0001DT-2u; Sun, 15 May 2022 17:59:57 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1nqGez-002V3G-AD; Sun, 15 May 2022 17:59:55 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1nqGex-009uGA-5c; Sun, 15 May 2022 17:59:55 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jonathan Cameron Cc: Lars-Peter Clausen , Mauro Carvalho Chehab , Gwendal Grignou , linux-iio@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 5/8] iio:light:pa12203001: Improve error reporting for problems during .remove() Date: Sun, 15 May 2022 17:59:26 +0200 Message-Id: <20220515155929.338656-6-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220515155929.338656-1-u.kleine-koenig@pengutronix.de> References: <20220515155929.338656-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1479; h=from:subject; bh=6dBOIS62JAJeYZsnqVdR5KwvKbER3ILLZ/8yd+koxlw=; b=owEBbQGS/pANAwAKAcH8FHityuwJAcsmYgBigSNF260Q6GAvjzZ19T/ADa2CyAfHeT+Gmqvb+c7a 9ZyOLqmJATMEAAEKAB0WIQR+cioWkBis/z50pAvB/BR4rcrsCQUCYoEjRQAKCRDB/BR4rcrsCZ1lB/ 4ugH3RAUlXmQoWi1FnI28q6X1dN+xW/ALbWj3mo0PiwuF4JuttdMVvYfOR6/y0v1fyDkhg3qe6tyC7 NCtDiVHbucdyQ+s8CEbHT7PiTOwh+554Le8LsGuIdKkrW6eAPUvmJs2l4FPci5WqaBi8jQMAOY/xO+ ALFOFVkjpKLC8VCQYnKRY07cG13HsuuiOZLmEdoHPRryy38FvLVNWdLIme3jw06piBgvAXudDaKtVN 8i+/OSMv0p3p11oNZr5iDTtxNs0z8F4bU3iFB9gtxT75jCfh6jM7OEm1mbEF3z5TIiUkMUv/LkT2li 8jGg2LFgFWNpQFXSbJoSaMEWhoO/zs X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-iio@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Returning an error value in an i2c remove callback results in a generic error message being emitted by the i2c core, but otherwise it doesn't make a difference. The device goes away anyhow and the devm cleanups are called. So instead of triggering the generic i2c error message, emit a more helpful message if a problem occurs and return 0 to suppress the generic message. This patch is a preparation for making i2c remove callbacks return void. Signed-off-by: Uwe Kleine-König --- drivers/iio/light/pa12203001.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/iio/light/pa12203001.c b/drivers/iio/light/pa12203001.c index 528fa5dd2b13..772874e707ae 100644 --- a/drivers/iio/light/pa12203001.c +++ b/drivers/iio/light/pa12203001.c @@ -397,13 +397,19 @@ static int pa12203001_probe(struct i2c_client *client, static int pa12203001_remove(struct i2c_client *client) { struct iio_dev *indio_dev = i2c_get_clientdata(client); + int ret; iio_device_unregister(indio_dev); pm_runtime_disable(&client->dev); pm_runtime_set_suspended(&client->dev); - return pa12203001_power_chip(indio_dev, PA12203001_CHIP_DISABLE); + ret = pa12203001_power_chip(indio_dev, PA12203001_CHIP_DISABLE); + if (ret) + dev_warn(&client->dev, "Failed to power down (%pe)\n", + ERR_PTR(ret)); + + return 0; } #if defined(CONFIG_PM_SLEEP) || defined(CONFIG_PM) From patchwork Sun May 15 15:59:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 12850055 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BCB34C433EF for ; Sun, 15 May 2022 16:00:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237611AbiEOQAL (ORCPT ); Sun, 15 May 2022 12:00:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233455AbiEOQAK (ORCPT ); Sun, 15 May 2022 12:00:10 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C9E115FD9 for ; Sun, 15 May 2022 09:00:09 -0700 (PDT) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nqGez-0001DU-2w; Sun, 15 May 2022 17:59:57 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1nqGez-002V3I-B3; Sun, 15 May 2022 17:59:55 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1nqGex-009uGE-DI; Sun, 15 May 2022 17:59:55 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jonathan Cameron Cc: Lars-Peter Clausen , Gwendal Grignou , Mauro Carvalho Chehab , linux-iio@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 6/8] iio:light:us5182d: Improve error reporting for problems during .remove() Date: Sun, 15 May 2022 17:59:27 +0200 Message-Id: <20220515155929.338656-7-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220515155929.338656-1-u.kleine-koenig@pengutronix.de> References: <20220515155929.338656-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1472; h=from:subject; bh=L6jC/LjutKKO276LY8apTidLyjyXQqJ4c1JIhDFeOuQ=; b=owEBbQGS/pANAwAKAcH8FHityuwJAcsmYgBigSNNqsME04vvQcWyAMSzrOMYHWjIdxKPXY+4ICde wg6337CJATMEAAEKAB0WIQR+cioWkBis/z50pAvB/BR4rcrsCQUCYoEjTQAKCRDB/BR4rcrsCbQtCA CD0EpZ2yn0hf6oh+yNbkXl26SaMNd6j2ixN2R8kFH4Us2h69e08c2iMpP9KGZPqDtPNnCR9cszSBBA doh02C72A5viPz/uGw3r3tYaJw8TEiI+qoNIvth4d8Re5gZn+lmf09zYEaE9j/xcYVaMswQof79BY1 GYYWAYGcUl1NxiYtFncAs/vMIxvHDUOAK/FcIRic/b/bMezVZ2omc3u8cC4Xwy1votV80Xtm6hN+gw D+d/rhFlpR+otP7zSty/FzkIs5u7O1ykWNlkI3sKDzu5Vr94L5x7/FkMcfArLN2DQYSHkKFzou3xQA yp9g5FhHaad+GZlk9blV0qBT76Dqiv X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-iio@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Returning an error value in an i2c remove callback results in a generic error message being emitted by the i2c core, but otherwise it doesn't make a difference. The device goes away anyhow and the devm cleanups are called. So instead of triggering the generic i2c error message, emit a more helpful message if a problem occurs and return 0 to suppress the generic message. This patch is a preparation for making i2c remove callbacks return void. Signed-off-by: Uwe Kleine-König --- drivers/iio/light/us5182d.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/iio/light/us5182d.c b/drivers/iio/light/us5182d.c index 1492aaf8d84c..cbd9978540fa 100644 --- a/drivers/iio/light/us5182d.c +++ b/drivers/iio/light/us5182d.c @@ -907,13 +907,19 @@ static int us5182d_probe(struct i2c_client *client, static int us5182d_remove(struct i2c_client *client) { struct us5182d_data *data = iio_priv(i2c_get_clientdata(client)); + int ret; iio_device_unregister(i2c_get_clientdata(client)); pm_runtime_disable(&client->dev); pm_runtime_set_suspended(&client->dev); - return us5182d_shutdown_en(data, US5182D_CFG0_SHUTDOWN_EN); + ret = us5182d_shutdown_en(data, US5182D_CFG0_SHUTDOWN_EN); + if (ret) + dev_warn(&client->dev, "Failed to shut down (%pe)\n", + ERR_PTR(ret)); + + return 0; } #if defined(CONFIG_PM_SLEEP) || defined(CONFIG_PM) From patchwork Sun May 15 15:59:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 12850060 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1CEE8C433F5 for ; Sun, 15 May 2022 16:00:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237612AbiEOQAO (ORCPT ); Sun, 15 May 2022 12:00:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237621AbiEOQAO (ORCPT ); Sun, 15 May 2022 12:00:14 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 673A215FE7 for ; Sun, 15 May 2022 09:00:11 -0700 (PDT) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nqGf2-0001DV-Qy; Sun, 15 May 2022 18:00:00 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1nqGez-002V3N-Nf; Sun, 15 May 2022 17:59:56 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1nqGex-009uGJ-J9; Sun, 15 May 2022 17:59:55 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jonathan Cameron Cc: Lars-Peter Clausen , Mauro Carvalho Chehab , =?utf-8?q?Nuno_S=C3=A1?= , Alexandru Ardelean , linux-iio@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 7/8] iio:light:vcnl4000: Improve error reporting for problems during .remove() Date: Sun, 15 May 2022 17:59:28 +0200 Message-Id: <20220515155929.338656-8-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220515155929.338656-1-u.kleine-koenig@pengutronix.de> References: <20220515155929.338656-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1508; h=from:subject; bh=LYLLH8JHqpkhqapmKf7rt6zhz2W7TsS502lsRZkueuo=; b=owEBbQGS/pANAwAKAcH8FHityuwJAcsmYgBigSNWoMG644npi0Op5gIN2hULvPgPg7ozXF0tmkYm qG2G83qJATMEAAEKAB0WIQR+cioWkBis/z50pAvB/BR4rcrsCQUCYoEjVgAKCRDB/BR4rcrsCdBxCA Cc7Rks0scPlOox7Kje4FCCwnp0NXaiurl4lfOYcojj8CqyLX7kWRTVPROFAMe8FlAaAdaizBemY6xl H8PSzXKAqJM+qRfbCuEg/IEzzocWNX+19mdwI93ZMpqcZqhYtvI1+HqeKbHWM93Z2YGqMutXX5ElTc HXolAYYaWPxgIh2K1GHt3IoAxd8/cpuJdL0AcybLQon1P7Zx0pcV266Q5M+u1dmLRV8GxQSqDRL3gL dAZ38gIABXOV27lQHlgg8xP0gHzSU+l5VCnHJ8tjduyav7oKirlgUUGh6JKD4jQapto1wzqVLHMM7T 0GvGJg0gTVGmnQJatJZ5bN1tXbaU6q X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-iio@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Returning an error value in an i2c remove callback results in a generic error message being emitted by the i2c core, but otherwise it doesn't make a difference. The device goes away anyhow and the devm cleanups are called. So instead of triggering the generic i2c error message, emit a more helpful message if a problem occurs and return 0 to suppress the generic message. This patch is a preparation for making i2c remove callbacks return void. Signed-off-by: Uwe Kleine-König --- drivers/iio/light/vcnl4000.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c index e02e92bc2928..947a41b86173 100644 --- a/drivers/iio/light/vcnl4000.c +++ b/drivers/iio/light/vcnl4000.c @@ -1115,13 +1115,19 @@ static int vcnl4000_remove(struct i2c_client *client) { struct iio_dev *indio_dev = i2c_get_clientdata(client); struct vcnl4000_data *data = iio_priv(indio_dev); + int ret; pm_runtime_dont_use_autosuspend(&client->dev); pm_runtime_disable(&client->dev); iio_device_unregister(indio_dev); pm_runtime_set_suspended(&client->dev); - return data->chip_spec->set_power_state(data, false); + ret = data->chip_spec->set_power_state(data, false); + if (ret) + dev_warn(&client->dev, "Failed to power down (%pe)\n", + ERR_PTR(ret)); + + return 0; } static int __maybe_unused vcnl4000_runtime_suspend(struct device *dev) From patchwork Sun May 15 15:59:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 12850056 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1FEEBC4332F for ; Sun, 15 May 2022 16:00:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233455AbiEOQAM (ORCPT ); Sun, 15 May 2022 12:00:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237597AbiEOQAL (ORCPT ); Sun, 15 May 2022 12:00:11 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A693315FDA for ; Sun, 15 May 2022 09:00:09 -0700 (PDT) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nqGez-0001Db-NG; Sun, 15 May 2022 17:59:57 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1nqGf0-002V3Q-81; Sun, 15 May 2022 17:59:56 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1nqGex-009uGM-QC; Sun, 15 May 2022 17:59:55 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jonathan Cameron Cc: Lars-Peter Clausen , Alexandru Ardelean , Gwendal Grignou , Mauro Carvalho Chehab , linux-iio@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 8/8] iio:light:vcnl4035: Improve error reporting for problems during .remove() Date: Sun, 15 May 2022 17:59:29 +0200 Message-Id: <20220515155929.338656-9-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220515155929.338656-1-u.kleine-koenig@pengutronix.de> References: <20220515155929.338656-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1604; h=from:subject; bh=QfcrT1ThkHTUpK9GPGoefXE9mnGpnAv0Bq36YG9gZO4=; b=owEBbQGS/pANAwAKAcH8FHityuwJAcsmYgBigSNZZO2mjXLNh6fChHfUC3kW2m99IPlJ9AVseb31 /ai7I02JATMEAAEKAB0WIQR+cioWkBis/z50pAvB/BR4rcrsCQUCYoEjWQAKCRDB/BR4rcrsCS9IB/ 49AgtVjE9kledMmjOmQm+SZwZhsqJGm/I/yoABWQ2yrLnPqXBg+yFnWZoqBWiAAjqitCe2UnYnmXt3 3Wir8+xKjKW+d10rGRpe5uM3odwKpCsz/SlfEFTzxAEbQUTX6WwA1IsvChOf6RjdUH7GVTaJwEwa6t 2tnZdxi+kl5vNrH5HKAMrl5WeyU1saYJUNz+bBdsxa7o2snRv/SSc+JkjphMdYVMhJ84cq/M+/2hrK OuZ9h5at3o+QgVPl6VCPi9XWQpLCLtMBfnQV2n8a0GWmBHVeR1fcTmRurk1xlyJj55PhCUQ8z6+lDc /78WQt1FVGl6/HgYskj/XioZOfjSD2 X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-iio@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Returning an error value in an i2c remove callback results in a generic error message being emitted by the i2c core, but otherwise it doesn't make a difference. The device goes away anyhow and the devm cleanups are called. So instead of triggering the generic i2c error message, emit a more helpful message if a problem occurs and return 0 to suppress the generic message. This patch is a preparation for making i2c remove callbacks return void. Signed-off-by: Uwe Kleine-König --- drivers/iio/light/vcnl4035.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/iio/light/vcnl4035.c b/drivers/iio/light/vcnl4035.c index da2bf622a67b..2aaec6bef64c 100644 --- a/drivers/iio/light/vcnl4035.c +++ b/drivers/iio/light/vcnl4035.c @@ -604,14 +604,20 @@ static int vcnl4035_probe(struct i2c_client *client, static int vcnl4035_remove(struct i2c_client *client) { struct iio_dev *indio_dev = i2c_get_clientdata(client); + int ret; pm_runtime_dont_use_autosuspend(&client->dev); pm_runtime_disable(&client->dev); iio_device_unregister(indio_dev); pm_runtime_set_suspended(&client->dev); - return vcnl4035_set_als_power_state(iio_priv(indio_dev), - VCNL4035_MODE_ALS_DISABLE); + ret = vcnl4035_set_als_power_state(iio_priv(indio_dev), + VCNL4035_MODE_ALS_DISABLE); + if (ret) + dev_warn(&client->dev, "Failed to put device into standby (%pe)\n", + ERR_PTR(ret)); + + return 0; } static int __maybe_unused vcnl4035_runtime_suspend(struct device *dev)