From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933713AbeALM6d (ORCPT + 1 other); Fri, 12 Jan 2018 07:58:33 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:42935 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932976AbeALM6b (ORCPT ); Fri, 12 Jan 2018 07:58:31 -0500 X-Google-Smtp-Source: ACJfBosq8H/8qWQqZQH6cl7O5lA7gxmialP7nYnPTt11OML5/ePawf6wgd6cUJmRekA0HrZQnznx1w== Date: Fri, 12 Jan 2018 13:58:28 +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: <20180112125828.GB19999@ulmo> References: <20180109145409.11612-1-thierry.reding@gmail.com> <973b2445-48ca-87a9-b4c2-21d8bfec76dd@arm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="DBIVS5p969aUjpLe" Content-Disposition: inline In-Reply-To: <973b2445-48ca-87a9-b4c2-21d8bfec76dd@arm.com> 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: --DBIVS5p969aUjpLe Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 alrea= dy > >> register a native one. In case of Tegra the STB SoC device is register= ed > >> as soc0 (with totally meaningless content in the sysfs attributes) and > >> 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 non- > >> 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/brcmst= b/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 elsewhe= re ? > >=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 ? 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. 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. Thierry --DBIVS5p969aUjpLe Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEiOrDCAFJzPfAjcif3SOs138+s6EFAlpYsPQACgkQ3SOs138+ s6EJSRAAkEKiybtFXqAw5Jf2OsdUGfHQ5Zxtd7b3JEMCDhAAYpz1LuLsN+wBJHSR iXvGAnB7WsCpQ9jnQPbvQCa/nFv2JqOazj5HXK5f6BobU38meIML1syn8QMZIGOg qToLtEBtsBBA1+4GmxSE+Dlo+gpvH6ZFdD/W8sS42KETy4JlN6p/wxPeNwyMAO+i RqEJ4ReubP7YWg33w4PzwxTTKzzM7c1fYJ1THG+h3l6KPO3fyGJ8dAyT0aVlSx4D sHvswrp3W+2BaL8+myGoNCCynwMItwq7Sb/GQ7GPx0jvCFTM6d1baU1310GvpuFm ZtnB85Alng6D+Md4Hqlkac0r0RGcdnnFcU7e4i26iopRXPEJ7N0jKuexBGrW4tLT /XaTpJrzIKouCptUFatf0KtP1WG3n3kqaxBVN/7HFWlrPMsIxX3Js9HYVoFiJI0B S8SdYFLJnAO6jRhI23csShrOYukAxEuekWvLzFELQQzvw4gNjDu/h9IBiLZ72er+ exBUYgyrlEEvFWcl/1PcDwZvRpCkdLz0lqX2stRFzWqtmHV5iKHqMs+dBhQ0Zcw9 yGfpumyt0OBbrusTq6FxmLuP9EyHSwMD4+TTHOb2UTYj+yRWfyXwy6VsF1S1V7Sh oLIMbzYQTezs9UzVw7rzOiN/qNiBIfaAzyjO1ML6mRXXkOeiTSE= =4/8w -----END PGP SIGNATURE----- --DBIVS5p969aUjpLe--