diff options
author | Grant Likely <grant.likely@secretlab.ca> | 2011-07-14 07:33:52 -0400 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2011-07-14 07:33:52 -0400 |
commit | 5d10302f46df1d9a85c34ea97f9b6c29e414482e (patch) | |
tree | 65bb2287b6b5e7dda65045193b1992a209c13a46 /drivers/block | |
parent | 2e39e5be1ddf9fc5fbe84fe7ae3e035bb07845e5 (diff) |
dt: remove extra xsysace platform_driver registration
After commit 1c48a5c93, "dt: Eliminate
of_platform_{,un}register_driver", the xsysace driver attempts to
register two platform_drivers with the same name, which a) doesn't
work, and b) isn't necessary. This patch merges the two
platform_drivers.
Reported-by: Daniel Hellstrom <daniel@gaisler.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/xsysace.c | 98 |
1 files changed, 16 insertions, 82 deletions
diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c index 6c7fd7db6dff..fb1975d82a73 100644 --- a/drivers/block/xsysace.c +++ b/drivers/block/xsysace.c | |||
@@ -1155,12 +1155,19 @@ static int __devinit ace_probe(struct platform_device *dev) | |||
1155 | { | 1155 | { |
1156 | resource_size_t physaddr = 0; | 1156 | resource_size_t physaddr = 0; |
1157 | int bus_width = ACE_BUS_WIDTH_16; /* FIXME: should not be hard coded */ | 1157 | int bus_width = ACE_BUS_WIDTH_16; /* FIXME: should not be hard coded */ |
1158 | int id = dev->id; | 1158 | u32 id = dev->id; |
1159 | int irq = NO_IRQ; | 1159 | int irq = NO_IRQ; |
1160 | int i; | 1160 | int i; |
1161 | 1161 | ||
1162 | dev_dbg(&dev->dev, "ace_probe(%p)\n", dev); | 1162 | dev_dbg(&dev->dev, "ace_probe(%p)\n", dev); |
1163 | 1163 | ||
1164 | /* device id and bus width */ | ||
1165 | of_property_read_u32(dev->dev.of_node, "port-number", &id); | ||
1166 | if (id < 0) | ||
1167 | id = 0; | ||
1168 | if (of_find_property(dev->dev.of_node, "8-bit", NULL)) | ||
1169 | bus_width = ACE_BUS_WIDTH_8; | ||
1170 | |||
1164 | for (i = 0; i < dev->num_resources; i++) { | 1171 | for (i = 0; i < dev->num_resources; i++) { |
1165 | if (dev->resource[i].flags & IORESOURCE_MEM) | 1172 | if (dev->resource[i].flags & IORESOURCE_MEM) |
1166 | physaddr = dev->resource[i].start; | 1173 | physaddr = dev->resource[i].start; |
@@ -1181,57 +1188,7 @@ static int __devexit ace_remove(struct platform_device *dev) | |||
1181 | return 0; | 1188 | return 0; |
1182 | } | 1189 | } |
1183 | 1190 | ||
1184 | static struct platform_driver ace_platform_driver = { | ||
1185 | .probe = ace_probe, | ||
1186 | .remove = __devexit_p(ace_remove), | ||
1187 | .driver = { | ||
1188 | .owner = THIS_MODULE, | ||
1189 | .name = "xsysace", | ||
1190 | }, | ||
1191 | }; | ||
1192 | |||
1193 | /* --------------------------------------------------------------------- | ||
1194 | * OF_Platform Bus Support | ||
1195 | */ | ||
1196 | |||
1197 | #if defined(CONFIG_OF) | 1191 | #if defined(CONFIG_OF) |
1198 | static int __devinit ace_of_probe(struct platform_device *op) | ||
1199 | { | ||
1200 | struct resource res; | ||
1201 | resource_size_t physaddr; | ||
1202 | const u32 *id; | ||
1203 | int irq, bus_width, rc; | ||
1204 | |||
1205 | /* device id */ | ||
1206 | id = of_get_property(op->dev.of_node, "port-number", NULL); | ||
1207 | |||
1208 | /* physaddr */ | ||
1209 | rc = of_address_to_resource(op->dev.of_node, 0, &res); | ||
1210 | if (rc) { | ||
1211 | dev_err(&op->dev, "invalid address\n"); | ||
1212 | return rc; | ||
1213 | } | ||
1214 | physaddr = res.start; | ||
1215 | |||
1216 | /* irq */ | ||
1217 | irq = irq_of_parse_and_map(op->dev.of_node, 0); | ||
1218 | |||
1219 | /* bus width */ | ||
1220 | bus_width = ACE_BUS_WIDTH_16; | ||
1221 | if (of_find_property(op->dev.of_node, "8-bit", NULL)) | ||
1222 | bus_width = ACE_BUS_WIDTH_8; | ||
1223 | |||
1224 | /* Call the bus-independent setup code */ | ||
1225 | return ace_alloc(&op->dev, id ? be32_to_cpup(id) : 0, | ||
1226 | physaddr, irq, bus_width); | ||
1227 | } | ||
1228 | |||
1229 | static int __devexit ace_of_remove(struct platform_device *op) | ||
1230 | { | ||
1231 | ace_free(&op->dev); | ||
1232 | return 0; | ||
1233 | } | ||
1234 | |||
1235 | /* Match table for of_platform binding */ | 1192 | /* Match table for of_platform binding */ |
1236 | static const struct of_device_id ace_of_match[] __devinitconst = { | 1193 | static const struct of_device_id ace_of_match[] __devinitconst = { |
1237 | { .compatible = "xlnx,opb-sysace-1.00.b", }, | 1194 | { .compatible = "xlnx,opb-sysace-1.00.b", }, |
@@ -1241,34 +1198,20 @@ static const struct of_device_id ace_of_match[] __devinitconst = { | |||
1241 | {}, | 1198 | {}, |
1242 | }; | 1199 | }; |
1243 | MODULE_DEVICE_TABLE(of, ace_of_match); | 1200 | MODULE_DEVICE_TABLE(of, ace_of_match); |
1201 | #else /* CONFIG_OF */ | ||
1202 | #define ace_of_match NULL | ||
1203 | #endif /* CONFIG_OF */ | ||
1244 | 1204 | ||
1245 | static struct platform_driver ace_of_driver = { | 1205 | static struct platform_driver ace_platform_driver = { |
1246 | .probe = ace_of_probe, | 1206 | .probe = ace_probe, |
1247 | .remove = __devexit_p(ace_of_remove), | 1207 | .remove = __devexit_p(ace_remove), |
1248 | .driver = { | 1208 | .driver = { |
1249 | .name = "xsysace", | ||
1250 | .owner = THIS_MODULE, | 1209 | .owner = THIS_MODULE, |
1210 | .name = "xsysace", | ||
1251 | .of_match_table = ace_of_match, | 1211 | .of_match_table = ace_of_match, |
1252 | }, | 1212 | }, |
1253 | }; | 1213 | }; |
1254 | 1214 | ||
1255 | /* Registration helpers to keep the number of #ifdefs to a minimum */ | ||
1256 | static inline int __init ace_of_register(void) | ||
1257 | { | ||
1258 | pr_debug("xsysace: registering OF binding\n"); | ||
1259 | return platform_driver_register(&ace_of_driver); | ||
1260 | } | ||
1261 | |||
1262 | static inline void __exit ace_of_unregister(void) | ||
1263 | { | ||
1264 | platform_driver_unregister(&ace_of_driver); | ||
1265 | } | ||
1266 | #else /* CONFIG_OF */ | ||
1267 | /* CONFIG_OF not enabled; do nothing helpers */ | ||
1268 | static inline int __init ace_of_register(void) { return 0; } | ||
1269 | static inline void __exit ace_of_unregister(void) { } | ||
1270 | #endif /* CONFIG_OF */ | ||
1271 | |||
1272 | /* --------------------------------------------------------------------- | 1215 | /* --------------------------------------------------------------------- |
1273 | * Module init/exit routines | 1216 | * Module init/exit routines |
1274 | */ | 1217 | */ |
@@ -1282,11 +1225,6 @@ static int __init ace_init(void) | |||
1282 | goto err_blk; | 1225 | goto err_blk; |
1283 | } | 1226 | } |
1284 | 1227 | ||
1285 | rc = ace_of_register(); | ||
1286 | if (rc) | ||
1287 | goto err_of; | ||
1288 | |||
1289 | pr_debug("xsysace: registering platform binding\n"); | ||
1290 | rc = platform_driver_register(&ace_platform_driver); | 1228 | rc = platform_driver_register(&ace_platform_driver); |
1291 | if (rc) | 1229 | if (rc) |
1292 | goto err_plat; | 1230 | goto err_plat; |
@@ -1295,21 +1233,17 @@ static int __init ace_init(void) | |||
1295 | return 0; | 1233 | return 0; |
1296 | 1234 | ||
1297 | err_plat: | 1235 | err_plat: |
1298 | ace_of_unregister(); | ||
1299 | err_of: | ||
1300 | unregister_blkdev(ace_major, "xsysace"); | 1236 | unregister_blkdev(ace_major, "xsysace"); |
1301 | err_blk: | 1237 | err_blk: |
1302 | printk(KERN_ERR "xsysace: registration failed; err=%i\n", rc); | 1238 | printk(KERN_ERR "xsysace: registration failed; err=%i\n", rc); |
1303 | return rc; | 1239 | return rc; |
1304 | } | 1240 | } |
1241 | module_init(ace_init); | ||
1305 | 1242 | ||
1306 | static void __exit ace_exit(void) | 1243 | static void __exit ace_exit(void) |
1307 | { | 1244 | { |
1308 | pr_debug("Unregistering Xilinx SystemACE driver\n"); | 1245 | pr_debug("Unregistering Xilinx SystemACE driver\n"); |
1309 | platform_driver_unregister(&ace_platform_driver); | 1246 | platform_driver_unregister(&ace_platform_driver); |
1310 | ace_of_unregister(); | ||
1311 | unregister_blkdev(ace_major, "xsysace"); | 1247 | unregister_blkdev(ace_major, "xsysace"); |
1312 | } | 1248 | } |
1313 | |||
1314 | module_init(ace_init); | ||
1315 | module_exit(ace_exit); | 1249 | module_exit(ace_exit); |