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 D83E2C63797 for ; Tue, 31 Jan 2023 04:02:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230315AbjAaEB7 (ORCPT ); Mon, 30 Jan 2023 23:01:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230212AbjAaEB6 (ORCPT ); Mon, 30 Jan 2023 23:01:58 -0500 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8337535266 for ; Mon, 30 Jan 2023 20:01:54 -0800 (PST) Received: by mail-pl1-x632.google.com with SMTP id d3so13775519plr.10 for ; Mon, 30 Jan 2023 20:01:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=h4HuA3j2EBy5AxpIc4hMqjnFXhEdbAZiZIV8HHy46jY=; b=HEWCwGkRH9bAZ7lLPQDJSVH0O3fsFMA4fAd6IgZJbbsN8U3WfErm8xeGa57wmhhtUe PJiCMlfFV2BJCaVCwryDX5vOjVCTFDnxFCq7mDnH4zWHzcbksJhEGNuKtI6VgIifcFsr CGDUaeiWYBZZxs/XSNliTfREJ1U9G4vD/0IZZ8Ho49yWo8NtR1+gqCPH0zg89t7bS8y5 xC9kCK/pmKGmiGaHNn5zFH7yC5Gjph0ndJBvQTO0duLUlAQhS7Nbi+BryMBaFP3IiBTo B+ShicADflC9/EVZ7txCK4eYJFONVqnY7l3hQsyQeFSMctpTfS5T/s/SWMvdLsyOr/vv ffXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=h4HuA3j2EBy5AxpIc4hMqjnFXhEdbAZiZIV8HHy46jY=; b=QKStzu6RQRI7on7KgP4aq0Uyiq78+zoFL6syfdBju/GhmTmTy4dxJ/Cy96bfuXxRWP qEnW4nEY9dgxtRNx4n2kf2t2USu8QwSttkSGG/ERBKXYFMWzR63tYY2rlVRkALLo+YFX 3JUvqZwBTFx5ZMvbTT9Ix1HntwtepdVzME0kUtsQP7DGl2AGxfurer6XaWIobYTO4POs FIFPKpkpiHQX6ebueK/TFo0Xr9954aL028azKHvhh6FgeOkjPveF2M7BCIRb8PL8fnnR ILg0G6/kp6JYp7TjPKp0wELPM38clvJHz7K0Lf/nZsZoDFyyGTl6UZZegqIuEHjZy8YR 7+qg== X-Gm-Message-State: AO0yUKXI/1FTvXJ31u2Q1w/NL8ACWYy8m0kiPLR+jFsWWWOF993X3qsD tkfQFvVFqsDRYA4A3t0tAj1CGk+0nwA1TBO+En6AOw== X-Google-Smtp-Source: AK7set9O/ZL92MGFaieNvwAJ5CCNGhB9xx1mRSajxQzhHpp9Wy4/L2V5dizdMVSjKAlymvGjH465mDdS/mVCT2tdPuY= X-Received: by 2002:a17:90a:64c5:b0:22b:ef05:ea5b with SMTP id i5-20020a17090a64c500b0022bef05ea5bmr4316599pjm.50.1675137713729; Mon, 30 Jan 2023 20:01:53 -0800 (PST) MIME-Version: 1.0 References: <20230127001141.407071-1-saravanak@google.com> <20230127001141.407071-5-saravanak@google.com> <20230130143153.67dsxn4lugfetfwb@bogus> In-Reply-To: From: Saravana Kannan Date: Mon, 30 Jan 2023 20:01:17 -0800 Message-ID: Subject: Re: [PATCH v2 04/11] gpiolib: Clear the gpio_device's fwnode initialized flag before adding To: Andy Shevchenko Cc: Sudeep Holla , Greg Kroah-Hartman , "Rafael J. Wysocki" , Cristian Marussi , Linus Walleij , Bartosz Golaszewski , Thomas Gleixner , Marc Zyngier , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Rob Herring , Frank Rowand , Geert Uytterhoeven , Magnus Damm , Len Brown , Daniel Scally , Heikki Krogerus , Sakari Ailus , Tony Lindgren , Linux Kernel Functional Testing , Naresh Kamboju , Abel Vesa , Alexander Stein , Geert Uytterhoeven , John Stultz , Doug Anderson , Guenter Roeck , Dmitry Baryshkov , Maxim Kiselev , Maxim Kochetkov , Miquel Raynal , Luca Weiss , Colin Foster , Martin Kepplinger , Jean-Philippe Brucker , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-acpi@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org On Mon, Jan 30, 2023 at 7:14 AM Andy Shevchenko wrote: > > On Mon, Jan 30, 2023 at 02:31:53PM +0000, Sudeep Holla wrote: > > On Thu, Jan 26, 2023 at 04:11:31PM -0800, Saravana Kannan wrote: > > > Registering an irqdomain sets the flag for the fwnode. But having the > > > flag set when a device is added is interpreted by fw_devlink to mean the > > > device has already been initialized and will never probe. This prevents > > > fw_devlink from creating device links with the gpio_device as a > > > supplier. So, clear the flag before adding the device. > > ... > > > > + /* > > > + * If fwnode doesn't belong to another device, it's safe to clear its > > > + * initialized flag. > > > + */ > > > + if (!gdev->dev.fwnode->dev) > > > + fwnode_dev_initialized(gdev->dev.fwnode, false); > > > > This is the one causing the kernel crash during the boot on FVP which > > Naresh has reported. Just reverted this and was able to boot, confirming > > the issue with this patch. > > I'm wondering if > > if (!dev_fwnode(&gdev->dev)->dev) > fwnode_dev_initialized(&dev_fwnode(gdev->dev), false); > > works. No, that won't help. The problem was that with arm32, we have gpio devices created without any of_node or fwnode. So I can't assume fwnode will always be present. -Saravana 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D69B7C38142 for ; Tue, 31 Jan 2023 04:03:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=BkI57+DEJMJOoevU9FEwAoYfeOA5fOChjX2UdpTe1vk=; b=v95aKVuAYiPPYm oYbQE8EmeopNN4kdAQka6WYgbKRRG0FsoB7gpd7//TP4sjQtK7yas7uEl2vNt/bavwo2879d2r71j rYrhdcv8xS9LiB+1IUJ4f2I47WTabqHR0ihEo1XiLtJFJZHbuveKiv54iDxqNslEUJAneW4XzJ5Ao 7jArrsL0pNuBFv8cjtmWFg7Su1ODZTc3S3nRgxH0P3ehcMV91oPOIumUQmkEBMOYKZ8+Ih2RdTvmg SDyTUJq4QvS6aoEAIG5Ri3Iw3eMAxCbAKeA1Gob6bk7viB7Gta5W3BSTc97d2VR4hy9QqPT2zUzjO RnsIf5gUDGzce32euk5A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pMhqL-006DiQ-1m; Tue, 31 Jan 2023 04:02:01 +0000 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pMhqH-006Dhu-On for linux-arm-kernel@lists.infradead.org; Tue, 31 Jan 2023 04:01:59 +0000 Received: by mail-pl1-x631.google.com with SMTP id m13so1909658plx.13 for ; Mon, 30 Jan 2023 20:01:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=h4HuA3j2EBy5AxpIc4hMqjnFXhEdbAZiZIV8HHy46jY=; b=HEWCwGkRH9bAZ7lLPQDJSVH0O3fsFMA4fAd6IgZJbbsN8U3WfErm8xeGa57wmhhtUe PJiCMlfFV2BJCaVCwryDX5vOjVCTFDnxFCq7mDnH4zWHzcbksJhEGNuKtI6VgIifcFsr CGDUaeiWYBZZxs/XSNliTfREJ1U9G4vD/0IZZ8Ho49yWo8NtR1+gqCPH0zg89t7bS8y5 xC9kCK/pmKGmiGaHNn5zFH7yC5Gjph0ndJBvQTO0duLUlAQhS7Nbi+BryMBaFP3IiBTo B+ShicADflC9/EVZ7txCK4eYJFONVqnY7l3hQsyQeFSMctpTfS5T/s/SWMvdLsyOr/vv ffXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=h4HuA3j2EBy5AxpIc4hMqjnFXhEdbAZiZIV8HHy46jY=; b=USKxNsOBtUuZZ9mB49KvFah+FfyOkZUitwe5SoGkBy3zqJA1/+NN253/tt+eMW8sHE fNBTcGAHZ2m6sLn5o130+TJPc4/vyGpHKr9ByJzX79nu14HQbpj91YAk8ePj1USQaYVT 6XV/qQVxSj1JPyUHsgBLfSGV+6Py0PR7io0N+kRjNndsRsURPW71SK17l8GkxhbL+prl N7Fze2NsrqElg7Rlm87d6gkmegPV2+dEOKoKCN+fii5Q0GJbEuoUOXDVcE1Km5tAmnx8 a+UKIZOQI9BZqJefJWPM5sEmB9diNJ8LKKyIwNAZHidAnAE16gk9+sqmsLIP+QmLMKCY WmDQ== X-Gm-Message-State: AO0yUKXJ8SJgac/hzbfa6G7BQrkvopr+dybbusVMbDy79YSLzHN5jAXI bLvQaYN/0UgcJfxtll7pruukWSJSYjHk8KLy8gs1HA== X-Google-Smtp-Source: AK7set9O/ZL92MGFaieNvwAJ5CCNGhB9xx1mRSajxQzhHpp9Wy4/L2V5dizdMVSjKAlymvGjH465mDdS/mVCT2tdPuY= X-Received: by 2002:a17:90a:64c5:b0:22b:ef05:ea5b with SMTP id i5-20020a17090a64c500b0022bef05ea5bmr4316599pjm.50.1675137713729; Mon, 30 Jan 2023 20:01:53 -0800 (PST) MIME-Version: 1.0 References: <20230127001141.407071-1-saravanak@google.com> <20230127001141.407071-5-saravanak@google.com> <20230130143153.67dsxn4lugfetfwb@bogus> In-Reply-To: From: Saravana Kannan Date: Mon, 30 Jan 2023 20:01:17 -0800 Message-ID: Subject: Re: [PATCH v2 04/11] gpiolib: Clear the gpio_device's fwnode initialized flag before adding To: Andy Shevchenko Cc: Sudeep Holla , Greg Kroah-Hartman , "Rafael J. Wysocki" , Cristian Marussi , Linus Walleij , Bartosz Golaszewski , Thomas Gleixner , Marc Zyngier , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Rob Herring , Frank Rowand , Geert Uytterhoeven , Magnus Damm , Len Brown , Daniel Scally , Heikki Krogerus , Sakari Ailus , Tony Lindgren , Linux Kernel Functional Testing , Naresh Kamboju , Abel Vesa , Alexander Stein , Geert Uytterhoeven , John Stultz , Doug Anderson , Guenter Roeck , Dmitry Baryshkov , Maxim Kiselev , Maxim Kochetkov , Miquel Raynal , Luca Weiss , Colin Foster , Martin Kepplinger , Jean-Philippe Brucker , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-acpi@vger.kernel.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230130_200157_829144_57BB1D7D X-CRM114-Status: GOOD ( 22.71 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Jan 30, 2023 at 7:14 AM Andy Shevchenko wrote: > > On Mon, Jan 30, 2023 at 02:31:53PM +0000, Sudeep Holla wrote: > > On Thu, Jan 26, 2023 at 04:11:31PM -0800, Saravana Kannan wrote: > > > Registering an irqdomain sets the flag for the fwnode. But having the > > > flag set when a device is added is interpreted by fw_devlink to mean the > > > device has already been initialized and will never probe. This prevents > > > fw_devlink from creating device links with the gpio_device as a > > > supplier. So, clear the flag before adding the device. > > ... > > > > + /* > > > + * If fwnode doesn't belong to another device, it's safe to clear its > > > + * initialized flag. > > > + */ > > > + if (!gdev->dev.fwnode->dev) > > > + fwnode_dev_initialized(gdev->dev.fwnode, false); > > > > This is the one causing the kernel crash during the boot on FVP which > > Naresh has reported. Just reverted this and was able to boot, confirming > > the issue with this patch. > > I'm wondering if > > if (!dev_fwnode(&gdev->dev)->dev) > fwnode_dev_initialized(&dev_fwnode(gdev->dev), false); > > works. No, that won't help. The problem was that with arm32, we have gpio devices created without any of_node or fwnode. So I can't assume fwnode will always be present. -Saravana _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel