diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2005-11-09 17:32:44 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2005-11-09 17:32:44 -0500 |
commit | 3ae5eaec1d2d9c0cf53745352e7d4b152810ba24 (patch) | |
tree | d8825be54cefb6ad6707478d719c8e30605bee7b /arch/arm/common/scoop.c | |
parent | 00d3dcdd96646be6059cc21f2efa94c4edc1eda5 (diff) |
[DRIVER MODEL] Convert platform drivers to use struct platform_driver
This allows us to eliminate the casts in the drivers, and eventually
remove the use of the device_driver function pointer methods for
platform device drivers.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'arch/arm/common/scoop.c')
-rw-r--r-- | arch/arm/common/scoop.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/arch/arm/common/scoop.c b/arch/arm/common/scoop.c index c7fdf390cef9..32924c6714fe 100644 --- a/arch/arm/common/scoop.c +++ b/arch/arm/common/scoop.c | |||
@@ -98,9 +98,9 @@ static void check_scoop_reg(struct scoop_dev *sdev) | |||
98 | } | 98 | } |
99 | 99 | ||
100 | #ifdef CONFIG_PM | 100 | #ifdef CONFIG_PM |
101 | static int scoop_suspend(struct device *dev, pm_message_t state) | 101 | static int scoop_suspend(struct platform_device *dev, pm_message_t state) |
102 | { | 102 | { |
103 | struct scoop_dev *sdev = dev_get_drvdata(dev); | 103 | struct scoop_dev *sdev = platform_get_drvdata(dev); |
104 | 104 | ||
105 | check_scoop_reg(sdev); | 105 | check_scoop_reg(sdev); |
106 | sdev->scoop_gpwr = SCOOP_REG(sdev->base, SCOOP_GPWR); | 106 | sdev->scoop_gpwr = SCOOP_REG(sdev->base, SCOOP_GPWR); |
@@ -109,9 +109,9 @@ static int scoop_suspend(struct device *dev, pm_message_t state) | |||
109 | return 0; | 109 | return 0; |
110 | } | 110 | } |
111 | 111 | ||
112 | static int scoop_resume(struct device *dev) | 112 | static int scoop_resume(struct platform_device *dev) |
113 | { | 113 | { |
114 | struct scoop_dev *sdev = dev_get_drvdata(dev); | 114 | struct scoop_dev *sdev = platform_get_drvdata(dev); |
115 | 115 | ||
116 | check_scoop_reg(sdev); | 116 | check_scoop_reg(sdev); |
117 | SCOOP_REG(sdev->base,SCOOP_GPWR) = sdev->scoop_gpwr; | 117 | SCOOP_REG(sdev->base,SCOOP_GPWR) = sdev->scoop_gpwr; |
@@ -123,11 +123,10 @@ static int scoop_resume(struct device *dev) | |||
123 | #define scoop_resume NULL | 123 | #define scoop_resume NULL |
124 | #endif | 124 | #endif |
125 | 125 | ||
126 | int __init scoop_probe(struct device *dev) | 126 | int __init scoop_probe(struct platform_device *pdev) |
127 | { | 127 | { |
128 | struct scoop_dev *devptr; | 128 | struct scoop_dev *devptr; |
129 | struct scoop_config *inf; | 129 | struct scoop_config *inf; |
130 | struct platform_device *pdev = to_platform_device(dev); | ||
131 | struct resource *mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 130 | struct resource *mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
132 | 131 | ||
133 | if (!mem) | 132 | if (!mem) |
@@ -141,7 +140,7 @@ int __init scoop_probe(struct device *dev) | |||
141 | memset(devptr, 0, sizeof(struct scoop_dev)); | 140 | memset(devptr, 0, sizeof(struct scoop_dev)); |
142 | spin_lock_init(&devptr->scoop_lock); | 141 | spin_lock_init(&devptr->scoop_lock); |
143 | 142 | ||
144 | inf = dev->platform_data; | 143 | inf = pdev->dev.platform_data; |
145 | devptr->base = ioremap(mem->start, mem->end - mem->start + 1); | 144 | devptr->base = ioremap(mem->start, mem->end - mem->start + 1); |
146 | 145 | ||
147 | if (!devptr->base) { | 146 | if (!devptr->base) { |
@@ -149,7 +148,7 @@ int __init scoop_probe(struct device *dev) | |||
149 | return -ENOMEM; | 148 | return -ENOMEM; |
150 | } | 149 | } |
151 | 150 | ||
152 | dev_set_drvdata(dev, devptr); | 151 | platform_set_drvdata(pdev, devptr); |
153 | 152 | ||
154 | printk("Sharp Scoop Device found at 0x%08x -> 0x%08x\n",(unsigned int)mem->start,(unsigned int)devptr->base); | 153 | printk("Sharp Scoop Device found at 0x%08x -> 0x%08x\n",(unsigned int)mem->start,(unsigned int)devptr->base); |
155 | 154 | ||
@@ -164,29 +163,30 @@ int __init scoop_probe(struct device *dev) | |||
164 | return 0; | 163 | return 0; |
165 | } | 164 | } |
166 | 165 | ||
167 | static int scoop_remove(struct device *dev) | 166 | static int scoop_remove(struct platform_device *pdev) |
168 | { | 167 | { |
169 | struct scoop_dev *sdev = dev_get_drvdata(dev); | 168 | struct scoop_dev *sdev = platform_get_drvdata(pdev); |
170 | if (sdev) { | 169 | if (sdev) { |
171 | iounmap(sdev->base); | 170 | iounmap(sdev->base); |
172 | kfree(sdev); | 171 | kfree(sdev); |
173 | dev_set_drvdata(dev, NULL); | 172 | platform_set_drvdata(pdev, NULL); |
174 | } | 173 | } |
175 | return 0; | 174 | return 0; |
176 | } | 175 | } |
177 | 176 | ||
178 | static struct device_driver scoop_driver = { | 177 | static struct platform_driver scoop_driver = { |
179 | .name = "sharp-scoop", | ||
180 | .bus = &platform_bus_type, | ||
181 | .probe = scoop_probe, | 178 | .probe = scoop_probe, |
182 | .remove = scoop_remove, | 179 | .remove = scoop_remove, |
183 | .suspend = scoop_suspend, | 180 | .suspend = scoop_suspend, |
184 | .resume = scoop_resume, | 181 | .resume = scoop_resume, |
182 | .driver = { | ||
183 | .name = "sharp-scoop", | ||
184 | }, | ||
185 | }; | 185 | }; |
186 | 186 | ||
187 | int __init scoop_init(void) | 187 | int __init scoop_init(void) |
188 | { | 188 | { |
189 | return driver_register(&scoop_driver); | 189 | return platform_driver_register(&scoop_driver); |
190 | } | 190 | } |
191 | 191 | ||
192 | subsys_initcall(scoop_init); | 192 | subsys_initcall(scoop_init); |