Message ID | 429804dac3b1ea55dd233d1e2fdf94240e2f2b93.1684220962.git.mazziesaccount@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp244925vqo; Tue, 16 May 2023 00:43:39 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4CaBjWIUlOdlIsT56SIZBid7MSteqlH+TIK3EubIhLvTHQhPVTlZK4XiBunF+DG5s5tNkN X-Received: by 2002:a05:6a20:a123:b0:105:12ab:878f with SMTP id q35-20020a056a20a12300b0010512ab878fmr13282801pzk.56.1684223018846; Tue, 16 May 2023 00:43:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684223018; cv=none; d=google.com; s=arc-20160816; b=c630QpA4ifMvyEK2GuGt6D6RRwkT0tGoAqWMmX5VlH3m9ZYY2eD6YS80h1MPa6v3py Wks7Zip0VrK8Y/TAo89wNyDtIWe3JXIaygg4FZvzu74y0Z6q1xGBMbGL6Co+VCZLuBu8 yecLNpwcp3Htery7fzT2NuBkuLCFhWEBXZcCfz1KuqqMEPzfWxldOBzDdw/8rD3XS1g4 TX9OMCBW5+Ub51UoQOQbYzx6rs2N670Y3ul6j7p04HkGlsBr9Yj70lbLDeUexzlEz/nr 9jgSwVsXxYwS1088ncb7nnGcq+kTJjmJO4GT5BumfjRAq5/+sE5lv1STbX4d4XydlNHl UVGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=xlM3eYv1IZ/hNqJzORarcpDSgFBeHnRSgoVNeCMN0OI=; b=XuD6PXSEZtZ+f5JGv8/8JD0j4YVNORHPa90NoJuNjF6m3nSGyWRE5sV4lGz6sEUoO0 lFMLvvyC/rLAhB+PQp93YIWo4+V3+MOnHAntkWSCG9T5d5UO8NliT8o4vazf5E9rYw96 MEX6md4i85SgCr9w4yLgJL4jmajpEaw9vTuXPdOvdApkWwb4muhquIIeV4o+A+rjmmmK E9iAqCY6MuQfN0YSY3cGoN5vpcBOgvfaxcMCQvxzr3lXu1CgOKugMei12kRA5wWhudcF JD5W1TppQmHSzVpVGC/Xx5xW4iL8Vg3YVqaZqGjKpdSWOqK6oyawf70vRtXXGrGJtTLO BpoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=CYF2awqA; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a28-20020a637f1c000000b005303c3dedc2si19024328pgd.419.2023.05.16.00.43.23; Tue, 16 May 2023 00:43:38 -0700 (PDT) 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=@gmail.com header.s=20221208 header.b=CYF2awqA; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231145AbjEPHNE (ORCPT <rfc822;peekingduck44@gmail.com> + 99 others); Tue, 16 May 2023 03:13:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230448AbjEPHMw (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 16 May 2023 03:12:52 -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 DBF6E1BD3; Tue, 16 May 2023 00:12:47 -0700 (PDT) Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-4f24cfb8539so12372134e87.3; Tue, 16 May 2023 00:12:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684221166; x=1686813166; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=xlM3eYv1IZ/hNqJzORarcpDSgFBeHnRSgoVNeCMN0OI=; b=CYF2awqA3QBPqECdXTLxEG95LOlfTJWtn1YpWmrDv19exiCwfnk9p+iVSfFFn4sOEN 2epPa0KICye73idQTg1vSX0IDvHfHxyx1qK7Gnatc1njwlqOiI5Vw+UKeEcC7QM6Fh0d 3G75lwc1QLsBXbqKnxk2kL6NoVMxEPKxFNUGn1QXglTN9H9+ZdAZYLOJ2dBWwX9S+ztv phu2u2xg9TKcDe3Nm9UYDQzeUzhUEc8ycuLElK8kObvyPT4+1qqDJ3IoHzahBoPXz7HG kuhAPHG0q0JrfDl2wCuZK7eHjQ3q/gN3uwIfGBbe1keuI9V3sKdf1bM3QA65rBTsx/52 7Fzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684221166; x=1686813166; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=xlM3eYv1IZ/hNqJzORarcpDSgFBeHnRSgoVNeCMN0OI=; b=RT2PMqGOg0utdShm7E4zXAA5kAqM17w2g52k9fD0KUR4stLg+zC1WtyFqRyQdqEvbh /FXNVQbj7KCfUCKHIxmXXXMGU/2T5a499bqQVg2WEUkey2Yjuog9KxVDiZ2prJXSFVyZ k35e+W5DSN/R1H3tA33j5kNmeY4v2Tr3VIPAmPDpFXClESk93V6r/h41oIsGAN3VGwJf 00PG8oYAp9Sf7lUVDXBk7wQV/J6qDj1H2izYc1X3aQ3i6IuoeXPT2eOg1hwBEKwgbMOS ydkLRts//op3+kaO4vqRm3bKgkIlz6OcGxLHEz48TfpNO6lFz4IpMRiXPKdBXLmOJPq7 +JYQ== X-Gm-Message-State: AC+VfDwYkK3UQyE54aelkILwn1deY6sdFicxWAMtioeloyLc+DqfAdga nB3wQm/tVsLmZEwHOmqvMJ8= X-Received: by 2002:ac2:5197:0:b0:4f1:43b9:a600 with SMTP id u23-20020ac25197000000b004f143b9a600mr7658465lfi.60.1684221165779; Tue, 16 May 2023 00:12:45 -0700 (PDT) Received: from fedora (62-78-225-252.bb.dnainternet.fi. [62.78.225.252]) by smtp.gmail.com with ESMTPSA id u25-20020ac243d9000000b004f3892d21a5sm198196lfl.69.2023.05.16.00.12.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 May 2023 00:12:45 -0700 (PDT) Date: Tue, 16 May 2023 10:12:41 +0300 From: Matti Vaittinen <mazziesaccount@gmail.com> To: Matti Vaittinen <mazziesaccount@gmail.com>, Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>, Daniel Scally <djrscally@gmail.com>, Heikki Krogerus <heikki.krogerus@linux.intel.com>, Sakari Ailus <sakari.ailus@linux.intel.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, "Rafael J. Wysocki" <rafael@kernel.org>, Lars-Peter Clausen <lars@metafoo.de>, Michael Hennerich <Michael.Hennerich@analog.com>, Jonathan Cameron <jic23@kernel.org>, Andreas Klinger <ak@it-klinger.de>, Marcin Wojtas <mw@semihalf.com>, Russell King <linux@armlinux.org.uk>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Jonathan =?iso-8859-1?q?Neusch=E4fer?= <j.neuschaefer@gmx.net>, Linus Walleij <linus.walleij@linaro.org>, Paul Cercueil <paul@crapouillou.net>, Wolfram Sang <wsa@kernel.org>, Akhil R <akhilrajeev@nvidia.com>, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, netdev@vger.kernel.org, openbmc@lists.ozlabs.org, linux-gpio@vger.kernel.org, linux-mips@vger.kernel.org Subject: [PATCH v4 2/7] iio: mb1232: relax return value check for IRQ get Message-ID: <429804dac3b1ea55dd233d1e2fdf94240e2f2b93.1684220962.git.mazziesaccount@gmail.com> References: <cover.1684220962.git.mazziesaccount@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="YZ9e9PLl/tEtytF1" Content-Disposition: inline In-Reply-To: <cover.1684220962.git.mazziesaccount@gmail.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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?1766035835981697629?= X-GMAIL-MSGID: =?utf-8?q?1766035835981697629?= |
Series |
fix fwnode_irq_get[_byname()] returnvalue
|
|
Commit Message
Matti Vaittinen
May 16, 2023, 7:12 a.m. UTC
fwnode_irq_get() was changed to not return 0 anymore.
Drop check for return value 0.
Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
---
The first patch of the series changes the fwnode_irq_get() so this depends
on the first patch of the series and should not be applied alone.
---
drivers/iio/proximity/mb1232.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Comments
On Tue, May 16, 2023 at 10:12:41AM +0300, Matti Vaittinen wrote: > fwnode_irq_get() was changed to not return 0 anymore. > > Drop check for return value 0. ... > - if (data->irqnr <= 0) { > + if (data->irqnr < 0) { > /* usage of interrupt is optional */ > data->irqnr = -1; > } else { After this change I'm not sure we need this branch at all, I mean that -errn is equal to -1 in the code (but needs to be checked for silly checks like == -1). Hence Entire excerpt can be replaced with if (data->irqnr > 0) {
On 5/17/23 19:47, Andy Shevchenko wrote: > On Tue, May 16, 2023 at 10:12:41AM +0300, Matti Vaittinen wrote: >> fwnode_irq_get() was changed to not return 0 anymore. >> >> Drop check for return value 0. > > ... > >> - if (data->irqnr <= 0) { >> + if (data->irqnr < 0) { >> /* usage of interrupt is optional */ >> data->irqnr = -1; >> } else { > > > After this change I'm not sure we need this branch at all, I mean that -errn is > equal to -1 in the code (but needs to be checked for silly checks like == -1). > > Hence > > Entire excerpt can be replaced with > > if (data->irqnr > 0) { > I agree. Furthermore, at a quick glance it seems the whole irqnr could be dropped from the private data, and the private data struct could probably be static. I'd send them as separate clean-ups though as those changes are not really related to this return-value series. Yours, -- Matti
On 5/19/23 08:00, Matti Vaittinen wrote: > On 5/17/23 19:47, Andy Shevchenko wrote: >> On Tue, May 16, 2023 at 10:12:41AM +0300, Matti Vaittinen wrote: >>> fwnode_irq_get() was changed to not return 0 anymore. >>> >>> Drop check for return value 0. >> >> ... >> >>> - if (data->irqnr <= 0) { >>> + if (data->irqnr < 0) { >>> /* usage of interrupt is optional */ >>> data->irqnr = -1; >>> } else { >> >> >> After this change I'm not sure we need this branch at all, I mean that >> -errn is >> equal to -1 in the code (but needs to be checked for silly checks like >> == -1). >> >> Hence >> >> Entire excerpt can be replaced with >> >> if (data->irqnr > 0) { >> > > I agree. Furthermore, at a quick glance it seems the whole irqnr could > be dropped from the private data, and the private data struct could > probably be static. I'd send them as separate clean-ups though as those > changes are not really related to this return-value series. Please, ignore everything I wrote above, except that I agree to your suggestion. I was writing utter nonsense. Sorry for the noise. > > Yours, > -- Matti >
diff --git a/drivers/iio/proximity/mb1232.c b/drivers/iio/proximity/mb1232.c index e70cac8240af..2ab3e3fb2bae 100644 --- a/drivers/iio/proximity/mb1232.c +++ b/drivers/iio/proximity/mb1232.c @@ -76,7 +76,7 @@ static s16 mb1232_read_distance(struct mb1232_data *data) goto error_unlock; } - if (data->irqnr >= 0) { + if (data->irqnr > 0) { /* it cannot take more than 100 ms */ ret = wait_for_completion_killable_timeout(&data->ranging, HZ/10); @@ -212,7 +212,7 @@ static int mb1232_probe(struct i2c_client *client) init_completion(&data->ranging); data->irqnr = fwnode_irq_get(dev_fwnode(&client->dev), 0); - if (data->irqnr <= 0) { + if (data->irqnr < 0) { /* usage of interrupt is optional */ data->irqnr = -1; } else {