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 A4FF0C27C76 for ; Sat, 28 Jan 2023 07:34:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233699AbjA1He1 (ORCPT ); Sat, 28 Jan 2023 02:34:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233624AbjA1HeS (ORCPT ); Sat, 28 Jan 2023 02:34:18 -0500 Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D4C042DFB for ; Fri, 27 Jan 2023 23:34:16 -0800 (PST) Received: by mail-pl1-x633.google.com with SMTP id 5so7090281plo.3 for ; Fri, 27 Jan 2023 23:34:16 -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=JmYzUfpePnB9x0ifwB4TcXSt5sKNdFWyl1mCK+EAt64=; b=sv7EliM4oDY/KPMKE8veikhHJX+n9dLGSJXbCDuMHFjzqR7z9a2A2QV0Mh8ISNJelb gtq6p0Fg/Nut/liGUX0fm5Rk2UCPdlMtAIeuzXuG81EhF5FN+1OT97xlFykF9szLWMS4 8oPe32ivIGTGX8kQAMo4euFp43ngRX7rwTwv/ZwMPigJ7gZe5wrGfY/gqQEhcnUf3Gyc oh+BuS8UwHELgpD/F96tP8E+jrdU7YLguXAyMz81xKVFLTC1Gz5BcrUhBkvXAQQlijpA 0HbWPf1qfSqLRrt007E+Zwqukn5gwceaXzjcltqaIfqgwrNQ1c4yHM1y2KkqvVbTGVs0 wj6g== 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=JmYzUfpePnB9x0ifwB4TcXSt5sKNdFWyl1mCK+EAt64=; b=I1SggiKvApD0fSzDA/l9J+mIv+OIeiyG0zzIXVPzFQ8K4wKijC+lMNseVhraHno0F0 qHke24FiLQc+loP/131QRbQbCVSudhebEMTM83YZ+6B87SSPxFTBm8b2EHKW0t5gqQWi 7KT7ROZzwoST24KkV2bj56lxOYozfm1WiyP59doc6zmx/1X8wfHg5WwjHBLkG2QphEIV XfQHbZZKgFkH8UkVU77o5alaKhVFwu/f/uk1hxl0HKbqJs5mPb/tcdbf89A8gL5F5ond pEZ0L4ctcL6MDyMSX6kezLF3Pgsv56pCshi2MVytUtbAR0DZ4FY7szvCPR9vYpVEyfID wjFA== X-Gm-Message-State: AFqh2kpyS9KsmSaKx+uFFy3eAgF47fQZBmSXEkBpFQBauq+67O0DTLpT NxX5DwJPWi7WpyXj3/m/BQs8BCHrs08cVE+0xxxl3g== X-Google-Smtp-Source: AMrXdXuNSDnsr/Epdkz/K+Dti20l9M0DJ83VLBWJ4Gvg9ChW/l3gOz1X2smf3HJfp3CmcVkj9QCLVhHNnTBqoV7Qy3A= X-Received: by 2002:a17:902:8304:b0:194:6253:d685 with SMTP id bd4-20020a170902830400b001946253d685mr4962773plb.3.1674891255033; Fri, 27 Jan 2023 23:34:15 -0800 (PST) MIME-Version: 1.0 References: <20230127001141.407071-1-saravanak@google.com> <20230127001141.407071-5-saravanak@google.com> In-Reply-To: From: Saravana Kannan Date: Fri, 27 Jan 2023 23:33:38 -0800 Message-ID: Subject: Re: [PATCH v2 04/11] gpiolib: Clear the gpio_device's fwnode initialized flag before adding To: Andy Shevchenko Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Sudeep Holla , 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 Fri, Jan 27, 2023 at 1:27 AM Andy Shevchenko 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); > > Do not dereference fwnode in struct device. Use dev_fwnode() for that. > > struct fwnode_handle *fwnode = dev_fwnode(&gdev->dev); > > if (!fwnode->dev) > fwnode_dev_initialized(fwnode, false); Honestly, we should work towards NOT needing dev_fwnode(). The function literally dereferences dev->fwnode or the one inside of_node. So my dereference is fine. The whole "fwnode might not be set for devices with of_node" is wrong and we should fix that instead of writing wrappers to work around it. Also, for now I'm going to leave this as if for the same reasons as I mentioned in Patch 1. > > + Blank line. Ack. -Saravana > > > ret = gcdev_register(gdev, gpio_devt); > > if (ret) > > return ret; > > -- > With Best Regards, > Andy Shevchenko > > > -- > To unsubscribe from this group and stop receiving emails from it, send an email to kernel-team+unsubscribe@android.com. >