From: Ben Dooks <ben-linux@fluff.org>
Date: Thu, 22 Jun 2006 21:18:13 +0000 (+0100)
Subject: [ARM] 3613/1: S3C2410: Add sysdev and sysclass
X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a341305e94982c66a2e94125a24b860605da9066;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git

[ARM] 3613/1: S3C2410: Add sysdev and sysclass

Patch from Ben Dooks

The S3C2440 and S3C2442 both have their own sysdev
and sysclass for differentiating them from the
currently default S3C2410.

Add a sysdev for the S3C2410 as part of the work
to make the code be non-dependant on the S3C2410.

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---

diff --git a/arch/arm/mach-s3c2410/cpu.h b/arch/arm/mach-s3c2410/cpu.h
index 40862899b2f..21c62dc29bb 100644
--- a/arch/arm/mach-s3c2410/cpu.h
+++ b/arch/arm/mach-s3c2410/cpu.h
@@ -73,5 +73,6 @@ extern struct sys_timer s3c24xx_timer;
 
 /* system device classes */
 
+extern struct sysdev_class s3c2410_sysclass;
 extern struct sysdev_class s3c2440_sysclass;
 extern struct sysdev_class s3c2442_sysclass;
diff --git a/arch/arm/mach-s3c2410/s3c2410.c b/arch/arm/mach-s3c2410/s3c2410.c
index 0852e87a79c..cb252ddf3c7 100644
--- a/arch/arm/mach-s3c2410/s3c2410.c
+++ b/arch/arm/mach-s3c2410/s3c2410.c
@@ -27,6 +27,7 @@
 #include <linux/list.h>
 #include <linux/timer.h>
 #include <linux/init.h>
+#include <linux/sysdev.h>
 #include <linux/platform_device.h>
 
 #include <asm/mach/arch.h>
@@ -110,9 +111,30 @@ void __init s3c2410_init_clocks(int xtal)
 	s3c24xx_setup_clocks(xtal, fclk, hclk, pclk);
 }
 
+struct sysdev_class s3c2410_sysclass = {
+	set_kset_name("s3c2410-core"),
+};
+
+static struct sys_device s3c2410_sysdev = {
+	.cls		= &s3c2410_sysclass,
+};
+
+/* need to register class before we actually register the device, and
+ * we also need to ensure that it has been initialised before any of the
+ * drivers even try to use it (even if not on an s3c2440 based system)
+ * as a driver which may support both 2410 and 2440 may try and use it.
+*/
+
+static int __init s3c2410_core_init(void)
+{
+	return sysdev_class_register(&s3c2410_sysclass);
+}
+
+core_initcall(s3c2410_core_init);
+
 int __init s3c2410_init(void)
 {
 	printk("S3C2410: Initialising architecture\n");
 
-	return 0;
+	return sysdev_register(&s3c2410_sysdev);
 }