From patchwork Fri May 19 11:04:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matti Vaittinen X-Patchwork-Id: 13248228 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 6A219C7EE2D for ; Fri, 19 May 2023 11:05:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231959AbjESLFO (ORCPT ); Fri, 19 May 2023 07:05:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231640AbjESLFM (ORCPT ); Fri, 19 May 2023 07:05:12 -0400 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2C471989; Fri, 19 May 2023 04:04:51 -0700 (PDT) Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-4f37b860173so3472773e87.2; Fri, 19 May 2023 04:04:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684494288; x=1687086288; 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=4GNHUsSQZ7XOoZjUlNt5CHQChxGAHRFnKC6pLJgQnQ0=; b=D0X5HOiVrJHBnxegjwyw/Nwh7o5gPNfAfErjqsfy5ahtnMEqu5oZqONT/g8kr/rQyJ rj3EWCKKu0TiHK2CKBLACXgC8HUnAeLSJfIt/E+mVJ1oelJAfkqzNRep/6Jfbo1+Of+g y3yTKfiYAe+KbwfvI/2B1kvH+QN6uIViVwUJ4crxuHrpf1Sz3l4rJZxtjysdLx721hr0 IibNnCsGQfZ1NNYhdu+dg7tn2JAA0HCMzzXixZReXUhyEVge93GaEenwv22FszQPNdwJ F5exYECbCaxHwXFwQ3epapOAJzKJZBLsy2caGUMjrUfxDkojkLVl5rubkARn7tXGt7/e fYWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684494288; x=1687086288; 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=4GNHUsSQZ7XOoZjUlNt5CHQChxGAHRFnKC6pLJgQnQ0=; b=feFUbsCKK9ubzjoWuu4rIJWB2BhN/jgKHauxoynLIwkYVhxSXyEImFwehvYQ0vOp1A q3l0TJwDHsoTH3wZuOWS/XFpaPtbd7nwPgJ/olXbCFcvcHFHQ6LGzJh3cjXleUBUbAoW K0BGLferdur6tGxUP1yKqcA60wailFJhJiniN7G+kzrzwULKLYUJ5+71OliLPq73zkIS k/outzQa28UQEQ5Na2HS4SEfHAN5eftUvjLXPcvDFbmGWmKLYb3zlBeSKfLbpS272j+B LgwgxcrqUO0Ofe3UsyZkgYKdkGO+SFow9lAh+UXb/l7OCurfLc4ylvIL1q6NnzvNXpSP 1xIg== X-Gm-Message-State: AC+VfDwn5JOE7ecbqJjZbU0Kiyvw8oac5aVIH3NMgeROMThclIhoFBcb 5Selx/bo5h7lCEpe0mJ3wWI= X-Google-Smtp-Source: ACHHUZ6UTSaftFeK3PA13GKVCxEp/y7Yw4bieoWTl+HfrNQijtyPdtc4WLzKvYG93aZ4rATGZFoGkw== X-Received: by 2002:ac2:5dd7:0:b0:4ec:8245:3986 with SMTP id x23-20020ac25dd7000000b004ec82453986mr744208lfq.14.1684494288048; Fri, 19 May 2023 04:04:48 -0700 (PDT) Received: from fedora (62-78-225-252.bb.dnainternet.fi. [62.78.225.252]) by smtp.gmail.com with ESMTPSA id i13-20020a056512006d00b004ece331c830sm557641lfo.206.2023.05.19.04.04.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 04:04:47 -0700 (PDT) Date: Fri, 19 May 2023 14:04:32 +0300 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Cc: Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Greg Kroah-Hartman , "Rafael J. Wysocki" , Wolfram Sang , Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Andreas Klinger , Marcin Wojtas , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jonathan =?iso-8859-1?q?Neusch=E4fer?= , Linus Walleij , Paul Cercueil , Akhil R , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-i2c@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 v5 7/8] iio: cdc: ad7150: relax return value check for IRQ get Message-ID: <73c633ccab80bdfaa1adf6ae099cfc9d365be6a2.1684493615.git.mazziesaccount@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org fwnode_irq_get[_byname]() were changed to not return 0 anymore. The special error case where device-tree based IRQ mapping fails can't no longer be reliably detected from this return value. This yields a functional change in the driver where the mapping failure is treated as an error. The mapping failure can occur for example when the device-tree IRQ information translation call-back(s) (xlate) fail, IRQ domain is not found, IRQ type conflicts, etc. In most cases this indicates an error in the device-tree and special handling is not really required. One more thing to note is that ACPI APIs do not return zero for any failures so this special handling did only apply on device-tree based systems. Drop the special handling for DT mapping failures as these can no longer be separated from other errors at driver side. Signed-off-by: Matti Vaittinen --- Please note that I don't have the hardware to test this change. Furthermore, testing this type of device-tree error cases is not trivial, as the question we probably dive in is "what happens with the existing users who have errors in the device-tree". Answering to this question is not simple. I did this patch with minimal code changes - but a question is if we should really jump into the else branch below on all IRQ getting errors? } else { indio_dev->info = &ad7150_info_no_irq; switch (id->driver_data) { case AD7150: indio_dev->channels = ad7150_channels_no_irq; indio_dev->num_channels = ARRAY_SIZE(ad7150_channels_no_irq); break; case AD7151: indio_dev->channels = ad7151_channels_no_irq; indio_dev->num_channels = ARRAY_SIZE(ad7151_channels_no_irq); break; default: return -EINVAL; } Why do we have special handling for !chip->interrupts[0] while other errors on getting the fwnode_irq_get(dev_fwnode(&client->dev), 0); will abort the probe? 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/cdc/ad7150.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/iio/cdc/ad7150.c b/drivers/iio/cdc/ad7150.c index 79aeb0aaea67..d7ba50b9780d 100644 --- a/drivers/iio/cdc/ad7150.c +++ b/drivers/iio/cdc/ad7150.c @@ -567,8 +567,7 @@ static int ad7150_probe(struct i2c_client *client) if (chip->interrupts[1] < 0) return chip->interrupts[1]; } - if (chip->interrupts[0] && - (id->driver_data == AD7151 || chip->interrupts[1])) { + if (id->driver_data == AD7151 || chip->interrupts[1]) { irq_set_status_flags(chip->interrupts[0], IRQ_NOAUTOEN); ret = devm_request_threaded_irq(&client->dev, chip->interrupts[0],