diff options
Diffstat (limited to 'drivers/dma/mv_xor.c')
-rw-r--r-- | drivers/dma/mv_xor.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c index f7b99193e884..6ed3162cccc9 100644 --- a/drivers/dma/mv_xor.c +++ b/drivers/dma/mv_xor.c | |||
@@ -1292,7 +1292,9 @@ static int mv_xor_shared_probe(struct platform_device *pdev) | |||
1292 | { | 1292 | { |
1293 | const struct mbus_dram_target_info *dram; | 1293 | const struct mbus_dram_target_info *dram; |
1294 | struct mv_xor_shared_private *msp; | 1294 | struct mv_xor_shared_private *msp; |
1295 | struct mv_xor_shared_platform_data *pdata = pdev->dev.platform_data; | ||
1295 | struct resource *res; | 1296 | struct resource *res; |
1297 | int i, ret; | ||
1296 | 1298 | ||
1297 | dev_notice(&pdev->dev, "Marvell shared XOR driver\n"); | 1299 | dev_notice(&pdev->dev, "Marvell shared XOR driver\n"); |
1298 | 1300 | ||
@@ -1334,12 +1336,55 @@ static int mv_xor_shared_probe(struct platform_device *pdev) | |||
1334 | if (!IS_ERR(msp->clk)) | 1336 | if (!IS_ERR(msp->clk)) |
1335 | clk_prepare_enable(msp->clk); | 1337 | clk_prepare_enable(msp->clk); |
1336 | 1338 | ||
1339 | if (pdata && pdata->channels) { | ||
1340 | for (i = 0; i < MV_XOR_MAX_CHANNELS; i++) { | ||
1341 | struct mv_xor_platform_data *cd; | ||
1342 | int irq; | ||
1343 | |||
1344 | cd = &pdata->channels[i]; | ||
1345 | if (!cd) { | ||
1346 | ret = -ENODEV; | ||
1347 | goto err_channel_add; | ||
1348 | } | ||
1349 | |||
1350 | irq = platform_get_irq(pdev, i); | ||
1351 | if (irq < 0) { | ||
1352 | ret = irq; | ||
1353 | goto err_channel_add; | ||
1354 | } | ||
1355 | |||
1356 | msp->channels[i] = | ||
1357 | mv_xor_channel_add(msp, pdev, cd->hw_id, | ||
1358 | cd->cap_mask, | ||
1359 | cd->pool_size, irq); | ||
1360 | if (IS_ERR(msp->channels[i])) { | ||
1361 | ret = PTR_ERR(msp->channels[i]); | ||
1362 | goto err_channel_add; | ||
1363 | } | ||
1364 | } | ||
1365 | } | ||
1366 | |||
1337 | return 0; | 1367 | return 0; |
1368 | |||
1369 | err_channel_add: | ||
1370 | for (i = 0; i < MV_XOR_MAX_CHANNELS; i++) | ||
1371 | if (msp->channels[i]) | ||
1372 | mv_xor_channel_remove(msp->channels[i]); | ||
1373 | |||
1374 | clk_disable_unprepare(msp->clk); | ||
1375 | clk_put(msp->clk); | ||
1376 | return ret; | ||
1338 | } | 1377 | } |
1339 | 1378 | ||
1340 | static int mv_xor_shared_remove(struct platform_device *pdev) | 1379 | static int mv_xor_shared_remove(struct platform_device *pdev) |
1341 | { | 1380 | { |
1342 | struct mv_xor_shared_private *msp = platform_get_drvdata(pdev); | 1381 | struct mv_xor_shared_private *msp = platform_get_drvdata(pdev); |
1382 | int i; | ||
1383 | |||
1384 | for (i = 0; i < MV_XOR_MAX_CHANNELS; i++) { | ||
1385 | if (msp->channels[i]) | ||
1386 | mv_xor_channel_remove(msp->channels[i]); | ||
1387 | } | ||
1343 | 1388 | ||
1344 | if (!IS_ERR(msp->clk)) { | 1389 | if (!IS_ERR(msp->clk)) { |
1345 | clk_disable_unprepare(msp->clk); | 1390 | clk_disable_unprepare(msp->clk); |