From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933709AbeALNPN (ORCPT + 1 other); Fri, 12 Jan 2018 08:15:13 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:36173 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933458AbeALNPL (ORCPT ); Fri, 12 Jan 2018 08:15:11 -0500 X-Google-Smtp-Source: ACJfBosre424p2xjVrrdy/vu41UhrpYymKIijPcH9GHbz+CFJdZFohVE1xKhU28xXpvbJ9bii7taeg== Date: Fri, 12 Jan 2018 14:15:08 +0100 From: Thierry Reding To: Sudeep Holla Cc: Brian Norris , Gregory Fong , Florian Fainelli , arm@kernel.org, bcm-kernel-feedback-list@broadcom.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] soc: brcmstb: Only register SoC device on STB platforms Message-ID: <20180112131508.GC19999@ulmo> References: <20180109145409.11612-1-thierry.reding@gmail.com> <973b2445-48ca-87a9-b4c2-21d8bfec76dd@arm.com> <20180112125828.GB19999@ulmo> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="7gGkHNMELEOhSGF6" Content-Disposition: inline In-Reply-To: <20180112125828.GB19999@ulmo> User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: --7gGkHNMELEOhSGF6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jan 12, 2018 at 01:58:28PM +0100, Thierry Reding wrote: > On Fri, Jan 12, 2018 at 12:12:11PM +0000, Sudeep Holla wrote: > >=20 > >=20 > > On 12/01/18 11:39, Sudeep Holla wrote: > > >=20 > > >=20 > > > On 09/01/18 14:54, Thierry Reding wrote: > > >> From: Thierry Reding > > >> > > >> After moving the SoC device initialization to an early initcall in > > >> commit f780429adfbc ("soc: brcmstb: biuctrl: Move to early_initcall"= ), > > >> the Broadcom STB SoC device is registered on all platforms if support > > >> for the device is enabled in the kernel configuration. > > >> > > >> This causes an additional SoC device to appear on platforms that alr= eady > > >> register a native one. In case of Tegra the STB SoC device is regist= ered > > >> as soc0 (with totally meaningless content in the sysfs attributes) a= nd > > >> causes various scripts and programs to fail because they don't know = how > > >> to parse that data. > > >> > > >> To fix this, duplicate the check from brcmstb_soc_device_early_init() > > >> that already prevents the code from doing anything nonsensical on no= n- > > >> STB platforms. > > >> > > >> Fixes: f780429adfbc ("soc: brcmstb: biuctrl: Move to early_initcall") > > >> Signed-off-by: Thierry Reding > > >> --- > > >> drivers/soc/bcm/brcmstb/common.c | 5 +++++ > > >> 1 file changed, 5 insertions(+) > > >> > > >> diff --git a/drivers/soc/bcm/brcmstb/common.c b/drivers/soc/bcm/brcm= stb/common.c > > >> index 781ada62d0a3..4fe1cb73b39a 100644 > > >> --- a/drivers/soc/bcm/brcmstb/common.c > > >> +++ b/drivers/soc/bcm/brcmstb/common.c > > >> @@ -89,8 +89,13 @@ early_initcall(brcmstb_soc_device_early_init); > > >> static int __init brcmstb_soc_device_init(void) > > >> { > > >> struct soc_device_attribute *soc_dev_attr; > > >> + struct device_node *sun_top_ctrl; > > >> struct soc_device *soc_dev; > > >> =20 > > >> + sun_top_ctrl =3D of_find_matching_node(NULL, sun_top_ctrl_match); > > >> + if (!sun_top_ctrl) > > >> + return -ENODEV; > > >> + > > >=20 > > > missing of_node_put(sun_top_ctrl) ? or am I missing to see that elsew= here ? > > >=20 > >=20 > > Further, I still the error messags on my Juno with this patch applied. I > > fail to see how this patch prevents brcmstb_biuctrl_init which is > > early_initcall in drivers/soc/bcm/brcmstb/biuctrl.c getting called ? >=20 > I'm not sure I understand. There's no way we can prevent the early > initcall from running. The point here is to prevent it from running code > that shouldn't be run on a platform. >=20 > That said, perhaps an even better thing would be to return 0 in order to > avoid marking this as failure, since it really isn't an error if this > happens. Oh, I see the errors you mentioned now. They're in the biuctrl code, which I hadn't noticed before since they don't cause any weird behaviour other than the error messages in the boot log. Let me fix that up while I'm on it. Thierry --7gGkHNMELEOhSGF6 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEiOrDCAFJzPfAjcif3SOs138+s6EFAlpYtNkACgkQ3SOs138+ s6F8mA//coTP45j/5FfOIBaO9q0Bj5CyyLQctIVh1uMOGJrduC2j7UtMCnLtY/fk ueaYGA6bJTPJ/8kOYvdvR6Rmlh7HgsNHJQmPdaJZvsasHZqJsbMdXdt86ysRWZoe qtpBmL28KkQ28TT7QufMoWSAky9QA93qfGwl74cRubSdRjLW+2ND1xoe28GvgNpH EoY1jmaqq7swRtbiDin08emCAvj7R0aRJjxJgT7R+zQpV5+uL6CGLVxdvtdWWdDR 1L2oL5IfcByi0bM6pDzFhkbho9qvVtSrbCvn4nJQByo8vPqJUdUs70jdPuUEwEZI ZYaxOP0X+bOkDgIbWS7z1+ZoEAqLMCIhetlam/k33m6j7h4umHFY1IdhZwjWmu0L dfp1bh8WkSWk/6o30Ku6xoNvvYYHr2WIUsJM6RMXEtPOItmtP8/xHi/T73zf9WDT Tzz7e+GdnwgVC5PFRH1IP21BQMDRWOUnlseVd/yLmsd3BZEhq9StDpoyC2Holz9x dPao5GeDkaCMSMIbqwKleAzv6Ji0c6aFv/d96ntrfXRJIQq0OfXhOYQ3XbwpdgaW 57hcjYOn4Nwx2CnyyArf4ipfqVLrnlb898Mb5yrqX2HYkclBC1PU/Pau7+VTMyqx ZHOj2BTDRwziw2o05Hn4qn+d6CfrVqT/zjXUgDiaklH4BLOILHw= =Lcqa -----END PGP SIGNATURE----- --7gGkHNMELEOhSGF6--