From patchwork Tue May 16 07:14:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matti Vaittinen X-Patchwork-Id: 682977 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 30EEBC7EE24 for ; Tue, 16 May 2023 07:15:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231204AbjEPHPF (ORCPT ); Tue, 16 May 2023 03:15:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231241AbjEPHOk (ORCPT ); Tue, 16 May 2023 03:14:40 -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 854B23C3D; Tue, 16 May 2023 00:14:17 -0700 (PDT) Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-4f1fe1208a4so12908068e87.2; Tue, 16 May 2023 00:14:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684221256; x=1686813256; 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=bBg0Mv9yvZiy6gYM1yujQ0ayIWUjiANXlVQil+oRP9Y=; b=E6/E0+MEEZ1V/BLo6RWxpKoRFfZ5rkKw7MEVSwmdLGV2YtTugh6RLL2JwsEvv33dM5 ClAwf7nx4vMYQFP/7MhVwN9krtGpdVcMhlTzD+WxhCtwj4QgM/F3GcoPnQWSxi8LWGbx 9cEwrV0sKZVvM0yg/DTClauC7F3/0jP+g4f7wBC+rpg7g6I5e4sPzoCkkE0QlkS5dfv7 ZGw+aT4+k3lFWsFGifek2Og/IMTTArPni0CoftZbKkHMOh9COZoT6OmsJiqqSQxZDBjd xOIGwnaMbePP50iMnTkjUVJX2eQC6AecG2TcFE5OH+yANztuBHPh6mOS4mCqriOj+ldE wHaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684221256; x=1686813256; 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=bBg0Mv9yvZiy6gYM1yujQ0ayIWUjiANXlVQil+oRP9Y=; b=DgrmR/cLOZlZZyZaR9cF7Hso+8eeo3+NxIPdA58qdE28z79JM6AqXnawXiSt0ZAttz +o+WPvC6EmqX2bC9u4XeIlJuVq9/BYb/1Tr4j2X/GMOzp9y7Y0XLMXq+bRoViCwjii4X GQFXGZGPEYW2RtIR34wzk/Saz7Mzqs5WIXDJvnFMQfsPk9GGTx2r71KBStc0cePnDY4T +RXenlNltEgvsp/9U2qu4hdgm3xp5gW3WvsYxqf0hxuIA/E5YA03L/3ExiPsf6jFEfas K/zx4rW0kgkejzy6cXZhrhpmLsifU1mSGBnuMywVzLzFZIE9d3TFdujoVEGbK6gzL+9u IHEw== X-Gm-Message-State: AC+VfDycPlYR9KGwbIsufNml8+3jrG7hIdUwtojqtQruupJgRm1Gt1rp TFqzqyL7fozhZZo99TAx9Z8= X-Google-Smtp-Source: ACHHUZ49uNR3NJnq5Gt3aNGxblrfIAs3JelfkYNAqlgvXUmiEjle/AtjF7IeH2JaJf2x8K0OPFI9rQ== X-Received: by 2002:ac2:446b:0:b0:4ef:b18c:89b2 with SMTP id y11-20020ac2446b000000b004efb18c89b2mr8584496lfl.56.1684221255593; Tue, 16 May 2023 00:14:15 -0700 (PDT) Received: from fedora (62-78-225-252.bb.dnainternet.fi. [62.78.225.252]) by smtp.gmail.com with ESMTPSA id o4-20020ac24944000000b004eeda2caa3fsm2864092lfi.55.2023.05.16.00.14.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 May 2023 00:14:14 -0700 (PDT) Date: Tue, 16 May 2023 10:14:10 +0300 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Cc: Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Greg Kroah-Hartman , "Rafael J. Wysocki" , 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 , Wolfram Sang , Akhil R , 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 7/7] iio: cdc: ad7150: Functional change Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-acpi@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],