* [PATCH] soc/tegra: move soc_device_register call out of arch/arm
@ 2015-03-09 2:31 Joseph Lo
[not found] ` <1425868301-22767-1-git-send-email-josephl-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Joseph Lo @ 2015-03-09 2:31 UTC (permalink / raw)
To: Stephen Warren, Thierry Reding, Alexandre Courbot
Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Joseph Lo
Expending the usage for both Tegra & Tegra64 SoCs.
Signed-off-by: Joseph Lo <josephl-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
arch/arm/mach-tegra/tegra.c | 31 +------------------------------
drivers/soc/tegra/common.c | 33 +++++++++++++++++++++++++++++++++
2 files changed, 34 insertions(+), 30 deletions(-)
diff --git a/arch/arm/mach-tegra/tegra.c b/arch/arm/mach-tegra/tegra.c
index 914341bcef25..95df6a97b956 100644
--- a/arch/arm/mach-tegra/tegra.c
+++ b/arch/arm/mach-tegra/tegra.c
@@ -87,36 +87,7 @@ static void __init tegra_dt_init_irq(void)
static void __init tegra_dt_init(void)
{
- struct soc_device_attribute *soc_dev_attr;
- struct soc_device *soc_dev;
- struct device *parent = NULL;
-
- soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
- if (!soc_dev_attr)
- goto out;
-
- soc_dev_attr->family = kasprintf(GFP_KERNEL, "Tegra");
- soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%d",
- tegra_sku_info.revision);
- soc_dev_attr->soc_id = kasprintf(GFP_KERNEL, "%u", tegra_get_chip_id());
-
- soc_dev = soc_device_register(soc_dev_attr);
- if (IS_ERR(soc_dev)) {
- kfree(soc_dev_attr->family);
- kfree(soc_dev_attr->revision);
- kfree(soc_dev_attr->soc_id);
- kfree(soc_dev_attr);
- goto out;
- }
-
- parent = soc_device_to_device(soc_dev);
-
- /*
- * Finished with the static registrations now; fill in the missing
- * devices
- */
-out:
- of_platform_populate(NULL, of_default_bus_match_table, NULL, parent);
+ of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
}
static void __init paz00_init(void)
diff --git a/drivers/soc/tegra/common.c b/drivers/soc/tegra/common.c
index a71cb74f3674..caf7d375eeae 100644
--- a/drivers/soc/tegra/common.c
+++ b/drivers/soc/tegra/common.c
@@ -7,8 +7,11 @@
*/
#include <linux/of.h>
+#include <linux/slab.h>
+#include <linux/sys_soc.h>
#include <soc/tegra/common.h>
+#include <soc/tegra/fuse.h>
static const struct of_device_id tegra_machine_match[] = {
{ .compatible = "nvidia,tegra20", },
@@ -28,3 +31,33 @@ bool soc_is_tegra(void)
return of_match_node(tegra_machine_match, root) != NULL;
}
+
+static int __init tegra_soc_init(void)
+{
+ struct soc_device_attribute *soc_dev_attr;
+ struct soc_device *soc_dev;
+
+ if (!soc_is_tegra())
+ return 0;
+
+ soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
+ if (!soc_dev_attr)
+ return -ENOMEM;
+
+ soc_dev_attr->family = kasprintf(GFP_KERNEL, "Tegra");
+ soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%d",
+ tegra_sku_info.revision);
+ soc_dev_attr->soc_id = kasprintf(GFP_KERNEL, "%u", tegra_get_chip_id());
+
+ soc_dev = soc_device_register(soc_dev_attr);
+ if (IS_ERR(soc_dev)) {
+ kfree(soc_dev_attr->family);
+ kfree(soc_dev_attr->revision);
+ kfree(soc_dev_attr->soc_id);
+ kfree(soc_dev_attr);
+ return -ENODEV;
+ }
+
+ return 0;
+}
+device_initcall(tegra_soc_init);
--
2.3.1
^ permalink raw reply related [flat|nested] 5+ messages in thread[parent not found: <1425868301-22767-1-git-send-email-josephl-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH] soc/tegra: move soc_device_register call out of arch/arm [not found] ` <1425868301-22767-1-git-send-email-josephl-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> @ 2015-03-11 8:34 ` Thierry Reding 2015-03-12 0:40 ` Joseph Lo 2015-03-11 16:22 ` Uwe Kleine-König 1 sibling, 1 reply; 5+ messages in thread From: Thierry Reding @ 2015-03-11 8:34 UTC (permalink / raw) To: Joseph Lo, Stephen Warren Cc: Alexandre Courbot, linux-tegra-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r [-- Attachment #1: Type: text/plain, Size: 2596 bytes --] On Mon, Mar 09, 2015 at 10:31:41AM +0800, Joseph Lo wrote: > Expending the usage for both Tegra & Tegra64 SoCs. > > Signed-off-by: Joseph Lo <josephl-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> > --- > arch/arm/mach-tegra/tegra.c | 31 +------------------------------ > drivers/soc/tegra/common.c | 33 +++++++++++++++++++++++++++++++++ > 2 files changed, 34 insertions(+), 30 deletions(-) > > diff --git a/arch/arm/mach-tegra/tegra.c b/arch/arm/mach-tegra/tegra.c > index 914341bcef25..95df6a97b956 100644 > --- a/arch/arm/mach-tegra/tegra.c > +++ b/arch/arm/mach-tegra/tegra.c > @@ -87,36 +87,7 @@ static void __init tegra_dt_init_irq(void) > > static void __init tegra_dt_init(void) > { > - struct soc_device_attribute *soc_dev_attr; > - struct soc_device *soc_dev; > - struct device *parent = NULL; > - > - soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); > - if (!soc_dev_attr) > - goto out; > - > - soc_dev_attr->family = kasprintf(GFP_KERNEL, "Tegra"); > - soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%d", > - tegra_sku_info.revision); > - soc_dev_attr->soc_id = kasprintf(GFP_KERNEL, "%u", tegra_get_chip_id()); > - > - soc_dev = soc_device_register(soc_dev_attr); > - if (IS_ERR(soc_dev)) { > - kfree(soc_dev_attr->family); > - kfree(soc_dev_attr->revision); > - kfree(soc_dev_attr->soc_id); > - kfree(soc_dev_attr); > - goto out; > - } > - > - parent = soc_device_to_device(soc_dev); > - > - /* > - * Finished with the static registrations now; fill in the missing > - * devices > - */ > -out: > - of_platform_populate(NULL, of_default_bus_match_table, NULL, parent); > + of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); One of the reasons for adding the soc_device in the first place was so that it would be possible to use it as the parent for all devices that are instantiated from device tree. You remove that here, and break the ABI in the process. Arguably no userspace should be relying on the exact path in sysfs, but I'd still like to keep the top-level parent. Which reminds me of a discussion a while back about introducing a top- level driver for the SoC. I'm not sure if anything came of that. Stephen, do you know if there was a conclusion on that discussion? As far as I remember this sparked around the time when we moved drivers to drivers/soc and started splitting things up into initcalls. I'm thinking that if nothing like that was created yet, perhaps soc_device and soc_bus_type would be good candidates to implement this on top of. Thierry [-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] soc/tegra: move soc_device_register call out of arch/arm 2015-03-11 8:34 ` Thierry Reding @ 2015-03-12 0:40 ` Joseph Lo 0 siblings, 0 replies; 5+ messages in thread From: Joseph Lo @ 2015-03-12 0:40 UTC (permalink / raw) To: Thierry Reding, Stephen Warren Cc: linux-tegra, Alexandre Courbot, linux-arm-kernel On 03/11/2015 04:34 PM, Thierry Reding wrote: > * PGP Signed by an unknown key > > On Mon, Mar 09, 2015 at 10:31:41AM +0800, Joseph Lo wrote: >> Expending the usage for both Tegra & Tegra64 SoCs. >> >> Signed-off-by: Joseph Lo <josephl@nvidia.com> >> --- >> arch/arm/mach-tegra/tegra.c | 31 +------------------------------ >> drivers/soc/tegra/common.c | 33 +++++++++++++++++++++++++++++++++ >> 2 files changed, 34 insertions(+), 30 deletions(-) >> >> diff --git a/arch/arm/mach-tegra/tegra.c b/arch/arm/mach-tegra/tegra.c >> index 914341bcef25..95df6a97b956 100644 >> --- a/arch/arm/mach-tegra/tegra.c >> +++ b/arch/arm/mach-tegra/tegra.c >> @@ -87,36 +87,7 @@ static void __init tegra_dt_init_irq(void) >> >> static void __init tegra_dt_init(void) >> { >> - struct soc_device_attribute *soc_dev_attr; >> - struct soc_device *soc_dev; >> - struct device *parent = NULL; >> - >> - soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); >> - if (!soc_dev_attr) >> - goto out; >> - >> - soc_dev_attr->family = kasprintf(GFP_KERNEL, "Tegra"); >> - soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%d", >> - tegra_sku_info.revision); >> - soc_dev_attr->soc_id = kasprintf(GFP_KERNEL, "%u", tegra_get_chip_id()); >> - >> - soc_dev = soc_device_register(soc_dev_attr); >> - if (IS_ERR(soc_dev)) { >> - kfree(soc_dev_attr->family); >> - kfree(soc_dev_attr->revision); >> - kfree(soc_dev_attr->soc_id); >> - kfree(soc_dev_attr); >> - goto out; >> - } >> - >> - parent = soc_device_to_device(soc_dev); >> - >> - /* >> - * Finished with the static registrations now; fill in the missing >> - * devices >> - */ >> -out: >> - of_platform_populate(NULL, of_default_bus_match_table, NULL, parent); >> + of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); > > One of the reasons for adding the soc_device in the first place was so > that it would be possible to use it as the parent for all devices that > are instantiated from device tree. You remove that here, and break the > ABI in the process. Arguably no userspace should be relying on the exact > path in sysfs, but I'd still like to keep the top-level parent. > That would be a problem if you want to keep the same "ABI" in ARM64 kernel. > Which reminds me of a discussion a while back about introducing a top- > level driver for the SoC. I'm not sure if anything came of that. > > Stephen, do you know if there was a conclusion on that discussion? As > far as I remember this sparked around the time when we moved drivers to > drivers/soc and started splitting things up into initcalls. I'm thinking > that if nothing like that was created yet, perhaps soc_device and > soc_bus_type would be good candidates to implement this on top of. > > Thierry > > * Unknown Key > * 0x7F3EB3A1 > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] soc/tegra: move soc_device_register call out of arch/arm [not found] ` <1425868301-22767-1-git-send-email-josephl-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> 2015-03-11 8:34 ` Thierry Reding @ 2015-03-11 16:22 ` Uwe Kleine-König [not found] ` <20150311162205.GK952-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> 1 sibling, 1 reply; 5+ messages in thread From: Uwe Kleine-König @ 2015-03-11 16:22 UTC (permalink / raw) To: Joseph Lo Cc: Stephen Warren, Thierry Reding, Alexandre Courbot, linux-tegra-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r On Mon, Mar 09, 2015 at 10:31:41AM +0800, Joseph Lo wrote: > Expending the usage for both Tegra & Tegra64 SoCs. Expanding? Mabe better: Moving this code to drivers/soc/tegra allows the aarch64 SoCs to use it, too. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ | ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <20150311162205.GK952-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>]
* Re: [PATCH] soc/tegra: move soc_device_register call out of arch/arm [not found] ` <20150311162205.GK952-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> @ 2015-03-12 0:35 ` Joseph Lo 0 siblings, 0 replies; 5+ messages in thread From: Joseph Lo @ 2015-03-12 0:35 UTC (permalink / raw) To: Uwe Kleine-König Cc: Stephen Warren, Thierry Reding, Alexandre Courbot, linux-tegra-u79uwXL29TY76Z2rM5mHXA, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r Oops, sorry for typo. Thanks, Uwe. On 03/12/2015 12:22 AM, Uwe Kleine-König wrote: > On Mon, Mar 09, 2015 at 10:31:41AM +0800, Joseph Lo wrote: >> Expending the usage for both Tegra & Tegra64 SoCs. > Expanding? Mabe better: Moving this code to drivers/soc/tegra allows the > aarch64 SoCs to use it, too. > > Best regards > Uwe > ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-03-12 0:40 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-09 2:31 [PATCH] soc/tegra: move soc_device_register call out of arch/arm Joseph Lo
[not found] ` <1425868301-22767-1-git-send-email-josephl-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-03-11 8:34 ` Thierry Reding
2015-03-12 0:40 ` Joseph Lo
2015-03-11 16:22 ` Uwe Kleine-König
[not found] ` <20150311162205.GK952-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2015-03-12 0:35 ` Joseph Lo
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).