aboutsummaryrefslogtreecommitdiff
path: root/drivers/char/hw_random/amd-rng.c
AgeCommit message (Collapse)AuthorFilesLines
2017-03-16hwrng: amd - Revert managed API changesPrarit Bhargava1-8/+34
After commit 31b2a73c9c5f ("hwrng: amd - Migrate to managed API"), the amd-rng driver uses devres with pci_dev->dev to keep track of resources, but does not actually register a PCI driver. This results in the following issues: 1. The message WARNING: CPU: 2 PID: 621 at drivers/base/dd.c:349 driver_probe_device+0x38c is output when the i2c_amd756 driver loads and attempts to register a PCI driver. The PCI & device subsystems assume that no resources have been registered for the device, and the WARN_ON() triggers since amd-rng has already do so. 2. The driver leaks memory because the driver does not attach to a device. The driver only uses the PCI device as a reference. devm_*() functions will release resources on driver detach, which the amd-rng driver will never do. As a result, 3. The driver cannot be reloaded because there is always a use of the ioport and region after the first load of the driver. Revert the changes made by 31b2a73c9c5f ("hwrng: amd - Migrate to managed API"). Cc: <[email protected]> Signed-off-by: Prarit Bhargava <[email protected]> Fixes: 31b2a73c9c5f ("hwrng: amd - Migrate to managed API"). Cc: Matt Mackall <[email protected]> Cc: Corentin LABBE <[email protected]> Cc: PrasannaKumar Muralidharan <[email protected]> Cc: Wei Yongjun <[email protected]> Cc: [email protected] Cc: [email protected] Signed-off-by: Herbert Xu <[email protected]>
2016-09-22hwrng: amd - Fix return value check in mod_init()Wei Yongjun1-4/+4
In case of error, the function devm_kzalloc() or devm_ioport_map() return NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test. Fixes: 31b2a73c9c5f ("hwrng: amd - Migrate to managed API") Signed-off-by: Wei Yongjun <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2016-09-13hwrng: amd - Migrate to managed APIPrasannaKumar Muralidharan1-37/+11
Managed API eliminates error handling code, thus reduces several lines of code. Signed-off-by: PrasannaKumar Muralidharan <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2016-08-31hwrng: amd - Convert to new hwrng read() APICorentin LABBE1-19/+28
This patch convert the hwrng interface used by amd768-rng to its new API by replacing data_read()/data_present() by read(). Signed-off-by: LABBE Corentin <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2016-08-31hwrng: amd - Access hardware via ioread32/iowrite32Corentin LABBE1-6/+25
Instead of accessing hw directly via pmbase, it's better to access after ioport_map() via ioread32/iowrite32. Signed-off-by: LABBE Corentin <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2016-08-31hwrng: amd - Replace global variable with private structCorentin LABBE1-19/+38
Instead of having two global variable, it's better to use a private struct. This will permit to remove amd_pdev variable Signed-off-by: LABBE Corentin <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2016-08-31hwrng: amd - release_region must be called after hwrng_unregisterCorentin LABBE1-1/+2
The driver release the memory region before being sure that nobody use it. This patch made hwrng_unregister ran before any release was done. Signed-off-by: LABBE Corentin <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2016-08-31hwrng: amd - Remove asm/io.hCorentin LABBE1-4/+3
checkpatch complains about <asm/io.h> used instead of linux/io.h. In fact it is not needed. This patch remove it, and in the process, alphabetize the other headers. Signed-off-by: LABBE Corentin <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2016-08-31hwrng: amd - Be consitent with the driver nameCorentin LABBE1-6/+5
The driver name is displayed each time differently. This patch make use of the same name everywhere. Signed-off-by: LABBE Corentin <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2016-08-31hwrng: amd - use the BIT macroCorentin LABBE1-3/+3
This patch add usage of the BIT() macro Signed-off-by: LABBE Corentin <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2016-08-31hwrng: amd - Fix style problem with blank lineCorentin LABBE1-5/+1
Some blank line are unncessary, and one is missing after declaration. This patch fix thoses style problems. Signed-off-by: LABBE Corentin <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2014-10-02hwrng: printk replacementSudip Mukherjee1-2/+2
as pr_* macros are more preffered over printk, so printk replaced with corresponding pr_* macros Signed-off-by: Sudip Mukherjee <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2011-05-04hwrng: amd - manage resource allocationDmitry Eremin-Solenikov1-0/+9
As amd driver doesn't bind to PCI device, we'd better manage reource allocation on our own to disallow (possible) conflicts. Signed-off-by: Dmitry Eremin-Solenikov <[email protected]> Acked-by: Matt Mackall <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2009-06-25hwrng: Use PCI_VDEVICEJoe Perches1-2/+2
Signed-off-by: Joe Perches <[email protected]> Acked-by: Matt Mackall <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2008-10-27Tidy up addresses in random driversAlan Cox1-1/+1
Signed-off-by: Alan Cox <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2008-01-11[HWRNG]: move status polling loop to data_present callbacksPatrick McHardy1-2/+10
Handle waiting for new random within the drivers themselves, this allows to use better suited timeouts for the individual rngs. Signed-off-by: Patrick McHardy <[email protected]> Acked-by: Michael Buesch <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2007-01-11[PATCH] Fix HWRNG built-in initcalls priorityMichael Buesch1-1/+1
This changes all HWRNG driver initcalls to module_init(). We must probe the RNGs after the major kernel subsystems are already up and running (like PCI). This fixes Bug 7730. http://bugzilla.kernel.org/show_bug.cgi?id=7730 Signed-off-by: Michael Buesch <[email protected]> Cc: Jan Beulich <[email protected]> Cc: Jeff Garzik <[email protected]> Cc: Greg KH <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2006-06-26[PATCH] Add AMD HW RNG driverMichael Buesch1-0/+152
Signed-off-by: Michael Buesch <[email protected]> Cc: Jeff Garzik <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>