Message ID | 20230131103359.625081-1-alexander.stein@ew.tq-group.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2678990wrn; Tue, 31 Jan 2023 02:48:58 -0800 (PST) X-Google-Smtp-Source: AK7set+nZ6NmaxuOc52AcZKwPMOKXggdSSHEiUYshsC5c7U8/XoUFupsi3NY9Wz+83ZpRYh0/YYJ X-Received: by 2002:a17:906:1cd6:b0:883:4ce3:99c2 with SMTP id i22-20020a1709061cd600b008834ce399c2mr10750090ejh.34.1675162138041; Tue, 31 Jan 2023 02:48:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675162138; cv=none; d=google.com; s=arc-20160816; b=RkXbW7NYTJ81FRJ4mFSaLM6Y8h2QiRBkazyLgDNOR6En9LV8fu/egoFduu9wqj0sNj DcJ23f6SZ7xznNF1b2NFXc683PNXzWvlFsUbUACbYcmuQttGwOCKds76H906/6aPyo7T ctHk8HUB1VKdWm6BZRuPYN16STB19ql+XV38EiL1Yid1tZhZHTPFb+8SBeAXmvYRNfr+ cLFBtKOrPokjEGbJimdt8OrwIhcBpmhO0OEWrYJUUakfZ6Cfowr7Dek3qgsuDKrRT9pO cEZ8s0dAHoakRxbGDbCt5K6+vdhIlntsYKT448NK6tqj+agQDEcKz/DxOO8Tx0nvDD38 efUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature:dkim-signature; bh=r4kjuULXMnJtmj88iglwf80C4myiNq+dzKNJ7ZMal+c=; b=h4Tsi1QlemV1mvDKy+BScDAAuXusXVjIu0+Cknx3W1ZKq6FHUZ6j680y+OsEIZJ9/j 8i3nnJzUyEEqHkfV9ZaBVmAg5yDozM9Dc/7yih3y72OCTFPwByl8FUYc8fea8JPK1VQJ 3oa6U3G4YLbzp5neB9umUGf5KoZbG20L//OG8WtVw1ZK6cyUj8Pr0fMA1W/qatpt8j5i ViUoQGgoTdR4Nb7iSQC4985H8Sf2g8QcKnpXy/1nto/jZBKzA14zT/3RQVQYeT5fmvqb qI9fnsjIXWai7Yn/8jvDMaZBvqcOHe359/8rBe82h4/uBcDNtrwF+yk+Mab631+ZfWAd NKIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tq-group.com header.s=key1 header.b=UzvAd1En; dkim=pass header.i=@tq-group.com header.s=key1 header.b=AlyjSfLv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=tq-group.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c20-20020a1709063f1400b0084d1a2c5a0asi362448ejj.937.2023.01.31.02.48.34; Tue, 31 Jan 2023 02:48:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@tq-group.com header.s=key1 header.b=UzvAd1En; dkim=pass header.i=@tq-group.com header.s=key1 header.b=AlyjSfLv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=tq-group.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230013AbjAaKeH (ORCPT <rfc822;maxin.john@gmail.com> + 99 others); Tue, 31 Jan 2023 05:34:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229608AbjAaKeG (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 31 Jan 2023 05:34:06 -0500 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8188C1422A; Tue, 31 Jan 2023 02:34:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1675161244; x=1706697244; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=r4kjuULXMnJtmj88iglwf80C4myiNq+dzKNJ7ZMal+c=; b=UzvAd1EnwRn2DmRzzbLMvs6EXQygS2arczCpKfJT97HTT56T0k5d/wkZ ZRkFPfKZNfm5UsRJHUuhhfUMIQGy5oqWrY/fT+PNVFbX7RqX0RYaoUKo2 XURCrSlQuQKTiwxtKM0YKi73VRsTfrymYbbZD9V78ngkZSR8HZWC4Tc7q 1q1HC7jmyjAAfaPrFa5Ih/Pjx3lSy0+1uQGbbzvUcdprxxzkz37gRoDBE QlmfG2GV6v60WC4Jq9tX0cyKPGyRxf7MeDJT0RVk7mKbCGCQ9bDN5zJ7w 0jhrJe4+iQdKqceYb9acKU5+wEDpEiXXBS5nKd11qSYi0CXrsPCLbF2kt w==; X-IronPort-AV: E=Sophos;i="5.97,261,1669071600"; d="scan'208";a="28767327" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 31 Jan 2023 11:34:03 +0100 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Tue, 31 Jan 2023 11:34:03 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Tue, 31 Jan 2023 11:34:03 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1675161243; x=1706697243; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=r4kjuULXMnJtmj88iglwf80C4myiNq+dzKNJ7ZMal+c=; b=AlyjSfLvgHNDFL3vxw6/gzOGrVWY1TpFOMQNQjBH95ntpK93iXdesPsu AIi4Rv11xDCt8sRJz2e6lQBZhZp/YAqlxrYdf9+L6za3P2YSopZT7HHZ1 SWz4QZZR0v5SW0A3JqAwwqTmX+oMBcn9a8eKUzHlJC4qZutsjmefzJ02L n2azQALl6q9WxjlaOKX9Y9M/B7uClZP+okNR72kt5jypjiT8Rp0lJ9jRl JOuOSBHy6Mf0cqfyZ6yr27cVibDk2t9F6G3dbSE3k1d3qeweyDEaQ1Ng+ 2wodbbN4JW/QQhNeiSXDtRF7MdAp5YclxjNDLEeq40UEXCcOXlgTUIiVq g==; X-IronPort-AV: E=Sophos;i="5.97,261,1669071600"; d="scan'208";a="28767326" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 31 Jan 2023 11:34:02 +0100 Received: from steina-w.tq-net.de (unknown [10.123.53.21]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id AA533280072; Tue, 31 Jan 2023 11:34:02 +0100 (CET) From: Alexander Stein <alexander.stein@ew.tq-group.com> To: Jean Delvare <jdelvare@suse.com>, Guenter Roeck <linux@roeck-us.net> Cc: Alexander Stein <alexander.stein@ew.tq-group.com>, linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/1] hwmon: (iio_hwmon) use dev_err_probe Date: Tue, 31 Jan 2023 11:33:59 +0100 Message-Id: <20230131103359.625081-1-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756534813949260143?= X-GMAIL-MSGID: =?utf-8?q?1756534813949260143?= |
Series |
[1/1] hwmon: (iio_hwmon) use dev_err_probe
|
|
Commit Message
Alexander Stein
Jan. 31, 2023, 10:33 a.m. UTC
Instead of just returning an error code, add an error message as well.
While at it, simplify the code and use a common return path.
Upon deferral this also nicely lists the following message in
/sys/kernel/debug/devices_deferred:
adc iio_hwmon: Failed to get channels
Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
---
drivers/hwmon/iio_hwmon.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
Comments
On Tue, Jan 31, 2023 at 11:33:59AM +0100, Alexander Stein wrote: > Instead of just returning an error code, add an error message as well. > While at it, simplify the code and use a common return path. > Upon deferral this also nicely lists the following message in > /sys/kernel/debug/devices_deferred: > adc iio_hwmon: Failed to get channels > > Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com> Applied to hwmon-next. Thanks, Guenter > --- > drivers/hwmon/iio_hwmon.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/drivers/hwmon/iio_hwmon.c b/drivers/hwmon/iio_hwmon.c > index 3aa40893fc09..4c8a80847891 100644 > --- a/drivers/hwmon/iio_hwmon.c > +++ b/drivers/hwmon/iio_hwmon.c > @@ -77,9 +77,11 @@ static int iio_hwmon_probe(struct platform_device *pdev) > > channels = devm_iio_channel_get_all(dev); > if (IS_ERR(channels)) { > - if (PTR_ERR(channels) == -ENODEV) > - return -EPROBE_DEFER; > - return PTR_ERR(channels); > + ret = PTR_ERR(channels); > + if (ret == -ENODEV) > + ret = -EPROBE_DEFER; > + return dev_err_probe(dev, ret, > + "Failed to get channels\n"); > } > > st = devm_kzalloc(dev, sizeof(*st), GFP_KERNEL);
diff --git a/drivers/hwmon/iio_hwmon.c b/drivers/hwmon/iio_hwmon.c index 3aa40893fc09..4c8a80847891 100644 --- a/drivers/hwmon/iio_hwmon.c +++ b/drivers/hwmon/iio_hwmon.c @@ -77,9 +77,11 @@ static int iio_hwmon_probe(struct platform_device *pdev) channels = devm_iio_channel_get_all(dev); if (IS_ERR(channels)) { - if (PTR_ERR(channels) == -ENODEV) - return -EPROBE_DEFER; - return PTR_ERR(channels); + ret = PTR_ERR(channels); + if (ret == -ENODEV) + ret = -EPROBE_DEFER; + return dev_err_probe(dev, ret, + "Failed to get channels\n"); } st = devm_kzalloc(dev, sizeof(*st), GFP_KERNEL);