aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/crypto/ixp4xx_crypto.c
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2013-06-10 13:52:52 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2013-10-31 10:49:09 -0400
commitd8cbc3f7921d0a50c032c8ee7131f8ee10c6b5a9 (patch)
tree2ae305bc293571214497d256f1b7bc7ab0e31ae3 /drivers/crypto/ixp4xx_crypto.c
parentd6cfaaba1a93a239b01bc8d1351685773b657b64 (diff)
DMA-API: crypto: fix ixp4xx crypto platform device support
Don't statically allocate struct device's in modules, and shut the warning up with an empty release() function. There's a reason that warning is there and that's not for people to hide in this way. It's there to persuade people to use the correct APIs to allocate platform devices. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/crypto/ixp4xx_crypto.c')
-rw-r--r--drivers/crypto/ixp4xx_crypto.c37
1 files changed, 17 insertions, 20 deletions
diff --git a/drivers/crypto/ixp4xx_crypto.c b/drivers/crypto/ixp4xx_crypto.c
index 21180d6cad6e..830618579102 100644
--- a/drivers/crypto/ixp4xx_crypto.c
+++ b/drivers/crypto/ixp4xx_crypto.c
@@ -218,23 +218,10 @@ static dma_addr_t crypt_phys;
218 218
219static int support_aes = 1; 219static int support_aes = 1;
220 220
221static void dev_release(struct device *dev)
222{
223 return;
224}
225
226#define DRIVER_NAME "ixp4xx_crypto" 221#define DRIVER_NAME "ixp4xx_crypto"
227static struct platform_device pseudo_dev = {
228 .name = DRIVER_NAME,
229 .id = 0,
230 .num_resources = 0,
231 .dev = {
232 .coherent_dma_mask = DMA_BIT_MASK(32),
233 .release = dev_release,
234 }
235};
236 222
237static struct device *dev = &pseudo_dev.dev; 223static struct platform_device *pdev;
224static struct device *dev;
238 225
239static inline dma_addr_t crypt_virt2phys(struct crypt_ctl *virt) 226static inline dma_addr_t crypt_virt2phys(struct crypt_ctl *virt)
240{ 227{
@@ -1418,20 +1405,30 @@ static struct ixp_alg ixp4xx_algos[] = {
1418} }; 1405} };
1419 1406
1420#define IXP_POSTFIX "-ixp4xx" 1407#define IXP_POSTFIX "-ixp4xx"
1408
1409static const struct platform_device_info ixp_dev_info __initdata = {
1410 .name = DRIVER_NAME,
1411 .id = 0,
1412 .dma_mask = DMA_BIT_MASK(32),
1413};
1414
1421static int __init ixp_module_init(void) 1415static int __init ixp_module_init(void)
1422{ 1416{
1423 int num = ARRAY_SIZE(ixp4xx_algos); 1417 int num = ARRAY_SIZE(ixp4xx_algos);
1424 int i,err ; 1418 int i, err ;
1425 1419
1426 if (platform_device_register(&pseudo_dev)) 1420 pdev = platform_device_register_full(&ixp_dev_info);
1427 return -ENODEV; 1421 if (IS_ERR(pdev))
1422 return PTR_ERR(pdev);
1423
1424 dev = &pdev->dev;
1428 1425
1429 spin_lock_init(&desc_lock); 1426 spin_lock_init(&desc_lock);
1430 spin_lock_init(&emerg_lock); 1427 spin_lock_init(&emerg_lock);
1431 1428
1432 err = init_ixp_crypto(); 1429 err = init_ixp_crypto();
1433 if (err) { 1430 if (err) {
1434 platform_device_unregister(&pseudo_dev); 1431 platform_device_unregister(pdev);
1435 return err; 1432 return err;
1436 } 1433 }
1437 for (i=0; i< num; i++) { 1434 for (i=0; i< num; i++) {
@@ -1496,7 +1493,7 @@ static void __exit ixp_module_exit(void)
1496 crypto_unregister_alg(&ixp4xx_algos[i].crypto); 1493 crypto_unregister_alg(&ixp4xx_algos[i].crypto);
1497 } 1494 }
1498 release_ixp_crypto(); 1495 release_ixp_crypto();
1499 platform_device_unregister(&pseudo_dev); 1496 platform_device_unregister(pdev);
1500} 1497}
1501 1498
1502module_init(ixp_module_init); 1499module_init(ixp_module_init);