Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp816215pxb; Thu, 17 Feb 2022 15:39:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJwbTJMlrdTWfx7uSUQ3jmL+5OtBDp6ZJFoBy0XjTVGSGsyLfEUi2LC4Kr3za8ZFeiYgaf1f X-Received: by 2002:a65:6e93:0:b0:362:da8d:88d5 with SMTP id bm19-20020a656e93000000b00362da8d88d5mr4203067pgb.194.1645141178877; Thu, 17 Feb 2022 15:39:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645141178; cv=none; d=google.com; s=arc-20160816; b=QT37SldU7lg1/Zxyoe1Rpkj60BcLBBIz3dQiKTrS+SQBu+mLngjnQEiKU53bV6KOOj 9niV+aPEnJkVQ4okw3r1UT0oM2D1uLD0otR8OhgvO4NZnPjORer9IV/CDjzYx68U3pxN +A2BWqwmG5nTfjK2Pf4EvNUF6pHIxk2FIkU2zso3+bEqPSiFk7rWz9rsyrHcMF+O/bW3 fpQJkAoKXcQOhN+CoQuZpSAQkk3QFmbWDvHhtlzAX4X82O+g0PnRt+Ct/its6z8MrF8Z jCyIvMFvNWpKxMnhCXWcIrkfyxUAWkKLyysfFIRfkS9VEExLgxOPKYJxdcSfwF2BmZwy aw6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=2z6ONpwK4CuLtQzOkw1+oaP6vE+VbGqUPfC9GSQ73OA=; b=OkFHBSN+vBchMLkGBXuFxDM6xV83PpZQogrjlkhNO0naaM25a0y4mbaZW8yeMN6LBx Te/htzo4L+/rSfLmC4HHi70LUwnfGZbpW0R+CDjH0N3JnNikEaJ8sew01i2t9kEVU2aH wAISJBhsxbnzVXNrY+BkjNxBWsag6b+6uFy87sNAQme0GQtuRjmmppP6lBKELV0BhzxL bF3j//MR+4BJH1U6Wr7TbJ6mzD0DUpplCzAGl59Th/VNNvwx4HVggfzhMTO+bm7ZqBfn WqD91VsjZY0v0JdaUcDY2OWXvPmVyFavb9vfJd/D1qt4rmfGMMK941cn95Je6FJuBQu6 i60w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=NbRb9TCy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id d70si9575098pgc.586.2022.02.17.15.39.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Feb 2022 15:39:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=NbRb9TCy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0E168340F9; Thu, 17 Feb 2022 15:17:00 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245718AbiBQUK4 (ORCPT + 99 others); Thu, 17 Feb 2022 15:10:56 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:50334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243775AbiBQUKz (ORCPT ); Thu, 17 Feb 2022 15:10:55 -0500 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD0C97ED9B; Thu, 17 Feb 2022 12:10:40 -0800 (PST) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: shreeya) with ESMTPSA id 014A81F462CF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1645128639; bh=Fk8wJN7pTms4IsuWl6aZhGvZXpAYl3f+43AKU7qlpMg=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=NbRb9TCyvLFZemrrZEp0rCw/Z7XV6hml0R9kzLz1UbVlNF18jf3maCkR1gvrRhhzy JvhO90JnR47C9FROjeGRaTOYdqJ0O4GM0Tari4BuxMJn1m7ygsTJXkqOJ8/uwelH77 +KVhpsbw5WHJYCJ/nAc98EQ3aS/3VkEBe6fPXNDxK0lkkgGH9izwfBgsWeKDPkWbb1 0OjOaUzUerLJ+ctQCZ6KXpU+XVUJpIWQyIW2ij1f4AJlJBEf2ikFnV/Y+jLNXo8TFA rQG7PQrDFcbIiYksQjhOJD3L94yUcqBLejHyBZhSKAnXTGpzO+R9jrBGUVf/aSB92K gh6p4H4T9vtxA== Subject: Re: [PATCH v4] gpio: Return EPROBE_DEFER if gc->to_irq is NULL To: Bartosz Golaszewski , Gabriel Krisman Bertazi , Andy Shevchenko Cc: Linus Walleij , Bartosz Golaszewski , wsa@kernel.org, kernel@collabora.com, "open list:GPIO SUBSYSTEM" , Linux Kernel Mailing List , kbuild test robot References: <20211116093833.245542-1-shreeya.patel@collabora.com> <874k56znix.fsf@collabora.com> From: Shreeya Patel Message-ID: <8c2ef205-8e80-21e6-b8ad-f55cdb11079a@collabora.com> Date: Fri, 18 Feb 2022 01:40:31 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=no 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: X-Mailing-List: linux-kernel@vger.kernel.org On 10/02/22 11:30 pm, Bartosz Golaszewski wrote: > On Thu, Feb 10, 2022 at 5:36 PM Gabriel Krisman Bertazi > wrote: >> Shreeya Patel writes: >> >>> 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. >>> >>> BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=209413 >>> Reviewed-by: Linus Walleij >>> Reviewed-by: Andy Shevchenko >>> Reported-by: kernel test robot >>> Signed-off-by: Shreeya Patel >> Hi guys, >> >> This seems to not have reached the Linus tree on 5.17. If I'm not >> mistaken, it also hasn't reached linux-next as of today. Is there >> anything I'm missing here? >> >> This is required to prevent spurious probe crashes of devices like this >> FocalTech touchscreen, FT3528, when using pinctrl-amd. We've been >> carrying it downstream for quite a while. >> >> Thanks, >> >> -- >> Gabriel Krisman Bertazi > Hi Gabriel! > > My email address changed in September, that's why I didn't see the > email you sent in November to my old one. > > gpiod_to_irq() can be used in context other than driver probing, I'm > worried existing users would not know how to handle it. Also: how come > you can get the GPIO descriptor from the provider but its interrupts > are not yet set up? Hi Bartosz, We would be only changing the error code here for gpio driver race condition. Anything affected by this patch would have already been broken and might be returning -ENXIO. There is a theoretical chance that a driver exists which uses gpiod_to_irq outside of probe and affected by race condition. The more instructions between gpiod_get and gpiod_to_irq the smaller the chance of hitting the race condition though. Also anything hitting the race condition is broken right now and there hasn't been any issues reported so far. In any case that system is not fixed by this patch, it is still a good idea to apply this patch since the proper fix is a lot more invasive and probably might not be suitable for stable backporting. This minimal patch does not make things worse. I have sent a v5 for this patch with better commit message. Thanks, Shreeya Patel > > Bart >