Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

n2rng: Attach on Niagara-T3.

And stop referring to Victoria Falls, as the attribute we're
talking about is whether the rng is multi-unit capable which
applies to several chip variants now.

Signed-off-by: David S. Miller <davem@davemloft.net>

+18 -13
+17 -12
drivers/char/hw_random/n2-drv.c
··· 1 1 /* n2-drv.c: Niagara-2 RNG driver. 2 2 * 3 - * Copyright (C) 2008 David S. Miller <davem@davemloft.net> 3 + * Copyright (C) 2008, 2011 David S. Miller <davem@davemloft.net> 4 4 */ 5 5 6 6 #include <linux/kernel.h> ··· 22 22 23 23 #define DRV_MODULE_NAME "n2rng" 24 24 #define PFX DRV_MODULE_NAME ": " 25 - #define DRV_MODULE_VERSION "0.1" 26 - #define DRV_MODULE_RELDATE "May 15, 2008" 25 + #define DRV_MODULE_VERSION "0.2" 26 + #define DRV_MODULE_RELDATE "July 27, 2011" 27 27 28 28 static char version[] __devinitdata = 29 29 DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; ··· 623 623 static int __devinit n2rng_probe(struct platform_device *op) 624 624 { 625 625 const struct of_device_id *match; 626 - int victoria_falls; 626 + int multi_capable; 627 627 int err = -ENOMEM; 628 628 struct n2rng *np; 629 629 630 630 match = of_match_device(n2rng_match, &op->dev); 631 631 if (!match) 632 632 return -EINVAL; 633 - victoria_falls = (match->data != NULL); 633 + multi_capable = (match->data != NULL); 634 634 635 635 n2rng_driver_version(); 636 636 np = kzalloc(sizeof(*np), GFP_KERNEL); ··· 640 640 641 641 INIT_DELAYED_WORK(&np->work, n2rng_work); 642 642 643 - if (victoria_falls) 644 - np->flags |= N2RNG_FLAG_VF; 643 + if (multi_capable) 644 + np->flags |= N2RNG_FLAG_MULTI; 645 645 646 646 err = -ENODEV; 647 647 np->hvapi_major = 2; ··· 658 658 } 659 659 } 660 660 661 - if (np->flags & N2RNG_FLAG_VF) { 661 + if (np->flags & N2RNG_FLAG_MULTI) { 662 662 if (np->hvapi_major < 2) { 663 - dev_err(&op->dev, "VF RNG requires HVAPI major " 664 - "version 2 or later, got %lu\n", 663 + dev_err(&op->dev, "multi-unit-capable RNG requires " 664 + "HVAPI major version 2 or later, got %lu\n", 665 665 np->hvapi_major); 666 666 goto out_hvapi_unregister; 667 667 } ··· 688 688 goto out_free_units; 689 689 690 690 dev_info(&op->dev, "Found %s RNG, units: %d\n", 691 - ((np->flags & N2RNG_FLAG_VF) ? 692 - "Victoria Falls" : "Niagara2"), 691 + ((np->flags & N2RNG_FLAG_MULTI) ? 692 + "multi-unit-capable" : "single-unit"), 693 693 np->num_units); 694 694 695 695 np->hwrng.name = "n2rng"; ··· 749 749 { 750 750 .name = "random-number-generator", 751 751 .compatible = "SUNW,vf-rng", 752 + .data = (void *) 1, 753 + }, 754 + { 755 + .name = "random-number-generator", 756 + .compatible = "SUNW,kt-rng", 752 757 .data = (void *) 1, 753 758 }, 754 759 {},
+1 -1
drivers/char/hw_random/n2rng.h
··· 68 68 struct platform_device *op; 69 69 70 70 unsigned long flags; 71 - #define N2RNG_FLAG_VF 0x00000001 /* Victoria Falls RNG, else N2 */ 71 + #define N2RNG_FLAG_MULTI 0x00000001 /* Multi-unit capable RNG */ 72 72 #define N2RNG_FLAG_CONTROL 0x00000002 /* Operating in control domain */ 73 73 #define N2RNG_FLAG_READY 0x00000008 /* Ready for hw-rng layer */ 74 74 #define N2RNG_FLAG_SHUTDOWN 0x00000010 /* Driver unregistering */