The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Russell King <rmk+lkml@arm.linux.org.uk>
To: Linux Kernel List <linux-kernel@vger.kernel.org>
Subject: Re: [DRIVER MODEL] Convert drivers/misc/hdpuftrs
Date: Sat, 5 Nov 2005 18:20:25 +0000	[thread overview]
Message-ID: <20051105182024.GU14419@flint.arm.linux.org.uk> (raw)
In-Reply-To: <20051105181122.GD12228@flint.arm.linux.org.uk>

Convert platform drivers to use struct platform_driver

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

diff -u b/drivers/misc/hdpuftrs/hdpu_cpustate.c b/drivers/misc/hdpuftrs/hdpu_cpustate.c
--- b/drivers/misc/hdpuftrs/hdpu_cpustate.c
+++ b/drivers/misc/hdpuftrs/hdpu_cpustate.c
@@ -27,8 +27,8 @@
 
 #define SKY_CPUSTATE_VERSION		"1.1"
 
-static int hdpu_cpustate_probe(struct device *ddev);
-static int hdpu_cpustate_remove(struct device *ddev);
+static int hdpu_cpustate_probe(struct platform_device *pdev);
+static int hdpu_cpustate_remove(struct platform_device *pdev);
 
 struct cpustate_t cpustate;
 
@@ -159,11 +159,12 @@
 	return len;
 }
 
-static struct device_driver hdpu_cpustate_driver = {
-	.name = HDPU_CPUSTATE_NAME,
-	.bus = &platform_bus_type,
+static struct platform_driver hdpu_cpustate_driver = {
 	.probe = hdpu_cpustate_probe,
 	.remove = hdpu_cpustate_remove,
+	.driver = {
+		.name = HDPU_CPUSTATE_NAME,
+	},
 };
 
 /*
@@ -188,9 +189,8 @@
 	&cpustate_fops
 };
 
-static int hdpu_cpustate_probe(struct device *ddev)
+static int hdpu_cpustate_probe(struct platform_device *pdev)
 {
-	struct platform_device *pdev = to_platform_device(ddev);
 	struct resource *res;
 	struct proc_dir_entry *proc_de;
 	int ret;
@@ -218,7 +218,7 @@
 	return 0;
 }
 
-static int hdpu_cpustate_remove(struct device *ddev)
+static int hdpu_cpustate_remove(struct platform_device *pdev)
 {
 
 	cpustate.set_addr = NULL;
@@ -233,13 +233,13 @@
 static int __init cpustate_init(void)
 {
 	int rc;
-	rc = driver_register(&hdpu_cpustate_driver);
+	rc = platform_driver_register(&hdpu_cpustate_driver);
 	return rc;
 }
 
 static void __exit cpustate_exit(void)
 {
-	driver_unregister(&hdpu_cpustate_driver);
+	platform_driver_unregister(&hdpu_cpustate_driver);
 }
 
 module_init(cpustate_init);
diff -u b/drivers/misc/hdpuftrs/hdpu_nexus.c b/drivers/misc/hdpuftrs/hdpu_nexus.c
--- b/drivers/misc/hdpuftrs/hdpu_nexus.c
+++ b/drivers/misc/hdpuftrs/hdpu_nexus.c
@@ -23,19 +23,20 @@
 
 #include <linux/platform_device.h>
 
-static int hdpu_nexus_probe(struct device *ddev);
-static int hdpu_nexus_remove(struct device *ddev);
+static int hdpu_nexus_probe(struct platform_device *pdev);
+static int hdpu_nexus_remove(struct platform_device *pdev);
 
 static struct proc_dir_entry *hdpu_slot_id;
 static struct proc_dir_entry *hdpu_chassis_id;
 static int slot_id = -1;
 static int chassis_id = -1;
 
-static struct device_driver hdpu_nexus_driver = {
-	.name = HDPU_NEXUS_NAME,
-	.bus = &platform_bus_type,
+static struct platform_driver hdpu_nexus_driver = {
 	.probe = hdpu_nexus_probe,
 	.remove = hdpu_nexus_remove,
+	.driver = {
+		.name = HDPU_NEXUS_NAME,
+	},
 };
 
 int hdpu_slot_id_read(char *buffer, char **buffer_location, off_t offset,
@@ -56,9 +57,8 @@
 	return sprintf(buffer, "%d\n", chassis_id);
 }
 
-static int hdpu_nexus_probe(struct device *ddev)
+static int hdpu_nexus_probe(struct platform_device *pdev)
 {
-	struct platform_device *pdev = to_platform_device(ddev);
 	struct resource *res;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -81,7 +81,7 @@
 	return 0;
 }
 
-static int hdpu_nexus_remove(struct device *ddev)
+static int hdpu_nexus_remove(struct platform_device *pdev)
 {
 	slot_id = -1;
 	chassis_id = -1;
@@ -95,13 +95,13 @@
 static int __init nexus_init(void)
 {
 	int rc;
-	rc = driver_register(&hdpu_nexus_driver);
+	rc = platform_driver_register(&hdpu_nexus_driver);
 	return rc;
 }
 
 static void __exit nexus_exit(void)
 {
-	driver_unregister(&hdpu_nexus_driver);
+	platform_driver_unregister(&hdpu_nexus_driver);
 }
 
 module_init(nexus_init);


-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core

      parent reply	other threads:[~2005-11-05 18:20 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-05 18:11 [DRIVER MODEL] Add platform_driver Russell King
2005-11-05 18:12 ` Russell King
2005-11-06 20:39   ` Greg KH
2005-11-05 18:12 ` [DRIVER MODEL] Convert arch/arm Russell King
2005-11-05 18:13 ` [DRIVER MODEL] Convert arch/um/ Russell King
2005-11-05 18:14 ` [DRIVER MODEL] Convert arch/xtensa/ Russell King
2005-11-05 18:14 ` [DRIVER MODEL] Convert ARM s3c2410 drivers Russell King
2005-11-05 18:15 ` [DRIVER MODEL] Convert ARM SA1100 drivers Russell King
2005-11-05 18:15 ` [DRIVER MODEL] Convert ARM PXA drivers Russell King
2005-11-05 18:15 ` [DRIVER MODEL] Convert ARM IMX drivers Russell King
2005-11-05 18:16 ` [DRIVER MODEL] Convert ARM OMAP drivers Russell King
2005-11-05 18:16 ` [DRIVER MODEL] Convert ARM Zaurus drivers Russell King
2005-11-05 18:17 ` [DRIVER MODEL] Convert MMC drivers Russell King
2005-11-05 18:17 ` [DRIVER MODEL] Convert MTD drivers Russell King
2005-11-05 18:17 ` [DRIVER MODEL] Convert serial drivers Russell King
2005-11-05 18:17 ` [DRIVER MODEL] Convert i2c drivers Russell King
2005-11-05 18:18 ` [DRIVER MODEL] Convert input drivers Russell King
2005-11-05 18:18 ` [DRIVER MODEL] Convert network drivers Russell King
2005-11-05 18:18 ` [DRIVER MODEL] Convert USB drivers Russell King
2005-11-05 18:19 ` [DRIVER MODEL] Convert miscellaneous char drivers Russell King
2005-11-05 18:19 ` [DRIVER MODEL] Convert video drivers Russell King
2005-11-05 18:19 ` [DRIVER MODEL] Convert ALSA Russell King
2005-11-05 18:20 ` Russell King [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20051105182024.GU14419@flint.arm.linux.org.uk \
    --to=rmk+lkml@arm.linux.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox