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 516A0C636D3 for ; Tue, 31 Jan 2023 04:02:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230366AbjAaECC (ORCPT ); Mon, 30 Jan 2023 23:02:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230321AbjAaEB6 (ORCPT ); Mon, 30 Jan 2023 23:01:58 -0500 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8146C33440 for ; Mon, 30 Jan 2023 20:01:54 -0800 (PST) Received: by mail-pj1-x1031.google.com with SMTP id o13so13069795pjg.2 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=hpdTD/0b4e2QWyS7LoU6fq+zsalKA9Cr6RKcf+L8hd88nKvAH8AwYGNiapgzZjFNxX khB7X+4MltiBo2lOI5PjsVAliouGLg+gz5gQfJ853G0M4cOFDQsHDrGDmFalWg4wojI0 J7hWsAQY6AmjPw1uimntus7Hr6LGNWfAYczo1jL5cXOfy1c+ccfO/CsT8sLikFk+rsRk 2gvTq6lpVsHUhuEZMBwfPXneMkfl3OM+JGrjlxEADg+cNGAbT0M/9srWpTrnz0owF4AI Ba+ZQl8wNR+B1pOF1GQeodNkLDyNrkb8+RAw0bk7xrijDeFmV/XdIiQ1r8/1zXUuHxm2 9www== X-Gm-Message-State: AO0yUKWPdY2aJ0POHyZCCafpQoSeS3CW9bhyTBrbIWqZuGLlRcIAg/p3 jFMjN2SQKKR+vR+E/9kWULVi4NONtGEILwmbbdK6Tw== 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-kernel@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