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)