Commit 653af321 authored by James Nelson's avatar James Nelson Committed by Jeff Garzik

[PATCH] hw_random: Minor cleanup to hw_random.c

Clean up in drivers/char/hw_random.c:
Make debug #defines a little easier to understand.
Small whitespace cleanup.
Change some printk()'s into pr_info()'s.
Add KERN_ constant to debug printk().
Signed-off-by: default avatarJames Nelson <james4765@gmail.com>
Signed-off-by: default avatarJeff Garzik <jgarzik@pobox.com>
parent 5a33e494
...@@ -56,31 +56,27 @@ ...@@ -56,31 +56,27 @@
/* /*
* debugging macros * debugging macros
*/ */
#undef RNG_DEBUG /* define to enable copious debugging info */
#ifdef RNG_DEBUG /* pr_debug() collapses to a no-op if DEBUG is not defined */
/* note: prints function name for you */ #define DPRINTK(fmt, args...) pr_debug(PFX "%s: " fmt, __FUNCTION__ , ## args)
#define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __FUNCTION__ , ## args)
#else
#define DPRINTK(fmt, args...)
#endif
#define RNG_NDEBUG /* define to disable lightweight runtime checks */ #undef RNG_NDEBUG /* define to enable lightweight runtime checks */
#ifdef RNG_NDEBUG #ifdef RNG_NDEBUG
#define assert(expr) #define assert(expr) \
if(!(expr)) { \
printk(KERN_DEBUG PFX "Assertion failed! %s,%s,%s," \
"line=%d\n", #expr, __FILE__, __FUNCTION__, __LINE__); \
}
#else #else
#define assert(expr) \ #define assert(expr)
if(!(expr)) { \
printk( "Assertion failed! %s,%s,%s,line=%d\n", \
#expr,__FILE__,__FUNCTION__,__LINE__); \
}
#endif #endif
#define RNG_MISCDEV_MINOR 183 /* official */ #define RNG_MISCDEV_MINOR 183 /* official */
static int rng_dev_open (struct inode *inode, struct file *filp); static int rng_dev_open (struct inode *inode, struct file *filp);
static ssize_t rng_dev_read (struct file *filp, char __user *buf, size_t size, static ssize_t rng_dev_read (struct file *filp, char __user *buf, size_t size,
loff_t * offp); loff_t * offp);
static int __init intel_init (struct pci_dev *dev); static int __init intel_init (struct pci_dev *dev);
static void intel_cleanup(void); static void intel_cleanup(void);
...@@ -322,7 +318,8 @@ static int __init amd_init (struct pci_dev *dev) ...@@ -322,7 +318,8 @@ static int __init amd_init (struct pci_dev *dev)
rnen |= (1 << 7); /* PMIO enable */ rnen |= (1 << 7); /* PMIO enable */
pci_write_config_byte(dev, 0x41, rnen); pci_write_config_byte(dev, 0x41, rnen);
printk(KERN_INFO PFX "AMD768 system management I/O registers at 0x%X.\n", pmbase); pr_info( PFX "AMD768 system management I/O registers at 0x%X.\n",
pmbase);
amd_dev = dev; amd_dev = dev;
...@@ -483,7 +480,7 @@ static int rng_dev_open (struct inode *inode, struct file *filp) ...@@ -483,7 +480,7 @@ static int rng_dev_open (struct inode *inode, struct file *filp)
static ssize_t rng_dev_read (struct file *filp, char __user *buf, size_t size, static ssize_t rng_dev_read (struct file *filp, char __user *buf, size_t size,
loff_t * offp) loff_t * offp)
{ {
static spinlock_t rng_lock = SPIN_LOCK_UNLOCKED; static spinlock_t rng_lock = SPIN_LOCK_UNLOCKED;
unsigned int have_data; unsigned int have_data;
...@@ -606,7 +603,7 @@ static int __init rng_init (void) ...@@ -606,7 +603,7 @@ static int __init rng_init (void)
if (rc) if (rc)
return rc; return rc;
printk (KERN_INFO RNG_DRIVER_NAME " loaded\n"); pr_info( RNG_DRIVER_NAME " loaded\n");
DPRINTK ("EXIT, returning 0\n"); DPRINTK ("EXIT, returning 0\n");
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment