aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/musb/tusb6010.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/musb/tusb6010.c')
-rw-r--r--drivers/usb/musb/tusb6010.c40
1 files changed, 7 insertions, 33 deletions
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c
index dc4d75ea13ad..8bde6fc5eb75 100644
--- a/drivers/usb/musb/tusb6010.c
+++ b/drivers/usb/musb/tusb6010.c
@@ -1153,14 +1153,13 @@ static const struct musb_platform_ops tusb_ops = {
1153 1153
1154static u64 tusb_dmamask = DMA_BIT_MASK(32); 1154static u64 tusb_dmamask = DMA_BIT_MASK(32);
1155 1155
1156static int __devinit tusb_probe(struct platform_device *pdev) 1156static int tusb_probe(struct platform_device *pdev)
1157{ 1157{
1158 struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data; 1158 struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data;
1159 struct platform_device *musb; 1159 struct platform_device *musb;
1160 struct tusb6010_glue *glue; 1160 struct tusb6010_glue *glue;
1161 1161
1162 int ret = -ENOMEM; 1162 int ret = -ENOMEM;
1163 int musbid;
1164 1163
1165 glue = kzalloc(sizeof(*glue), GFP_KERNEL); 1164 glue = kzalloc(sizeof(*glue), GFP_KERNEL);
1166 if (!glue) { 1165 if (!glue) {
@@ -1168,21 +1167,12 @@ static int __devinit tusb_probe(struct platform_device *pdev)
1168 goto err0; 1167 goto err0;
1169 } 1168 }
1170 1169
1171 /* get the musb id */ 1170 musb = platform_device_alloc("musb-hdrc", PLATFORM_DEVID_AUTO);
1172 musbid = musb_get_id(&pdev->dev, GFP_KERNEL);
1173 if (musbid < 0) {
1174 dev_err(&pdev->dev, "failed to allocate musb id\n");
1175 ret = -ENOMEM;
1176 goto err1;
1177 }
1178
1179 musb = platform_device_alloc("musb-hdrc", musbid);
1180 if (!musb) { 1171 if (!musb) {
1181 dev_err(&pdev->dev, "failed to allocate musb device\n"); 1172 dev_err(&pdev->dev, "failed to allocate musb device\n");
1182 goto err2; 1173 goto err1;
1183 } 1174 }
1184 1175
1185 musb->id = musbid;
1186 musb->dev.parent = &pdev->dev; 1176 musb->dev.parent = &pdev->dev;
1187 musb->dev.dma_mask = &tusb_dmamask; 1177 musb->dev.dma_mask = &tusb_dmamask;
1188 musb->dev.coherent_dma_mask = tusb_dmamask; 1178 musb->dev.coherent_dma_mask = tusb_dmamask;
@@ -1218,9 +1208,6 @@ static int __devinit tusb_probe(struct platform_device *pdev)
1218err3: 1208err3:
1219 platform_device_put(musb); 1209 platform_device_put(musb);
1220 1210
1221err2:
1222 musb_put_id(&pdev->dev, musbid);
1223
1224err1: 1211err1:
1225 kfree(glue); 1212 kfree(glue);
1226 1213
@@ -1228,13 +1215,11 @@ err0:
1228 return ret; 1215 return ret;
1229} 1216}
1230 1217
1231static int __devexit tusb_remove(struct platform_device *pdev) 1218static int tusb_remove(struct platform_device *pdev)
1232{ 1219{
1233 struct tusb6010_glue *glue = platform_get_drvdata(pdev); 1220 struct tusb6010_glue *glue = platform_get_drvdata(pdev);
1234 1221
1235 musb_put_id(&pdev->dev, glue->musb->id); 1222 platform_device_unregister(glue->musb);
1236 platform_device_del(glue->musb);
1237 platform_device_put(glue->musb);
1238 kfree(glue); 1223 kfree(glue);
1239 1224
1240 return 0; 1225 return 0;
@@ -1242,7 +1227,7 @@ static int __devexit tusb_remove(struct platform_device *pdev)
1242 1227
1243static struct platform_driver tusb_driver = { 1228static struct platform_driver tusb_driver = {
1244 .probe = tusb_probe, 1229 .probe = tusb_probe,
1245 .remove = __devexit_p(tusb_remove), 1230 .remove = tusb_remove,
1246 .driver = { 1231 .driver = {
1247 .name = "musb-tusb", 1232 .name = "musb-tusb",
1248 }, 1233 },
@@ -1251,15 +1236,4 @@ static struct platform_driver tusb_driver = {
1251MODULE_DESCRIPTION("TUSB6010 MUSB Glue Layer"); 1236MODULE_DESCRIPTION("TUSB6010 MUSB Glue Layer");
1252MODULE_AUTHOR("Felipe Balbi <balbi@ti.com>"); 1237MODULE_AUTHOR("Felipe Balbi <balbi@ti.com>");
1253MODULE_LICENSE("GPL v2"); 1238MODULE_LICENSE("GPL v2");
1254 1239module_platform_driver(tusb_driver);
1255static int __init tusb_init(void)
1256{
1257 return platform_driver_register(&tusb_driver);
1258}
1259module_init(tusb_init);
1260
1261static void __exit tusb_exit(void)
1262{
1263 platform_driver_unregister(&tusb_driver);
1264}
1265module_exit(tusb_exit);