aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2007-10-01 10:33:52 -0400
committerJens Axboe <axboe@carl.home.kernel.dk>2007-10-10 03:25:57 -0400
commitedec49616c7b4ad7ceb3b936a8d95b10652ee677 (patch)
treea190022f146740c857080746ecc1f20a80b76b89 /drivers/block
parentc9d3d8ecf672c513435691a886876aee5ab11001 (diff)
Sysace: Use the established platform bus api
SystemACE uses the platform bus binding, but it doesn't use the platform bus API. Move to using the correct API for consistency sake and future proofing against platform bus changes. Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/xsysace.c48
1 files changed, 30 insertions, 18 deletions
diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c
index 3ede0b63da13..b10447611afd 100644
--- a/drivers/block/xsysace.c
+++ b/drivers/block/xsysace.c
@@ -1060,13 +1060,12 @@ static void __devexit ace_teardown(struct ace_device *ace)
1060 * Platform Bus Support 1060 * Platform Bus Support
1061 */ 1061 */
1062 1062
1063static int __devinit ace_probe(struct device *device) 1063static int __devinit ace_probe(struct platform_device *dev)
1064{ 1064{
1065 struct platform_device *dev = to_platform_device(device);
1066 struct ace_device *ace; 1065 struct ace_device *ace;
1067 int i; 1066 int i;
1068 1067
1069 dev_dbg(device, "ace_probe(%p)\n", device); 1068 dev_dbg(&dev->dev, "ace_probe(%p)\n", dev);
1070 1069
1071 /* 1070 /*
1072 * Allocate the ace device structure 1071 * Allocate the ace device structure
@@ -1075,7 +1074,7 @@ static int __devinit ace_probe(struct device *device)
1075 if (!ace) 1074 if (!ace)
1076 goto err_alloc; 1075 goto err_alloc;
1077 1076
1078 ace->dev = device; 1077 ace->dev = &dev->dev;
1079 ace->id = dev->id; 1078 ace->id = dev->id;
1080 ace->irq = NO_IRQ; 1079 ace->irq = NO_IRQ;
1081 1080
@@ -1089,7 +1088,7 @@ static int __devinit ace_probe(struct device *device)
1089 /* FIXME: Should get bus_width from the platform_device struct */ 1088 /* FIXME: Should get bus_width from the platform_device struct */
1090 ace->bus_width = 1; 1089 ace->bus_width = 1;
1091 1090
1092 dev_set_drvdata(&dev->dev, ace); 1091 platform_set_drvdata(dev, ace);
1093 1092
1094 /* Call the bus-independant setup code */ 1093 /* Call the bus-independant setup code */
1095 if (ace_setup(ace) != 0) 1094 if (ace_setup(ace) != 0)
@@ -1098,7 +1097,7 @@ static int __devinit ace_probe(struct device *device)
1098 return 0; 1097 return 0;
1099 1098
1100 err_setup: 1099 err_setup:
1101 dev_set_drvdata(&dev->dev, NULL); 1100 platform_set_drvdata(dev, NULL);
1102 kfree(ace); 1101 kfree(ace);
1103 err_alloc: 1102 err_alloc:
1104 printk(KERN_ERR "xsysace: could not initialize device\n"); 1103 printk(KERN_ERR "xsysace: could not initialize device\n");
@@ -1108,25 +1107,27 @@ static int __devinit ace_probe(struct device *device)
1108/* 1107/*
1109 * Platform bus remove() method 1108 * Platform bus remove() method
1110 */ 1109 */
1111static int __devexit ace_remove(struct device *device) 1110static int __devexit ace_remove(struct platform_device *dev)
1112{ 1111{
1113 struct ace_device *ace = dev_get_drvdata(device); 1112 struct ace_device *ace = platform_get_drvdata(dev);
1114 1113 dev_dbg(&dev->dev, "ace_remove(%p)\n", dev);
1115 dev_dbg(device, "ace_remove(%p)\n", device);
1116 1114
1117 if (ace) { 1115 if (ace) {
1118 ace_teardown(ace); 1116 ace_teardown(ace);
1117 platform_set_drvdata(dev, NULL);
1119 kfree(ace); 1118 kfree(ace);
1120 } 1119 }
1121 1120
1122 return 0; 1121 return 0;
1123} 1122}
1124 1123
1125static struct device_driver ace_driver = { 1124static struct platform_driver ace_platform_driver = {
1126 .name = "xsysace",
1127 .bus = &platform_bus_type,
1128 .probe = ace_probe, 1125 .probe = ace_probe,
1129 .remove = __devexit_p(ace_remove), 1126 .remove = __devexit_p(ace_remove),
1127 .driver = {
1128 .owner = THIS_MODULE,
1129 .name = "xsysace",
1130 },
1130}; 1131};
1131 1132
1132/* --------------------------------------------------------------------- 1133/* ---------------------------------------------------------------------
@@ -1134,20 +1135,31 @@ static struct device_driver ace_driver = {
1134 */ 1135 */
1135static int __init ace_init(void) 1136static int __init ace_init(void)
1136{ 1137{
1138 int rc;
1139
1137 ace_major = register_blkdev(ace_major, "xsysace"); 1140 ace_major = register_blkdev(ace_major, "xsysace");
1138 if (ace_major <= 0) { 1141 if (ace_major <= 0) {
1139 printk(KERN_WARNING "xsysace: register_blkdev() failed\n"); 1142 rc = -ENOMEM;
1140 return ace_major; 1143 goto err_blk;
1141 } 1144 }
1142 1145
1143 pr_debug("Registering Xilinx SystemACE driver, major=%i\n", ace_major); 1146 if ((rc = platform_driver_register(&ace_platform_driver)) != 0)
1144 return driver_register(&ace_driver); 1147 goto err_plat;
1148
1149 pr_info("Xilinx SystemACE device driver, major=%i\n", ace_major);
1150 return 0;
1151
1152 err_plat:
1153 unregister_blkdev(ace_major, "xsysace");
1154 err_blk:
1155 printk(KERN_ERR "xsysace: registration failed; err=%i\n", rc);
1156 return rc;
1145} 1157}
1146 1158
1147static void __exit ace_exit(void) 1159static void __exit ace_exit(void)
1148{ 1160{
1149 pr_debug("Unregistering Xilinx SystemACE driver\n"); 1161 pr_debug("Unregistering Xilinx SystemACE driver\n");
1150 driver_unregister(&ace_driver); 1162 platform_driver_unregister(&ace_platform_driver);
1151 unregister_blkdev(ace_major, "xsysace"); 1163 unregister_blkdev(ace_major, "xsysace");
1152} 1164}
1153 1165