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 427F8C54EED for ; Mon, 30 Jan 2023 12:08:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235634AbjA3MIP (ORCPT ); Mon, 30 Jan 2023 07:08:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236531AbjA3MID (ORCPT ); Mon, 30 Jan 2023 07:08:03 -0500 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33D5130180; Mon, 30 Jan 2023 04:07:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1675080439; x=1706616439; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=L8oHpgiQkMSBM2SGo1lMty/TFLibAaBZaruIjfet5+o=; b=RIbRL4iuurpmcGH98p+ohe9OYus1xtYMU81sSaKjTqpUbmuicuUM6kyJ qoJvc2qm6kzjMk1Lo14TEy1Kl/r4zOf0YvVwcd18t5xIHnEQbGL7IN1Pc wBdrfgcwPh+LbG4Ksc7gexro6QKTxD7qsiqV6RNXWni6knD+FBXR5apHV yx/Yp6bqU0ttdOQnTlq5WuQHZ2DTrvzYM9M2p6UqZuPkKoXtJ7LVLndjO R6XG59+67bdv9ZRVC2mBmV9Jq+IGkaO5Ec2qZ59nEtmfYyXqDsKCIfhtX KItFak1Jb6oiRPM51+xMTELIOJ8/tc51fhKo9surCNHzmOvCGScomspMk Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10605"; a="311160688" X-IronPort-AV: E=Sophos;i="5.97,257,1669104000"; d="scan'208";a="311160688" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jan 2023 04:06:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10605"; a="909473739" X-IronPort-AV: E=Sophos;i="5.97,257,1669104000"; d="scan'208";a="909473739" Received: from smile.fi.intel.com ([10.237.72.54]) by fmsmga006.fm.intel.com with ESMTP; 30 Jan 2023 04:05:59 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1pMSv5-00HKuX-01; Mon, 30 Jan 2023 14:05:55 +0200 Date: Mon, 30 Jan 2023 14:05:54 +0200 From: Andy Shevchenko To: Saravana Kannan 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 Subject: Re: [PATCH v2 04/11] gpiolib: Clear the gpio_device's fwnode initialized flag before adding Message-ID: References: <20230127001141.407071-1-saravanak@google.com> <20230127001141.407071-5-saravanak@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org On Fri, Jan 27, 2023 at 11:33:38PM -0800, Saravana Kannan wrote: > 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: ... > > > + /* > > > + * 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(). Honestly, it's that We SHOULD go to avoid any direct dereference of fwnode from the struct device. I explained you in the comment in the other patch. > 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. Same. -- With Best Regards, Andy Shevchenko 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 E7FF6C54EAA for ; Mon, 30 Jan 2023 18:46:21 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=zInRMuH2OsT133H3iOCLfZz5maDbeByzA3ZnYRB3zVY=; b=ZDU5VBA1mH4/+1 wiyB/DjaRSQgcjTJS3bmHTRrKBlwEbaPUQT5dsRdLHdhFU/ezfivJtJZzPswcic1Z7P6bA55slLA8 81vKODa0uCmRdRbC2q30a2aPK6CAmGyTzGvY3JAdk1tVY1WS+9QRwi/ulK9AGctBJNVG75X29Pxjw 5HDeZJVAxDemP+ekIGtNVH2ErkAD7tNkNBZIzze0uGV7FRMy0LrdiCOcXe+MUDK8UT1k8MI2eCE10 h5DdvPo5QT0OVaKxkh4WwP9rF+BfGnw5uHJCFSFCpbuDagcqQNDDxKEYxywN3iehjK6hCyQs2PqHA pGRrwmfldMMEe6T5AboQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pMZ9d-0055hm-Gf; Mon, 30 Jan 2023 18:45:21 +0000 Received: from mga18.intel.com ([134.134.136.126]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pMXyH-004Yo6-Us for linux-arm-kernel@lists.infradead.org; Mon, 30 Jan 2023 17:29:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1675099773; x=1706635773; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=L8oHpgiQkMSBM2SGo1lMty/TFLibAaBZaruIjfet5+o=; b=kyFah+M6qkoqHgrKnBfArENv1nGszKGkiU645TlF3fdpKwKYfPzeM20J GJ7+DE9EyYP4zOeg6dDgnOBvQksJBnmCecbOHeE+b1Q7rPlXJkqW9DRLO 8ACMLj6Tw6nuw7KN/xzWHC0wd+kMdRvZomgbB6EVUU8p8/3Wu5EIA8yBo V4YAxqSU+YFbsg32jvx3BN4i6hZWEFjmq501/mqKIC/IGS+DVO1PxuDUG i4gaBfdIpx3V8rnJmbX2MHiVsJu1IzzkdCofICcS06QUjDd4NSFetwEWx ebGPI+t5IzmK107aviEowCbSYtsuyMky0BLehf3cTX/MUlPaepDYQP+R2 Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10605"; a="311160692" X-IronPort-AV: E=Sophos;i="5.97,257,1669104000"; d="scan'208";a="311160692" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jan 2023 04:06:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10605"; a="909473739" X-IronPort-AV: E=Sophos;i="5.97,257,1669104000"; d="scan'208";a="909473739" Received: from smile.fi.intel.com ([10.237.72.54]) by fmsmga006.fm.intel.com with ESMTP; 30 Jan 2023 04:05:59 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1pMSv5-00HKuX-01; Mon, 30 Jan 2023 14:05:55 +0200 Date: Mon, 30 Jan 2023 14:05:54 +0200 From: Andy Shevchenko To: Saravana Kannan 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 Subject: Re: [PATCH v2 04/11] gpiolib: Clear the gpio_device's fwnode initialized flag before adding Message-ID: References: <20230127001141.407071-1-saravanak@google.com> <20230127001141.407071-5-saravanak@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230130_092934_162831_3B884AE9 X-CRM114-Status: GOOD ( 23.28 ) 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 Fri, Jan 27, 2023 at 11:33:38PM -0800, Saravana Kannan wrote: > 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: ... > > > + /* > > > + * 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(). Honestly, it's that We SHOULD go to avoid any direct dereference of fwnode from the struct device. I explained you in the comment in the other patch. > 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. Same. -- With Best Regards, Andy Shevchenko _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel