diff options
Diffstat (limited to 'drivers/crypto/padlock-sha.c')
-rw-r--r-- | drivers/crypto/padlock-sha.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/crypto/padlock-sha.c b/drivers/crypto/padlock-sha.c index 06bdb4b2c6a6..9266c0e25492 100644 --- a/drivers/crypto/padlock-sha.c +++ b/drivers/crypto/padlock-sha.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/interrupt.h> | 22 | #include <linux/interrupt.h> |
23 | #include <linux/kernel.h> | 23 | #include <linux/kernel.h> |
24 | #include <linux/scatterlist.h> | 24 | #include <linux/scatterlist.h> |
25 | #include <asm/cpu_device_id.h> | ||
25 | #include <asm/i387.h> | 26 | #include <asm/i387.h> |
26 | 27 | ||
27 | struct padlock_sha_desc { | 28 | struct padlock_sha_desc { |
@@ -526,6 +527,12 @@ static struct shash_alg sha256_alg_nano = { | |||
526 | } | 527 | } |
527 | }; | 528 | }; |
528 | 529 | ||
530 | static struct x86_cpu_id padlock_sha_ids[] = { | ||
531 | X86_FEATURE_MATCH(X86_FEATURE_PHE), | ||
532 | {} | ||
533 | }; | ||
534 | MODULE_DEVICE_TABLE(x86cpu, padlock_sha_ids); | ||
535 | |||
529 | static int __init padlock_init(void) | 536 | static int __init padlock_init(void) |
530 | { | 537 | { |
531 | int rc = -ENODEV; | 538 | int rc = -ENODEV; |
@@ -533,15 +540,8 @@ static int __init padlock_init(void) | |||
533 | struct shash_alg *sha1; | 540 | struct shash_alg *sha1; |
534 | struct shash_alg *sha256; | 541 | struct shash_alg *sha256; |
535 | 542 | ||
536 | if (!cpu_has_phe) { | 543 | if (!x86_match_cpu(padlock_sha_ids) || !cpu_has_phe_enabled) |
537 | printk(KERN_NOTICE PFX "VIA PadLock Hash Engine not detected.\n"); | ||
538 | return -ENODEV; | ||
539 | } | ||
540 | |||
541 | if (!cpu_has_phe_enabled) { | ||
542 | printk(KERN_NOTICE PFX "VIA PadLock detected, but not enabled. Hmm, strange...\n"); | ||
543 | return -ENODEV; | 544 | return -ENODEV; |
544 | } | ||
545 | 545 | ||
546 | /* Register the newly added algorithm module if on * | 546 | /* Register the newly added algorithm module if on * |
547 | * VIA Nano processor, or else just do as before */ | 547 | * VIA Nano processor, or else just do as before */ |