From patchwork Fri May 26 06:39:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matti Vaittinen X-Patchwork-Id: 13256487 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 0EBF2C7EE2F for ; Fri, 26 May 2023 06:39:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242266AbjEZGjd (ORCPT ); Fri, 26 May 2023 02:39:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242279AbjEZGj3 (ORCPT ); Fri, 26 May 2023 02:39:29 -0400 Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B724E52; Thu, 25 May 2023 23:39:21 -0700 (PDT) Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2af29e51722so3925781fa.1; Thu, 25 May 2023 23:39:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685083159; x=1687675159; 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=BgKQ1vkNDdmfxW3QiIXw+RFuGncJHJss+SZB9+fpCHg=; b=P8UL9cC2o5Qk8TUJXg/qLPy+TuwqH+ZvSpcZBHL9GWxnX5YEM87KW56drkj82BecGs byUAKqOt/qo1Ly3/1RJbu3JiXAuhOpnfRt77hUNxjMcNaoXNf91K0i7twqChQiWc2per VR+HrcNfzUkfdc33lJKxSb9LK4SGIqkoX7vAKAl/XNYLIZb6edNz6zbVK3O2fEzHYvVX DNpGrJJh0bhI1ylVLhs3R/o99zwBm/bTHZ7rHjWD898nRHRdn288q03HJ20fri7X5vBk Vb/gHNEQeiOyTXB8tMjttLb8vx4R0+Cjp3sb0wl7mMtrVHh0g1z/x6P2wa1Evl7fDCVA Qkjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685083159; x=1687675159; 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=BgKQ1vkNDdmfxW3QiIXw+RFuGncJHJss+SZB9+fpCHg=; b=g0uZzN+oloaOjKlVhafkfnJTqwxRm+LeKChrGpYlyztKHBXwqgh5AdAB2v2r81vtOp asL/80MOWKhY13mdw3VL1xQY1y4hKm3fSpJ+JGbWfqxFpvqERUS53fz90yJqxpdL4BWi vviB2DEcHF0S00TycvlxDQToQE2Wv/AbMY4cQDIcxx1DfOMpbrHOiVTa4FbwED4EbmF5 +levPxPK8YgZPCdHBJYxRsUABAsK5GE5xSI0Kx5sjdmnytqLQBG0e44kFrxLgNEF0qNq UES2Q43XEq2J39XNHcdv06fAzDrgC9euDkQa31LIfXjVUqwcfwqUzd9jvwbsIkYQtvnc T3DA== X-Gm-Message-State: AC+VfDxvXEwIna6MwBF+/bSqiKlOmH4lpQtewvOaf5uRoNJBTrOx82kr sDpxEoewS12S+ZDDhC/C2Ns= X-Google-Smtp-Source: ACHHUZ7OYUbMoIrvh5Zlr9sId1vCeetF/jq9fHwu9OnRVkf0weT+x2amMADdAAhh+v70yB2h57C39A== X-Received: by 2002:a2e:8185:0:b0:2ac:7137:5f13 with SMTP id e5-20020a2e8185000000b002ac71375f13mr353634ljg.9.1685083159451; Thu, 25 May 2023 23:39:19 -0700 (PDT) Received: from fedora ([213.255.186.46]) by smtp.gmail.com with ESMTPSA id x7-20020a2e8807000000b002aa40d705a5sm575524ljh.11.2023.05.25.23.39.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 May 2023 23:39:18 -0700 (PDT) Date: Fri, 26 May 2023 09:39:14 +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 v6 7/8] iio: cdc: ad7150: relax return value check for IRQ get Message-ID: <6de4448e9fe46d706bdeddb71ba6923d89ea8f4d.1685082026.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. Change all failures in IRQ getting to be handled by continuing without the events instead of aborting the probe upon certain errors. Signed-off-by: Matti Vaittinen Reviewed-by: Jonathan Cameron --- Revision history: v5 => v6: - Never abort the probe when IRQ getting fails but continue without events. 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. 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 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/iio/cdc/ad7150.c b/drivers/iio/cdc/ad7150.c index 79aeb0aaea67..c05e078bba16 100644 --- a/drivers/iio/cdc/ad7150.c +++ b/drivers/iio/cdc/ad7150.c @@ -541,6 +541,7 @@ static int ad7150_probe(struct i2c_client *client) const struct i2c_device_id *id = i2c_client_get_device_id(client); struct ad7150_chip_info *chip; struct iio_dev *indio_dev; + bool use_irq = true; int ret; indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*chip)); @@ -561,14 +562,13 @@ static int ad7150_probe(struct i2c_client *client) chip->interrupts[0] = fwnode_irq_get(dev_fwnode(&client->dev), 0); if (chip->interrupts[0] < 0) - return chip->interrupts[0]; - if (id->driver_data == AD7150) { + use_irq = false; + else if (id->driver_data == AD7150) { chip->interrupts[1] = fwnode_irq_get(dev_fwnode(&client->dev), 1); if (chip->interrupts[1] < 0) - return chip->interrupts[1]; + use_irq = false; } - if (chip->interrupts[0] && - (id->driver_data == AD7151 || chip->interrupts[1])) { + if (use_irq) { irq_set_status_flags(chip->interrupts[0], IRQ_NOAUTOEN); ret = devm_request_threaded_irq(&client->dev, chip->interrupts[0],