Message ID | 20230921144400.62380-4-dlechner@baylibre.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp5192772vqi; Thu, 21 Sep 2023 16:01:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEYRGJevK43eAI0I7K11umjESYoMroHvMjaxD79Y9scgFVVFeNSqa5PjY2aTLDYwvw54sM/ X-Received: by 2002:a05:6a00:a1b:b0:68f:dfda:1814 with SMTP id p27-20020a056a000a1b00b0068fdfda1814mr7622986pfh.18.1695337298953; Thu, 21 Sep 2023 16:01:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695337298; cv=none; d=google.com; s=arc-20160816; b=mKYG6+0BSsND/w/7WngSKocA5koPIY+iuxNMVYiXf087J27/dpOQ4yQ4IRCacqJdj1 pmvBmGf39P0KfdiWt9NRy0aq3uiuB6E4Z4HZrsCXY9UmDLtCTarfqrbVuzdsH9EtBQsy QOqZyJZozpeN9JvTdZRFreyIO+3SeRkO/kRGD9vz4nfjxNoDCOxjoow7JSI/RQ7VtzMQ a08lzC6U4zkvt27hlqVesaDKBFa3oUFkBCGlaxZgjpuM67S+XYST0J/kz7opW5Zaj0uO 2Q4ZKV2E5CYc8+ZZM2ADBVbkfoqN9rzsXwmWCfHRTD6iUu3716fNILSiyfdErGwsE0Bu ItiA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=NWszhBlTWMiwkXqgF1w4h8oNmYkV0xe9wPBMJvnXBgI=; fh=rOC7q8UJisRayejF6PsoKdRfRTtXVZOwgDCXOG0B/ws=; b=GxKKJFqgX03V09uHAc3JAzB+3j7OY+9uun2eTEROg2m6zyY3jQGinlB9aCWKJSZ90O nAbiY+0Z7FlY9Fjp49zTrw7uz7bTCBns0woT2lcK246+deciPylhYo6RF/JgYrEQlqp9 Qmkqat1uWsH1jtY7avZ6emPz6QclkDB7fDx8v62K7VPRL/DQL3EMFQT2H3C6qWSI2IKW FbxTrDxI5E97tApRiEe7I2OBOjG1fijQCBzzO6aOOo8eTNSDDoOxpoZWAyhsEgeosf1Y 2cTvI69l/FtRxHCrweI09RUW3yJjeCP36wdeHSx0T2mfgvO+rYDrw/b5J7wl6gCd5PLk PYuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=QBLXTUv2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id s132-20020a63778a000000b0057822296958si2501989pgc.127.2023.09.21.16.01.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 16:01:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=QBLXTUv2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id DF997828952C; Thu, 21 Sep 2023 11:54:14 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230075AbjIUSxz (ORCPT <rfc822;ruipengqi7@gmail.com> + 28 others); Thu, 21 Sep 2023 14:53:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230428AbjIUSxV (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 21 Sep 2023 14:53:21 -0400 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F240900ED for <linux-kernel@vger.kernel.org>; Thu, 21 Sep 2023 10:46:27 -0700 (PDT) Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-50317080342so2226823e87.2 for <linux-kernel@vger.kernel.org>; Thu, 21 Sep 2023 10:46:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1695318385; x=1695923185; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NWszhBlTWMiwkXqgF1w4h8oNmYkV0xe9wPBMJvnXBgI=; b=QBLXTUv2w46Huf/WDJ3zyFzZ1LM/+FazknkYHKDSibQkMof8TcpZ69Cz7x8g9R0ifu vX5xnIjCuKDkRxGcdaAonCNJBJkY9LGlIZJ7mHQ71Z296130lHkEJ0fmi+2IAdSzWptz s8sQltIvy6G5tbj796Bpt/72torA2+qea5Is/NKnpmLDir/TlOBjiSxhuWwMs3OAKTnV 0x4LLbzcKeVP9XHqurIkwGAG0EtIDagQA+ZCjfAR9DvVfFBjy8svcL9cH+v9ikW4815O 4F+67Z9XgGebtD6KIGikm2wIYX7rT15Uqx7pVcQuo8twWtQT72/Y7nVWXat4hpH9um9t Uf8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695318385; x=1695923185; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NWszhBlTWMiwkXqgF1w4h8oNmYkV0xe9wPBMJvnXBgI=; b=niy8a5KYNohQ8xV5Y7VXwHsljiKVyy6AkbPRaLQm8fA/o9NU8QB26wRu2wADUHr0Ue b2K+wPRWNZ1RorXkQEQB8tS8DhAcryev1aYOTi7z62xjj49zon+3Ey0COOF5PjGXdfe4 ve7Hq2PtvKZQQcbf7ahnMn2lxrtfpx0e4UER+mZKhho7xYRuN0sxhvAKhGpWlcF6ErJH YDaZctoK+lBjvYwapSeUtef26UTwdk5It+8w1U6MEem7XXPDkpNtSv7c1m0AqjW5oUIf HoHzGKVfD1PQTSomWeiO8j8LTEoaPeNY6TnBJ5o3+4nKmI+NeSdEEcb+cojo0bXng+8R n68w== X-Gm-Message-State: AOJu0Yw5pM6VQgpvc4lWYn2TtTCg0TPoNSxlPMNFdmSW4s0hX1jri/+q QaK6eH+UlVBCQeNSfoxfuQdS5LN0jAboQZMOEaoW6NwK X-Received: by 2002:a05:600c:ad4:b0:3f9:b430:199b with SMTP id c20-20020a05600c0ad400b003f9b430199bmr5382212wmr.15.1695307455234; Thu, 21 Sep 2023 07:44:15 -0700 (PDT) Received: from localhost.localdomain (abordeaux-655-1-129-86.w90-5.abo.wanadoo.fr. [90.5.10.86]) by smtp.gmail.com with ESMTPSA id s17-20020a1cf211000000b003fe2a40d287sm2125515wmc.1.2023.09.21.07.44.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 07:44:14 -0700 (PDT) From: David Lechner <dlechner@baylibre.com> To: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-staging@lists.linux.dev Cc: linux-kernel@vger.kernel.org, Jonathan Cameron <jic23@kernel.org>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Conor Dooley <conor+dt@kernel.org>, Michael Hennerich <Michael.Hennerich@analog.com>, =?utf-8?q?Nuno_S=C3=A1?= <nuno.sa@analog.com>, Axel Haslam <ahaslam@baylibre.com>, Philip Molloy <pmolloy@baylibre.com>, David Lechner <dlechner@baylibre.com> Subject: [PATCH v2 03/19] staging: iio: resolver: ad2s1210: fix ad2s1210_show_fault Date: Thu, 21 Sep 2023 09:43:44 -0500 Message-Id: <20230921144400.62380-4-dlechner@baylibre.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230921144400.62380-1-dlechner@baylibre.com> References: <20230921144400.62380-1-dlechner@baylibre.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Thu, 21 Sep 2023 11:54:14 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777690003394324237 X-GMAIL-MSGID: 1777690003394324237 |
Series |
iio: resolver: move ad2s1210 out of staging
|
|
Commit Message
David Lechner
Sept. 21, 2023, 2:43 p.m. UTC
When reading the fault attribute, an empty string was printed if the
fault register value was non-zero.
This is fixed by checking that the return value is less than zero
instead of not zero.
Also always print two hex digits while we are touching this line.
Signed-off-by: David Lechner <dlechner@baylibre.com>
---
drivers/staging/iio/resolver/ad2s1210.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Thu, 21 Sep 2023 09:43:44 -0500 David Lechner <dlechner@baylibre.com> wrote: > When reading the fault attribute, an empty string was printed if the > fault register value was non-zero. > > This is fixed by checking that the return value is less than zero > instead of not zero. > > Also always print two hex digits while we are touching this line. > > Signed-off-by: David Lechner <dlechner@baylibre.com> To trim this set down as quickly as possible I'll pick up anything I can as I read through them. Applied this one to the togreg branch of iio.git and pushed out as testing for 0-day etc to poke it. I doubt it's worth backporting but I don't think we mind if the bots find it and people want to carry it in stable. Thanks, Jonathan > --- > drivers/staging/iio/resolver/ad2s1210.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/iio/resolver/ad2s1210.c b/drivers/staging/iio/resolver/ad2s1210.c > index 06de5823eb8e..84743e31261a 100644 > --- a/drivers/staging/iio/resolver/ad2s1210.c > +++ b/drivers/staging/iio/resolver/ad2s1210.c > @@ -393,7 +393,7 @@ static ssize_t ad2s1210_show_fault(struct device *dev, > ret = ad2s1210_config_read(st, AD2S1210_REG_FAULT); > mutex_unlock(&st->lock); > > - return ret ? ret : sprintf(buf, "0x%x\n", ret); > + return (ret < 0) ? ret : sprintf(buf, "0x%02x\n", ret); > } > > static ssize_t ad2s1210_clear_fault(struct device *dev,
diff --git a/drivers/staging/iio/resolver/ad2s1210.c b/drivers/staging/iio/resolver/ad2s1210.c index 06de5823eb8e..84743e31261a 100644 --- a/drivers/staging/iio/resolver/ad2s1210.c +++ b/drivers/staging/iio/resolver/ad2s1210.c @@ -393,7 +393,7 @@ static ssize_t ad2s1210_show_fault(struct device *dev, ret = ad2s1210_config_read(st, AD2S1210_REG_FAULT); mutex_unlock(&st->lock); - return ret ? ret : sprintf(buf, "0x%x\n", ret); + return (ret < 0) ? ret : sprintf(buf, "0x%02x\n", ret); } static ssize_t ad2s1210_clear_fault(struct device *dev,