If you're not sure, say N.
config HW_RANDOM
- tristate "Intel/AMD/Via H/W Random Number Generator support"
+ tristate "Intel/AMD/VIA HW Random Number Generator support"
depends on (X86 || IA64) && PCI
---help---
This driver provides kernel-side support for the Random Number
Generator hardware found on Intel i8xx-based motherboards,
- and AMD 76x-based motherboards.
+ AMD 76x-based motherboards, and Via Nehemiah CPUs.
Provides a character driver, used to read() entropy data.
/*
- Hardware driver for the Intel/AMD/Via Random Number Generators (RNG)
+ Hardware driver for the Intel/AMD/VIA Random Number Generators (RNG)
(c) Copyright 2003 Red Hat Inc <jgarzik@redhat.com>
derived from
#define RNG_MISCDEV_MINOR 183 /* official */
static int rng_dev_open (struct inode *inode, struct file *filp);
-static int rng_dev_release (struct inode *inode, struct file *filp);
static ssize_t rng_dev_read (struct file *filp, char *buf, size_t size,
loff_t * offp);
static int __init intel_init (struct pci_dev *dev);
-static void __exit intel_cleanup(void);
+static void intel_cleanup(void);
static unsigned int intel_data_present (void);
static u32 intel_data_read (void);
static int __init amd_init (struct pci_dev *dev);
-static void __exit amd_cleanup(void);
+static void amd_cleanup(void);
static unsigned int amd_data_present (void);
static u32 amd_data_read (void);
static int __init via_init(struct pci_dev *dev);
-static void __exit via_cleanup(void);
+static void via_cleanup(void);
static unsigned int via_data_present (void);
static u32 via_data_read (void);
};
static struct rng_operations *rng_ops;
-static struct semaphore rng_open_sem; /* Semaphore for serializing rng_open/release */
-
static struct file_operations rng_chrdev_ops = {
.owner = THIS_MODULE,
.open = rng_dev_open,
- .release = rng_dev_release,
.read = rng_dev_read,
};
return rc;
}
-static void __exit intel_cleanup(void)
+static void intel_cleanup(void)
{
u8 hw_status;
return rc;
}
-static void __exit amd_cleanup(void)
+static void amd_cleanup(void)
{
u8 rnen;
/***********************************************************************
*
- * Via RNG operations
+ * VIA RNG operations
*
*/
unneeded */
rdmsr(MSR_VIA_RNG, lo, hi);
if ((lo & VIA_RNG_ENABLE) == 0) {
- printk(KERN_ERR PFX "cannot enable Via C3 RNG, aborting\n");
+ printk(KERN_ERR PFX "cannot enable VIA C3 RNG, aborting\n");
return -ENODEV;
}
return 0;
}
-static void __exit via_cleanup(void)
+static void via_cleanup(void)
{
u32 lo, hi;
static int rng_dev_open (struct inode *inode, struct file *filp)
{
+ /* enforce read-only access to this chrdev */
if ((filp->f_mode & FMODE_READ) == 0)
return -EINVAL;
if (filp->f_mode & FMODE_WRITE)
return -EINVAL;
- /* wait for device to become free */
- if (filp->f_flags & O_NONBLOCK) {
- if (down_trylock (&rng_open_sem))
- return -EAGAIN;
- } else {
- if (down_interruptible (&rng_open_sem))
- return -ERESTARTSYS;
- }
- return 0;
-}
-
-
-static int rng_dev_release (struct inode *inode, struct file *filp)
-{
- up(&rng_open_sem);
return 0;
}
DPRINTK ("ENTER\n");
- init_MUTEX (&rng_open_sem);
-
/* Probe for Intel, AMD RNGs */
pci_for_each_dev(pdev) {
ent = pci_match_device (rng_pci_tbl, pdev);
}
#ifdef __i386__
- /* Probe for Via RNG */
+ /* Probe for VIA RNG */
if (cpu_has_xstore) {
rng_ops = &rng_vendor_ops[rng_hw_via];
pdev = NULL;