Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp4374341pxb; Thu, 14 Oct 2021 04:10:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzfHXkgLaVcoi88bdISblQpkvlZe95/Sk9snpaWkbbKWcywUVMMa8NTSFx6cOKvOZwn6MP/ X-Received: by 2002:a05:6402:5215:: with SMTP id s21mr7773106edd.113.1634209825805; Thu, 14 Oct 2021 04:10:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634209825; cv=none; d=google.com; s=arc-20160816; b=WmfWRdTSfSgzcW/wZWqN6JRIlWrwXT85jc7XKV0G7LSIStAumyD4OpILHTOeBbX416 n+jqBtLN0Z5NOyLJBYsgLO02qc/4ZwlUTqYdnA/dRac6cqdflbnnaaQ9vmO7lJD3VHMy omRfh1KOr7qZdcH8j1+SF7rHX90hkvgUlAMRDpSINmxwSnnczWTcGlEJ8Yf4O5My/exU BnArGm4eiCzqP1WobFMKOTJ3BVf7D9lcpBRJ/GyDKDiOhPDw8SvYe0huqhWC1NsUwFXB E4QkO04G1tzrxVTurwYLh9jeE3D6l2G3kl+AZRBdixZeSRa/YlDaaK8aPVnwgLLnQeUP Gsbg== 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 :message-id:date:subject:cc:to:from; bh=zf6KBe/OsLJgGp6T1iTkp/FFY9XtPtT5QDVqpmT4A68=; b=efSvs5KPFAgZYXY4E9wYDtDKUjbI0rQQ17Bt1Dd9fxPwJHrzQqroFPUvO6QjsYXxtq vP5TDgq7yGOETzcihkblYYtWLGIsgOULzEeqMHqld2+C8ZDzxqo9aL6G/vfQddogu7MB OsVjxGjsI6CmMyBrbvL/PiDwpSuS9RsKtXPoeg7oAJmHlukTLMB+/cQfDuut0TPHtPp2 74uOoGDcLcKNBT/WWc+JExO7p/nJ5RMn0GpELMkzR0kD6DisqftwdxdqKwPkRPalSL92 2to+XOY1VzY11tS4Qk59sRTAEtfgIa2Zb9vj61B8WI9uTg8fGHbIkqYRxo0hqF1Oy9/j HSTw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a23si3342942ejr.637.2021.10.14.04.10.02; Thu, 14 Oct 2021 04:10:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230312AbhJNLHZ (ORCPT + 99 others); Thu, 14 Oct 2021 07:07:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230080AbhJNLHZ (ORCPT ); Thu, 14 Oct 2021 07:07:25 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B597C061570; Thu, 14 Oct 2021 04:05:20 -0700 (PDT) Received: from localhost.localdomain (unknown [IPv6:2401:4900:1c20:48dc:2024:938f:96e4:4a08]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: shreeya) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 4EF181F44A4A; Thu, 14 Oct 2021 12:05:18 +0100 (BST) From: Shreeya Patel To: linus.walleij@linaro.org, bgolaszewski@baylibre.com, wsa@kernel.org Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, Shreeya Patel Subject: [PATCH] gpio: Return EPROBE_DEFER if gc->to_irq is NULL Date: Thu, 14 Oct 2021 16:34:37 +0530 Message-Id: <20211014110437.64764-1-shreeya.patel@collabora.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We are racing the registering of .to_irq when probing the i2c driver. This results in random failure of touchscreen devices. Following errors could be seen in dmesg logs when gc->to_irq is NULL [2.101857] i2c_hid i2c-FTS3528:00: HID over i2c has not been provided an Int IRQ [2.101953] i2c_hid: probe of i2c-FTS3528:00 failed with error -22 To avoid this situation, defer probing until to_irq is registered. This issue has been reported many times in past and people have been using workarounds like changing the pinctrl_amd to built-in instead of loading it as a module or by adding a softdep for pinctrl_amd into the config file. References :- https://bugzilla.kernel.org/show_bug.cgi?id=209413 https://github.com/Syniurge/i2c-amd-mp2/issues/3 Signed-off-by: Shreeya Patel --- drivers/gpio/gpiolib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 27c07108496d..fc0ba85f4c45 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -3084,7 +3084,7 @@ int gpiod_to_irq(const struct gpio_desc *desc) return retirq; } - return -ENXIO; + return -EPROBE_DEFER; } EXPORT_SYMBOL_GPL(gpiod_to_irq); -- 2.30.2