diff options
Diffstat (limited to 'drivers/mtd/maps')
-rw-r--r-- | drivers/mtd/maps/bast-flash.c | 33 | ||||
-rw-r--r-- | drivers/mtd/maps/integrator-flash.c | 23 | ||||
-rw-r--r-- | drivers/mtd/maps/ixp2000.c | 25 | ||||
-rw-r--r-- | drivers/mtd/maps/ixp4xx.c | 25 | ||||
-rw-r--r-- | drivers/mtd/maps/omap_nor.c | 23 | ||||
-rw-r--r-- | drivers/mtd/maps/plat-ram.c | 68 | ||||
-rw-r--r-- | drivers/mtd/maps/sa1100-flash.c | 36 |
7 files changed, 112 insertions, 121 deletions
diff --git a/drivers/mtd/maps/bast-flash.c b/drivers/mtd/maps/bast-flash.c index b7858eb93534..51f962dd7e31 100644 --- a/drivers/mtd/maps/bast-flash.c +++ b/drivers/mtd/maps/bast-flash.c | |||
@@ -63,11 +63,6 @@ struct bast_flash_info { | |||
63 | 63 | ||
64 | static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; | 64 | static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; |
65 | 65 | ||
66 | static struct bast_flash_info *to_bast_info(struct device *dev) | ||
67 | { | ||
68 | return (struct bast_flash_info *)dev_get_drvdata(dev); | ||
69 | } | ||
70 | |||
71 | static void bast_flash_setrw(int to) | 66 | static void bast_flash_setrw(int to) |
72 | { | 67 | { |
73 | unsigned int val; | 68 | unsigned int val; |
@@ -87,11 +82,11 @@ static void bast_flash_setrw(int to) | |||
87 | local_irq_restore(flags); | 82 | local_irq_restore(flags); |
88 | } | 83 | } |
89 | 84 | ||
90 | static int bast_flash_remove(struct device *dev) | 85 | static int bast_flash_remove(struct platform_device *pdev) |
91 | { | 86 | { |
92 | struct bast_flash_info *info = to_bast_info(dev); | 87 | struct bast_flash_info *info = platform_get_drvdata(pdev); |
93 | 88 | ||
94 | dev_set_drvdata(dev, NULL); | 89 | platform_set_drvdata(pdev, NULL); |
95 | 90 | ||
96 | if (info == NULL) | 91 | if (info == NULL) |
97 | return 0; | 92 | return 0; |
@@ -116,9 +111,8 @@ static int bast_flash_remove(struct device *dev) | |||
116 | return 0; | 111 | return 0; |
117 | } | 112 | } |
118 | 113 | ||
119 | static int bast_flash_probe(struct device *dev) | 114 | static int bast_flash_probe(struct platform_device *pdev) |
120 | { | 115 | { |
121 | struct platform_device *pdev = to_platform_device(dev); | ||
122 | struct bast_flash_info *info; | 116 | struct bast_flash_info *info; |
123 | struct resource *res; | 117 | struct resource *res; |
124 | int err = 0; | 118 | int err = 0; |
@@ -131,13 +125,13 @@ static int bast_flash_probe(struct device *dev) | |||
131 | } | 125 | } |
132 | 126 | ||
133 | memzero(info, sizeof(*info)); | 127 | memzero(info, sizeof(*info)); |
134 | dev_set_drvdata(dev, info); | 128 | platform_set_drvdata(pdev, info); |
135 | 129 | ||
136 | res = pdev->resource; /* assume that the flash has one resource */ | 130 | res = pdev->resource; /* assume that the flash has one resource */ |
137 | 131 | ||
138 | info->map.phys = res->start; | 132 | info->map.phys = res->start; |
139 | info->map.size = res->end - res->start + 1; | 133 | info->map.size = res->end - res->start + 1; |
140 | info->map.name = dev->bus_id; | 134 | info->map.name = pdev->dev.bus_id; |
141 | info->map.bankwidth = 2; | 135 | info->map.bankwidth = 2; |
142 | 136 | ||
143 | if (info->map.size > AREA_MAXSIZE) | 137 | if (info->map.size > AREA_MAXSIZE) |
@@ -199,27 +193,28 @@ static int bast_flash_probe(struct device *dev) | |||
199 | /* fall through to exit error */ | 193 | /* fall through to exit error */ |
200 | 194 | ||
201 | exit_error: | 195 | exit_error: |
202 | bast_flash_remove(dev); | 196 | bast_flash_remove(pdev); |
203 | return err; | 197 | return err; |
204 | } | 198 | } |
205 | 199 | ||
206 | static struct device_driver bast_flash_driver = { | 200 | static struct platform_driver bast_flash_driver = { |
207 | .name = "bast-nor", | ||
208 | .owner = THIS_MODULE, | ||
209 | .bus = &platform_bus_type, | ||
210 | .probe = bast_flash_probe, | 201 | .probe = bast_flash_probe, |
211 | .remove = bast_flash_remove, | 202 | .remove = bast_flash_remove, |
203 | .driver = { | ||
204 | .name = "bast-nor", | ||
205 | .owner = THIS_MODULE, | ||
206 | }, | ||
212 | }; | 207 | }; |
213 | 208 | ||
214 | static int __init bast_flash_init(void) | 209 | static int __init bast_flash_init(void) |
215 | { | 210 | { |
216 | printk("BAST NOR-Flash Driver, (c) 2004 Simtec Electronics\n"); | 211 | printk("BAST NOR-Flash Driver, (c) 2004 Simtec Electronics\n"); |
217 | return driver_register(&bast_flash_driver); | 212 | return platform_driver_register(&bast_flash_driver); |
218 | } | 213 | } |
219 | 214 | ||
220 | static void __exit bast_flash_exit(void) | 215 | static void __exit bast_flash_exit(void) |
221 | { | 216 | { |
222 | driver_unregister(&bast_flash_driver); | 217 | platform_driver_unregister(&bast_flash_driver); |
223 | } | 218 | } |
224 | 219 | ||
225 | module_init(bast_flash_init); | 220 | module_init(bast_flash_init); |
diff --git a/drivers/mtd/maps/integrator-flash.c b/drivers/mtd/maps/integrator-flash.c index fe738fd8d6f8..a3ba52fbd868 100644 --- a/drivers/mtd/maps/integrator-flash.c +++ b/drivers/mtd/maps/integrator-flash.c | |||
@@ -67,9 +67,8 @@ static void armflash_set_vpp(struct map_info *map, int on) | |||
67 | 67 | ||
68 | static const char *probes[] = { "cmdlinepart", "RedBoot", "afs", NULL }; | 68 | static const char *probes[] = { "cmdlinepart", "RedBoot", "afs", NULL }; |
69 | 69 | ||
70 | static int armflash_probe(struct device *_dev) | 70 | static int armflash_probe(struct platform_device *dev) |
71 | { | 71 | { |
72 | struct platform_device *dev = to_platform_device(_dev); | ||
73 | struct flash_platform_data *plat = dev->dev.platform_data; | 72 | struct flash_platform_data *plat = dev->dev.platform_data; |
74 | struct resource *res = dev->resource; | 73 | struct resource *res = dev->resource; |
75 | unsigned int size = res->end - res->start + 1; | 74 | unsigned int size = res->end - res->start + 1; |
@@ -138,7 +137,7 @@ static int armflash_probe(struct device *_dev) | |||
138 | } | 137 | } |
139 | 138 | ||
140 | if (err == 0) | 139 | if (err == 0) |
141 | dev_set_drvdata(&dev->dev, info); | 140 | platform_set_drvdata(dev, info); |
142 | 141 | ||
143 | /* | 142 | /* |
144 | * If we got an error, free all resources. | 143 | * If we got an error, free all resources. |
@@ -163,12 +162,11 @@ static int armflash_probe(struct device *_dev) | |||
163 | return err; | 162 | return err; |
164 | } | 163 | } |
165 | 164 | ||
166 | static int armflash_remove(struct device *_dev) | 165 | static int armflash_remove(struct platform_device *dev) |
167 | { | 166 | { |
168 | struct platform_device *dev = to_platform_device(_dev); | 167 | struct armflash_info *info = platform_get_drvdata(dev); |
169 | struct armflash_info *info = dev_get_drvdata(&dev->dev); | ||
170 | 168 | ||
171 | dev_set_drvdata(&dev->dev, NULL); | 169 | platform_set_drvdata(dev, NULL); |
172 | 170 | ||
173 | if (info) { | 171 | if (info) { |
174 | if (info->mtd) { | 172 | if (info->mtd) { |
@@ -190,21 +188,22 @@ static int armflash_remove(struct device *_dev) | |||
190 | return 0; | 188 | return 0; |
191 | } | 189 | } |
192 | 190 | ||
193 | static struct device_driver armflash_driver = { | 191 | static struct platform_driver armflash_driver = { |
194 | .name = "armflash", | ||
195 | .bus = &platform_bus_type, | ||
196 | .probe = armflash_probe, | 192 | .probe = armflash_probe, |
197 | .remove = armflash_remove, | 193 | .remove = armflash_remove, |
194 | .driver = { | ||
195 | .name = "armflash", | ||
196 | }, | ||
198 | }; | 197 | }; |
199 | 198 | ||
200 | static int __init armflash_init(void) | 199 | static int __init armflash_init(void) |
201 | { | 200 | { |
202 | return driver_register(&armflash_driver); | 201 | return platform_driver_register(&armflash_driver); |
203 | } | 202 | } |
204 | 203 | ||
205 | static void __exit armflash_exit(void) | 204 | static void __exit armflash_exit(void) |
206 | { | 205 | { |
207 | driver_unregister(&armflash_driver); | 206 | platform_driver_unregister(&armflash_driver); |
208 | } | 207 | } |
209 | 208 | ||
210 | module_init(armflash_init); | 209 | module_init(armflash_init); |
diff --git a/drivers/mtd/maps/ixp2000.c b/drivers/mtd/maps/ixp2000.c index 641eb2b55e9f..fc7a78e31735 100644 --- a/drivers/mtd/maps/ixp2000.c +++ b/drivers/mtd/maps/ixp2000.c | |||
@@ -111,13 +111,12 @@ static void ixp2000_flash_copy_to(struct map_info *map, unsigned long to, | |||
111 | } | 111 | } |
112 | 112 | ||
113 | 113 | ||
114 | static int ixp2000_flash_remove(struct device *_dev) | 114 | static int ixp2000_flash_remove(struct platform_device *dev) |
115 | { | 115 | { |
116 | struct platform_device *dev = to_platform_device(_dev); | ||
117 | struct flash_platform_data *plat = dev->dev.platform_data; | 116 | struct flash_platform_data *plat = dev->dev.platform_data; |
118 | struct ixp2000_flash_info *info = dev_get_drvdata(&dev->dev); | 117 | struct ixp2000_flash_info *info = platform_get_drvdata(dev); |
119 | 118 | ||
120 | dev_set_drvdata(&dev->dev, NULL); | 119 | platform_set_drvdata(dev, NULL); |
121 | 120 | ||
122 | if(!info) | 121 | if(!info) |
123 | return 0; | 122 | return 0; |
@@ -143,10 +142,9 @@ static int ixp2000_flash_remove(struct device *_dev) | |||
143 | } | 142 | } |
144 | 143 | ||
145 | 144 | ||
146 | static int ixp2000_flash_probe(struct device *_dev) | 145 | static int ixp2000_flash_probe(struct platform_device *dev) |
147 | { | 146 | { |
148 | static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; | 147 | static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; |
149 | struct platform_device *dev = to_platform_device(_dev); | ||
150 | struct ixp2000_flash_data *ixp_data = dev->dev.platform_data; | 148 | struct ixp2000_flash_data *ixp_data = dev->dev.platform_data; |
151 | struct flash_platform_data *plat; | 149 | struct flash_platform_data *plat; |
152 | struct ixp2000_flash_info *info; | 150 | struct ixp2000_flash_info *info; |
@@ -177,7 +175,7 @@ static int ixp2000_flash_probe(struct device *_dev) | |||
177 | } | 175 | } |
178 | memzero(info, sizeof(struct ixp2000_flash_info)); | 176 | memzero(info, sizeof(struct ixp2000_flash_info)); |
179 | 177 | ||
180 | dev_set_drvdata(&dev->dev, info); | 178 | platform_set_drvdata(dev, info); |
181 | 179 | ||
182 | /* | 180 | /* |
183 | * Tell the MTD layer we're not 1:1 mapped so that it does | 181 | * Tell the MTD layer we're not 1:1 mapped so that it does |
@@ -248,25 +246,26 @@ static int ixp2000_flash_probe(struct device *_dev) | |||
248 | return 0; | 246 | return 0; |
249 | 247 | ||
250 | Error: | 248 | Error: |
251 | ixp2000_flash_remove(_dev); | 249 | ixp2000_flash_remove(dev); |
252 | return err; | 250 | return err; |
253 | } | 251 | } |
254 | 252 | ||
255 | static struct device_driver ixp2000_flash_driver = { | 253 | static struct platform_driver ixp2000_flash_driver = { |
256 | .name = "IXP2000-Flash", | ||
257 | .bus = &platform_bus_type, | ||
258 | .probe = &ixp2000_flash_probe, | 254 | .probe = &ixp2000_flash_probe, |
259 | .remove = &ixp2000_flash_remove | 255 | .remove = &ixp2000_flash_remove |
256 | .driver = { | ||
257 | .name = "IXP2000-Flash", | ||
258 | }, | ||
260 | }; | 259 | }; |
261 | 260 | ||
262 | static int __init ixp2000_flash_init(void) | 261 | static int __init ixp2000_flash_init(void) |
263 | { | 262 | { |
264 | return driver_register(&ixp2000_flash_driver); | 263 | return platform_driver_register(&ixp2000_flash_driver); |
265 | } | 264 | } |
266 | 265 | ||
267 | static void __exit ixp2000_flash_exit(void) | 266 | static void __exit ixp2000_flash_exit(void) |
268 | { | 267 | { |
269 | driver_unregister(&ixp2000_flash_driver); | 268 | platform_driver_unregister(&ixp2000_flash_driver); |
270 | } | 269 | } |
271 | 270 | ||
272 | module_init(ixp2000_flash_init); | 271 | module_init(ixp2000_flash_init); |
diff --git a/drivers/mtd/maps/ixp4xx.c b/drivers/mtd/maps/ixp4xx.c index 56b3a355bf7b..a59f8027903c 100644 --- a/drivers/mtd/maps/ixp4xx.c +++ b/drivers/mtd/maps/ixp4xx.c | |||
@@ -99,13 +99,12 @@ struct ixp4xx_flash_info { | |||
99 | 99 | ||
100 | static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; | 100 | static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; |
101 | 101 | ||
102 | static int ixp4xx_flash_remove(struct device *_dev) | 102 | static int ixp4xx_flash_remove(struct platform_device *dev) |
103 | { | 103 | { |
104 | struct platform_device *dev = to_platform_device(_dev); | ||
105 | struct flash_platform_data *plat = dev->dev.platform_data; | 104 | struct flash_platform_data *plat = dev->dev.platform_data; |
106 | struct ixp4xx_flash_info *info = dev_get_drvdata(&dev->dev); | 105 | struct ixp4xx_flash_info *info = platform_get_drvdata(dev); |
107 | 106 | ||
108 | dev_set_drvdata(&dev->dev, NULL); | 107 | platform_set_drvdata(dev, NULL); |
109 | 108 | ||
110 | if(!info) | 109 | if(!info) |
111 | return 0; | 110 | return 0; |
@@ -130,9 +129,8 @@ static int ixp4xx_flash_remove(struct device *_dev) | |||
130 | return 0; | 129 | return 0; |
131 | } | 130 | } |
132 | 131 | ||
133 | static int ixp4xx_flash_probe(struct device *_dev) | 132 | static int ixp4xx_flash_probe(struct platform_device *dev) |
134 | { | 133 | { |
135 | struct platform_device *dev = to_platform_device(_dev); | ||
136 | struct flash_platform_data *plat = dev->dev.platform_data; | 134 | struct flash_platform_data *plat = dev->dev.platform_data; |
137 | struct ixp4xx_flash_info *info; | 135 | struct ixp4xx_flash_info *info; |
138 | int err = -1; | 136 | int err = -1; |
@@ -153,7 +151,7 @@ static int ixp4xx_flash_probe(struct device *_dev) | |||
153 | } | 151 | } |
154 | memzero(info, sizeof(struct ixp4xx_flash_info)); | 152 | memzero(info, sizeof(struct ixp4xx_flash_info)); |
155 | 153 | ||
156 | dev_set_drvdata(&dev->dev, info); | 154 | platform_set_drvdata(dev, info); |
157 | 155 | ||
158 | /* | 156 | /* |
159 | * Tell the MTD layer we're not 1:1 mapped so that it does | 157 | * Tell the MTD layer we're not 1:1 mapped so that it does |
@@ -214,25 +212,26 @@ static int ixp4xx_flash_probe(struct device *_dev) | |||
214 | return 0; | 212 | return 0; |
215 | 213 | ||
216 | Error: | 214 | Error: |
217 | ixp4xx_flash_remove(_dev); | 215 | ixp4xx_flash_remove(dev); |
218 | return err; | 216 | return err; |
219 | } | 217 | } |
220 | 218 | ||
221 | static struct device_driver ixp4xx_flash_driver = { | 219 | static struct platform_driver ixp4xx_flash_driver = { |
222 | .name = "IXP4XX-Flash", | ||
223 | .bus = &platform_bus_type, | ||
224 | .probe = ixp4xx_flash_probe, | 220 | .probe = ixp4xx_flash_probe, |
225 | .remove = ixp4xx_flash_remove, | 221 | .remove = ixp4xx_flash_remove, |
222 | .driver = { | ||
223 | .name = "IXP4XX-Flash", | ||
224 | }, | ||
226 | }; | 225 | }; |
227 | 226 | ||
228 | static int __init ixp4xx_flash_init(void) | 227 | static int __init ixp4xx_flash_init(void) |
229 | { | 228 | { |
230 | return driver_register(&ixp4xx_flash_driver); | 229 | return platform_driver_register(&ixp4xx_flash_driver); |
231 | } | 230 | } |
232 | 231 | ||
233 | static void __exit ixp4xx_flash_exit(void) | 232 | static void __exit ixp4xx_flash_exit(void) |
234 | { | 233 | { |
235 | driver_unregister(&ixp4xx_flash_driver); | 234 | platform_driver_unregister(&ixp4xx_flash_driver); |
236 | } | 235 | } |
237 | 236 | ||
238 | 237 | ||
diff --git a/drivers/mtd/maps/omap_nor.c b/drivers/mtd/maps/omap_nor.c index fd3b4a5fc207..418afffb2d80 100644 --- a/drivers/mtd/maps/omap_nor.c +++ b/drivers/mtd/maps/omap_nor.c | |||
@@ -70,11 +70,10 @@ static void omap_set_vpp(struct map_info *map, int enable) | |||
70 | } | 70 | } |
71 | } | 71 | } |
72 | 72 | ||
73 | static int __devinit omapflash_probe(struct device *dev) | 73 | static int __devinit omapflash_probe(struct platform_device *pdev) |
74 | { | 74 | { |
75 | int err; | 75 | int err; |
76 | struct omapflash_info *info; | 76 | struct omapflash_info *info; |
77 | struct platform_device *pdev = to_platform_device(dev); | ||
78 | struct flash_platform_data *pdata = pdev->dev.platform_data; | 77 | struct flash_platform_data *pdata = pdev->dev.platform_data; |
79 | struct resource *res = pdev->resource; | 78 | struct resource *res = pdev->resource; |
80 | unsigned long size = res->end - res->start + 1; | 79 | unsigned long size = res->end - res->start + 1; |
@@ -119,7 +118,7 @@ static int __devinit omapflash_probe(struct device *dev) | |||
119 | #endif | 118 | #endif |
120 | add_mtd_device(info->mtd); | 119 | add_mtd_device(info->mtd); |
121 | 120 | ||
122 | dev_set_drvdata(&pdev->dev, info); | 121 | platform_set_drvdata(pdev, info); |
123 | 122 | ||
124 | return 0; | 123 | return 0; |
125 | 124 | ||
@@ -133,12 +132,11 @@ out_free_info: | |||
133 | return err; | 132 | return err; |
134 | } | 133 | } |
135 | 134 | ||
136 | static int __devexit omapflash_remove(struct device *dev) | 135 | static int __devexit omapflash_remove(struct platform_device *pdev) |
137 | { | 136 | { |
138 | struct platform_device *pdev = to_platform_device(dev); | 137 | struct omapflash_info *info = platform_get_drvdata(pdev); |
139 | struct omapflash_info *info = dev_get_drvdata(&pdev->dev); | ||
140 | 138 | ||
141 | dev_set_drvdata(&pdev->dev, NULL); | 139 | platform_set_drvdata(pdev, NULL); |
142 | 140 | ||
143 | if (info) { | 141 | if (info) { |
144 | if (info->parts) { | 142 | if (info->parts) { |
@@ -155,21 +153,22 @@ static int __devexit omapflash_remove(struct device *dev) | |||
155 | return 0; | 153 | return 0; |
156 | } | 154 | } |
157 | 155 | ||
158 | static struct device_driver omapflash_driver = { | 156 | static struct platform_driver omapflash_driver = { |
159 | .name = "omapflash", | ||
160 | .bus = &platform_bus_type, | ||
161 | .probe = omapflash_probe, | 157 | .probe = omapflash_probe, |
162 | .remove = __devexit_p(omapflash_remove), | 158 | .remove = __devexit_p(omapflash_remove), |
159 | .driver = { | ||
160 | .name = "omapflash", | ||
161 | }, | ||
163 | }; | 162 | }; |
164 | 163 | ||
165 | static int __init omapflash_init(void) | 164 | static int __init omapflash_init(void) |
166 | { | 165 | { |
167 | return driver_register(&omapflash_driver); | 166 | return platform_driver_register(&omapflash_driver); |
168 | } | 167 | } |
169 | 168 | ||
170 | static void __exit omapflash_exit(void) | 169 | static void __exit omapflash_exit(void) |
171 | { | 170 | { |
172 | driver_unregister(&omapflash_driver); | 171 | platform_driver_unregister(&omapflash_driver); |
173 | } | 172 | } |
174 | 173 | ||
175 | module_init(omapflash_init); | 174 | module_init(omapflash_init); |
diff --git a/drivers/mtd/maps/plat-ram.c b/drivers/mtd/maps/plat-ram.c index a02eed94a231..5d3c75451ca2 100644 --- a/drivers/mtd/maps/plat-ram.c +++ b/drivers/mtd/maps/plat-ram.c | |||
@@ -56,9 +56,9 @@ struct platram_info { | |||
56 | * device private data to struct platram_info conversion | 56 | * device private data to struct platram_info conversion |
57 | */ | 57 | */ |
58 | 58 | ||
59 | static inline struct platram_info *to_platram_info(struct device *dev) | 59 | static inline struct platram_info *to_platram_info(struct platform_device *dev) |
60 | { | 60 | { |
61 | return (struct platram_info *)dev_get_drvdata(dev); | 61 | return (struct platram_info *)platform_get_drvdata(dev); |
62 | } | 62 | } |
63 | 63 | ||
64 | /* platram_setrw | 64 | /* platram_setrw |
@@ -83,13 +83,13 @@ static inline void platram_setrw(struct platram_info *info, int to) | |||
83 | * called to remove the device from the driver's control | 83 | * called to remove the device from the driver's control |
84 | */ | 84 | */ |
85 | 85 | ||
86 | static int platram_remove(struct device *dev) | 86 | static int platram_remove(struct platform_device *pdev) |
87 | { | 87 | { |
88 | struct platram_info *info = to_platram_info(dev); | 88 | struct platram_info *info = to_platram_info(pdev); |
89 | 89 | ||
90 | dev_set_drvdata(dev, NULL); | 90 | platform_set_drvdata(pdev, NULL); |
91 | 91 | ||
92 | dev_dbg(dev, "removing device\n"); | 92 | dev_dbg(&pdev->dev, "removing device\n"); |
93 | 93 | ||
94 | if (info == NULL) | 94 | if (info == NULL) |
95 | return 0; | 95 | return 0; |
@@ -130,61 +130,60 @@ static int platram_remove(struct device *dev) | |||
130 | * driver is found. | 130 | * driver is found. |
131 | */ | 131 | */ |
132 | 132 | ||
133 | static int platram_probe(struct device *dev) | 133 | static int platram_probe(struct platform_device *pdev) |
134 | { | 134 | { |
135 | struct platform_device *pd = to_platform_device(dev); | ||
136 | struct platdata_mtd_ram *pdata; | 135 | struct platdata_mtd_ram *pdata; |
137 | struct platram_info *info; | 136 | struct platram_info *info; |
138 | struct resource *res; | 137 | struct resource *res; |
139 | int err = 0; | 138 | int err = 0; |
140 | 139 | ||
141 | dev_dbg(dev, "probe entered\n"); | 140 | dev_dbg(&pdev->dev, "probe entered\n"); |
142 | 141 | ||
143 | if (dev->platform_data == NULL) { | 142 | if (pdev->dev.platform_data == NULL) { |
144 | dev_err(dev, "no platform data supplied\n"); | 143 | dev_err(&pdev->dev, "no platform data supplied\n"); |
145 | err = -ENOENT; | 144 | err = -ENOENT; |
146 | goto exit_error; | 145 | goto exit_error; |
147 | } | 146 | } |
148 | 147 | ||
149 | pdata = dev->platform_data; | 148 | pdata = pdev->dev.platform_data; |
150 | 149 | ||
151 | info = kmalloc(sizeof(*info), GFP_KERNEL); | 150 | info = kmalloc(sizeof(*info), GFP_KERNEL); |
152 | if (info == NULL) { | 151 | if (info == NULL) { |
153 | dev_err(dev, "no memory for flash info\n"); | 152 | dev_err(&pdev->dev, "no memory for flash info\n"); |
154 | err = -ENOMEM; | 153 | err = -ENOMEM; |
155 | goto exit_error; | 154 | goto exit_error; |
156 | } | 155 | } |
157 | 156 | ||
158 | memset(info, 0, sizeof(*info)); | 157 | memset(info, 0, sizeof(*info)); |
159 | dev_set_drvdata(dev, info); | 158 | platform_set_drvdata(pdev, info); |
160 | 159 | ||
161 | info->dev = dev; | 160 | info->dev = &pdev->dev; |
162 | info->pdata = pdata; | 161 | info->pdata = pdata; |
163 | 162 | ||
164 | /* get the resource for the memory mapping */ | 163 | /* get the resource for the memory mapping */ |
165 | 164 | ||
166 | res = platform_get_resource(pd, IORESOURCE_MEM, 0); | 165 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
167 | 166 | ||
168 | if (res == NULL) { | 167 | if (res == NULL) { |
169 | dev_err(dev, "no memory resource specified\n"); | 168 | dev_err(&pdev->dev, "no memory resource specified\n"); |
170 | err = -ENOENT; | 169 | err = -ENOENT; |
171 | goto exit_free; | 170 | goto exit_free; |
172 | } | 171 | } |
173 | 172 | ||
174 | dev_dbg(dev, "got platform resource %p (0x%lx)\n", res, res->start); | 173 | dev_dbg(&pdev->dev, "got platform resource %p (0x%lx)\n", res, res->start); |
175 | 174 | ||
176 | /* setup map parameters */ | 175 | /* setup map parameters */ |
177 | 176 | ||
178 | info->map.phys = res->start; | 177 | info->map.phys = res->start; |
179 | info->map.size = (res->end - res->start) + 1; | 178 | info->map.size = (res->end - res->start) + 1; |
180 | info->map.name = pdata->mapname != NULL ? pdata->mapname : (char *)pd->name; | 179 | info->map.name = pdata->mapname != NULL ? pdata->mapname : (char *)pdev->name; |
181 | info->map.bankwidth = pdata->bankwidth; | 180 | info->map.bankwidth = pdata->bankwidth; |
182 | 181 | ||
183 | /* register our usage of the memory area */ | 182 | /* register our usage of the memory area */ |
184 | 183 | ||
185 | info->area = request_mem_region(res->start, info->map.size, pd->name); | 184 | info->area = request_mem_region(res->start, info->map.size, pdev->name); |
186 | if (info->area == NULL) { | 185 | if (info->area == NULL) { |
187 | dev_err(dev, "failed to request memory region\n"); | 186 | dev_err(&pdev->dev, "failed to request memory region\n"); |
188 | err = -EIO; | 187 | err = -EIO; |
189 | goto exit_free; | 188 | goto exit_free; |
190 | } | 189 | } |
@@ -192,23 +191,23 @@ static int platram_probe(struct device *dev) | |||
192 | /* remap the memory area */ | 191 | /* remap the memory area */ |
193 | 192 | ||
194 | info->map.virt = ioremap(res->start, info->map.size); | 193 | info->map.virt = ioremap(res->start, info->map.size); |
195 | dev_dbg(dev, "virt %p, %lu bytes\n", info->map.virt, info->map.size); | 194 | dev_dbg(&pdev->dev, "virt %p, %lu bytes\n", info->map.virt, info->map.size); |
196 | 195 | ||
197 | if (info->map.virt == NULL) { | 196 | if (info->map.virt == NULL) { |
198 | dev_err(dev, "failed to ioremap() region\n"); | 197 | dev_err(&pdev->dev, "failed to ioremap() region\n"); |
199 | err = -EIO; | 198 | err = -EIO; |
200 | goto exit_free; | 199 | goto exit_free; |
201 | } | 200 | } |
202 | 201 | ||
203 | simple_map_init(&info->map); | 202 | simple_map_init(&info->map); |
204 | 203 | ||
205 | dev_dbg(dev, "initialised map, probing for mtd\n"); | 204 | dev_dbg(&pdev->dev, "initialised map, probing for mtd\n"); |
206 | 205 | ||
207 | /* probe for the right mtd map driver */ | 206 | /* probe for the right mtd map driver */ |
208 | 207 | ||
209 | info->mtd = do_map_probe("map_ram" , &info->map); | 208 | info->mtd = do_map_probe("map_ram" , &info->map); |
210 | if (info->mtd == NULL) { | 209 | if (info->mtd == NULL) { |
211 | dev_err(dev, "failed to probe for map_ram\n"); | 210 | dev_err(&pdev->dev, "failed to probe for map_ram\n"); |
212 | err = -ENOMEM; | 211 | err = -ENOMEM; |
213 | goto exit_free; | 212 | goto exit_free; |
214 | } | 213 | } |
@@ -237,27 +236,28 @@ static int platram_probe(struct device *dev) | |||
237 | #endif /* CONFIG_MTD_PARTITIONS */ | 236 | #endif /* CONFIG_MTD_PARTITIONS */ |
238 | 237 | ||
239 | if (add_mtd_device(info->mtd)) { | 238 | if (add_mtd_device(info->mtd)) { |
240 | dev_err(dev, "add_mtd_device() failed\n"); | 239 | dev_err(&pdev->dev, "add_mtd_device() failed\n"); |
241 | err = -ENOMEM; | 240 | err = -ENOMEM; |
242 | } | 241 | } |
243 | 242 | ||
244 | dev_info(dev, "registered mtd device\n"); | 243 | dev_info(&pdev->dev, "registered mtd device\n"); |
245 | return err; | 244 | return err; |
246 | 245 | ||
247 | exit_free: | 246 | exit_free: |
248 | platram_remove(dev); | 247 | platram_remove(pdev); |
249 | exit_error: | 248 | exit_error: |
250 | return err; | 249 | return err; |
251 | } | 250 | } |
252 | 251 | ||
253 | /* device driver info */ | 252 | /* device driver info */ |
254 | 253 | ||
255 | static struct device_driver platram_driver = { | 254 | static struct platform_driver platram_driver = { |
256 | .name = "mtd-ram", | ||
257 | .owner = THIS_MODULE, | ||
258 | .bus = &platform_bus_type, | ||
259 | .probe = platram_probe, | 255 | .probe = platram_probe, |
260 | .remove = platram_remove, | 256 | .remove = platram_remove, |
257 | .driver = { | ||
258 | .name = "mtd-ram", | ||
259 | .owner = THIS_MODULE, | ||
260 | }, | ||
261 | }; | 261 | }; |
262 | 262 | ||
263 | /* module init/exit */ | 263 | /* module init/exit */ |
@@ -265,12 +265,12 @@ static struct device_driver platram_driver = { | |||
265 | static int __init platram_init(void) | 265 | static int __init platram_init(void) |
266 | { | 266 | { |
267 | printk("Generic platform RAM MTD, (c) 2004 Simtec Electronics\n"); | 267 | printk("Generic platform RAM MTD, (c) 2004 Simtec Electronics\n"); |
268 | return driver_register(&platram_driver); | 268 | return platform_driver_register(&platram_driver); |
269 | } | 269 | } |
270 | 270 | ||
271 | static void __exit platram_exit(void) | 271 | static void __exit platram_exit(void) |
272 | { | 272 | { |
273 | driver_unregister(&platram_driver); | 273 | platform_driver_unregister(&platram_driver); |
274 | } | 274 | } |
275 | 275 | ||
276 | module_init(platram_init); | 276 | module_init(platram_init); |
diff --git a/drivers/mtd/maps/sa1100-flash.c b/drivers/mtd/maps/sa1100-flash.c index 9e8bb1782be0..5cefb015633c 100644 --- a/drivers/mtd/maps/sa1100-flash.c +++ b/drivers/mtd/maps/sa1100-flash.c | |||
@@ -356,9 +356,8 @@ sa1100_setup_mtd(struct platform_device *pdev, struct flash_platform_data *plat) | |||
356 | 356 | ||
357 | static const char *part_probes[] = { "cmdlinepart", "RedBoot", NULL }; | 357 | static const char *part_probes[] = { "cmdlinepart", "RedBoot", NULL }; |
358 | 358 | ||
359 | static int __init sa1100_mtd_probe(struct device *dev) | 359 | static int __init sa1100_mtd_probe(struct platform_device *pdev) |
360 | { | 360 | { |
361 | struct platform_device *pdev = to_platform_device(dev); | ||
362 | struct flash_platform_data *plat = pdev->dev.platform_data; | 361 | struct flash_platform_data *plat = pdev->dev.platform_data; |
363 | struct mtd_partition *parts; | 362 | struct mtd_partition *parts; |
364 | const char *part_type = NULL; | 363 | const char *part_type = NULL; |
@@ -402,28 +401,28 @@ static int __init sa1100_mtd_probe(struct device *dev) | |||
402 | 401 | ||
403 | info->nr_parts = nr_parts; | 402 | info->nr_parts = nr_parts; |
404 | 403 | ||
405 | dev_set_drvdata(dev, info); | 404 | platform_set_drvdata(pdev, info); |
406 | err = 0; | 405 | err = 0; |
407 | 406 | ||
408 | out: | 407 | out: |
409 | return err; | 408 | return err; |
410 | } | 409 | } |
411 | 410 | ||
412 | static int __exit sa1100_mtd_remove(struct device *dev) | 411 | static int __exit sa1100_mtd_remove(struct platform_device *pdev) |
413 | { | 412 | { |
414 | struct sa_info *info = dev_get_drvdata(dev); | 413 | struct sa_info *info = platform_get_drvdata(pdev); |
415 | struct flash_platform_data *plat = dev->platform_data; | 414 | struct flash_platform_data *plat = pdev->dev.platform_data; |
416 | 415 | ||
417 | dev_set_drvdata(dev, NULL); | 416 | platform_set_drvdata(pdev, NULL); |
418 | sa1100_destroy(info, plat); | 417 | sa1100_destroy(info, plat); |
419 | 418 | ||
420 | return 0; | 419 | return 0; |
421 | } | 420 | } |
422 | 421 | ||
423 | #ifdef CONFIG_PM | 422 | #ifdef CONFIG_PM |
424 | static int sa1100_mtd_suspend(struct device *dev, pm_message_t state) | 423 | static int sa1100_mtd_suspend(struct platform_device *dev, pm_message_t state) |
425 | { | 424 | { |
426 | struct sa_info *info = dev_get_drvdata(dev); | 425 | struct sa_info *info = platform_get_drvdata(dev); |
427 | int ret = 0; | 426 | int ret = 0; |
428 | 427 | ||
429 | if (info) | 428 | if (info) |
@@ -432,17 +431,17 @@ static int sa1100_mtd_suspend(struct device *dev, pm_message_t state) | |||
432 | return ret; | 431 | return ret; |
433 | } | 432 | } |
434 | 433 | ||
435 | static int sa1100_mtd_resume(struct device *dev) | 434 | static int sa1100_mtd_resume(struct platform_device *dev) |
436 | { | 435 | { |
437 | struct sa_info *info = dev_get_drvdata(dev); | 436 | struct sa_info *info = platform_get_drvdata(dev); |
438 | if (info) | 437 | if (info) |
439 | info->mtd->resume(info->mtd); | 438 | info->mtd->resume(info->mtd); |
440 | return 0; | 439 | return 0; |
441 | } | 440 | } |
442 | 441 | ||
443 | static void sa1100_mtd_shutdown(struct device *dev) | 442 | static void sa1100_mtd_shutdown(struct platform_device *dev) |
444 | { | 443 | { |
445 | struct sa_info *info = dev_get_drvdata(dev); | 444 | struct sa_info *info = platform_get_drvdata(dev); |
446 | if (info && info->mtd->suspend(info->mtd) == 0) | 445 | if (info && info->mtd->suspend(info->mtd) == 0) |
447 | info->mtd->resume(info->mtd); | 446 | info->mtd->resume(info->mtd); |
448 | } | 447 | } |
@@ -452,24 +451,25 @@ static void sa1100_mtd_shutdown(struct device *dev) | |||
452 | #define sa1100_mtd_shutdown NULL | 451 | #define sa1100_mtd_shutdown NULL |
453 | #endif | 452 | #endif |
454 | 453 | ||
455 | static struct device_driver sa1100_mtd_driver = { | 454 | static struct platform_driver sa1100_mtd_driver = { |
456 | .name = "flash", | ||
457 | .bus = &platform_bus_type, | ||
458 | .probe = sa1100_mtd_probe, | 455 | .probe = sa1100_mtd_probe, |
459 | .remove = __exit_p(sa1100_mtd_remove), | 456 | .remove = __exit_p(sa1100_mtd_remove), |
460 | .suspend = sa1100_mtd_suspend, | 457 | .suspend = sa1100_mtd_suspend, |
461 | .resume = sa1100_mtd_resume, | 458 | .resume = sa1100_mtd_resume, |
462 | .shutdown = sa1100_mtd_shutdown, | 459 | .shutdown = sa1100_mtd_shutdown, |
460 | .driver = { | ||
461 | .name = "flash", | ||
462 | }, | ||
463 | }; | 463 | }; |
464 | 464 | ||
465 | static int __init sa1100_mtd_init(void) | 465 | static int __init sa1100_mtd_init(void) |
466 | { | 466 | { |
467 | return driver_register(&sa1100_mtd_driver); | 467 | return platform_driver_register(&sa1100_mtd_driver); |
468 | } | 468 | } |
469 | 469 | ||
470 | static void __exit sa1100_mtd_exit(void) | 470 | static void __exit sa1100_mtd_exit(void) |
471 | { | 471 | { |
472 | driver_unregister(&sa1100_mtd_driver); | 472 | platform_driver_unregister(&sa1100_mtd_driver); |
473 | } | 473 | } |
474 | 474 | ||
475 | module_init(sa1100_mtd_init); | 475 | module_init(sa1100_mtd_init); |