From mboxrd@z Thu Jan 1 00:00:00 1970 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 E0C49C433F5 for ; Fri, 11 Feb 2022 01:26:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346770AbiBKB0W (ORCPT ); Thu, 10 Feb 2022 20:26:22 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:40076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344042AbiBKB0V (ORCPT ); Thu, 10 Feb 2022 20:26:21 -0500 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B80781120; Thu, 10 Feb 2022 17:26:21 -0800 (PST) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: krisman) with ESMTPSA id C08D71F469ED DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1644542780; bh=x9xd9mW3dxu6WXXxYBXdKYFMuDvhWWT9wcjasq9vcU0=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=btM3SLYO20KSjlJdecdJBFp7bs8l9yvod527TSzWny/udp4o+vZQ0cewI15y72qU9 V0sBnk1rmuynSVuYSSjcaMSH8hkIcLdZkmFKh6WzS1H38a5xOU0xNoo2KYLYXkjK/v TSdK0Lqmkzi4jPY5mUeOSNleXyvWQqAuZcoWKGbAysG/qsJ4ab/0532wMMJn8LcGMB w17wLdrvL/Rg7RoEdGmzuUZrKDBy+jTC/7CRBP4rFAMoDgkSY25wf0gO4pI6fI9HX9 SfUlVU+AHVFknV2AvIXorzddhhr1AIiHNOACISCVI2yWZ87zGnydqOK20m63qbmovb 8T79jjpDG2lEg== From: Gabriel Krisman Bertazi To: Bartosz Golaszewski Cc: Andy Shevchenko , Shreeya Patel , Linus Walleij , Bartosz Golaszewski , wsa@kernel.org, kernel@collabora.com, "open list:GPIO SUBSYSTEM" , Linux Kernel Mailing List , linux-i2c , kbuild test robot Subject: Re: [PATCH v4] gpio: Return EPROBE_DEFER if gc->to_irq is NULL Organization: Collabora References: <20211116093833.245542-1-shreeya.patel@collabora.com> <874k56znix.fsf@collabora.com> Date: Thu, 10 Feb 2022 20:26:16 -0500 In-Reply-To: (Bartosz Golaszewski's message of "Thu, 10 Feb 2022 19:00:07 +0100") Message-ID: <87v8xmxkg7.fsf@collabora.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Bartosz Golaszewski writes: > My email address changed in September, that's why I didn't see the > email you sent in November to my old one. Hi Bart, thanks for the prompt reply and sorry for the wrong email address. > 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? I'm definitely some context here, as its been quite a while. Shreeya, feel free to pitch in. :) This is one of the races we saw in gpiochip_add_irqchip, depending on the probe order. The gc is already visible while partially initialized, if pinctrl-amd hasn't been probed yet. Another device being probed can hit an -ENXIO here if to_irq is yet uninitialized or enter .to_irq() and oops. Shreeya's patch workarounds the first issue, but is not a solution for the second. There is another patch that has been flying around to address the Oops. https://lkml.org/lkml/2021/11/8/900 She's been working on a proper solution for that one, which might actually address this too and replace the current patch. Maybe you could help us get to a proper solution there? I'm quite unfamiliar with this code myself :) -- Gabriel Krisman Bertazi