2004-11-05 21:19:30

by Jim Nelson

[permalink] [raw]
Subject: [PATCH] hw_random: Update printk()'s in hw_random.c

Update drivers/char/hw_random.c to pr_debug()/pr_info()

Signed-off-by: James Nelson <[email protected]>

diff -urN --exclude='*~' linux-2.6.9-original/drivers/char/hw_random.c linux-2.6.9/drivers/char/hw_random.c
--- linux-2.6.9-original/drivers/char/hw_random.c 2004-10-18 17:53:50.000000000 -0400
+++ linux-2.6.9/drivers/char/hw_random.c 2004-11-05 15:26:10.869606837 -0500
@@ -56,31 +56,28 @@
/*
* debugging macros
*/
-#undef RNG_DEBUG /* define to enable copious debugging info */
+#undef DEBUG /* define to enable copious debugging info */
+
+/* pr_debug() collapses to a no-op if DEBUG is not defined */
+#define DPRINTK(fmt, args...) pr_debug(PFX "%s: " fmt, __FUNCTION__ , ## args)

-#ifdef RNG_DEBUG
-/* note: prints function name for you */
-#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
-#define assert(expr)
+#define assert(expr) \
+ if(!(expr)) { \
+ pr_debug(PFX "Assertion failed! %s,%s,%s,line=%d\n", \
+ #expr,__FILE__,__FUNCTION__,__LINE__); \
+ }
#else
-#define assert(expr) \
- if(!(expr)) { \
- printk( "Assertion failed! %s,%s,%s,line=%d\n", \
- #expr,__FILE__,__FUNCTION__,__LINE__); \
- }
+#define assert(expr)
#endif

#define RNG_MISCDEV_MINOR 183 /* official */

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,
- loff_t * offp);
+ loff_t * offp);

static int __init intel_init (struct pci_dev *dev);
static void intel_cleanup(void);
@@ -322,7 +319,7 @@
rnen |= (1 << 7); /* PMIO enable */
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;

@@ -413,7 +410,8 @@
* completes.
*/
via_rng_datum = 0; /* paranoia, not really necessary */
- bytes_out = xstore(&via_rng_datum, VIA_RNG_CHUNK_1) & VIA_XSTORE_CNT_MASK;
+ bytes_out = xstore(&via_rng_datum, VIA_RNG_CHUNK_1) &
+ VIA_XSTORE_CNT_MASK;
if (bytes_out == 0)
return 0;

@@ -606,7 +604,7 @@
if (rc)
return rc;

- printk (KERN_INFO RNG_DRIVER_NAME " loaded\n");
+ pr_info (RNG_DRIVER_NAME " loaded\n");

DPRINTK ("EXIT, returning 0\n");
return 0;


2004-11-05 21:20:13

by Jim Nelson

[permalink] [raw]
Subject: [PATCH] hw_random: Remove changelog from hw_random.txt

Remove pre-merge changelog from Documentation/hw_random.txt

Signed-off-by: James Nelson <[email protected]>

diff -urN --exclude='*~' linux-2.6.9-original/Documentation/hw_random.txt linux-2.6.9/Documentation/hw_random.txt
--- linux-2.6.9-original/Documentation/hw_random.txt 2004-10-18 17:54:38.000000000 -0400
+++ linux-2.6.9/Documentation/hw_random.txt 2004-11-05 15:28:24.834717240 -0500
@@ -67,72 +67,3 @@

Special thanks to Matt Sottek. I did the "guts", he
did the "brains" and all the testing.
-
-Change history:
-
- Version 1.0.0:
- * Merge Intel, AMD, VIA RNG drivers into one.
- Further changelog in BitKeeper.
-
- Version 0.9.8:
- * Support other i8xx chipsets by adding 82801E detection
- * 82801DB detection is the same as for 82801CA.
-
- Version 0.9.7:
- * Support other i8xx chipsets too (by adding 82801BA(M) and
- 82801CA(M) detection)
-
- Version 0.9.6:
- * Internal driver cleanups, prep for 1.0.0 release.
-
- Version 0.9.5:
- * Rip out entropy injection via timer. It never ever worked,
- and a better solution (rngd) is now available.
-
- Version 0.9.4:
- * Fix: Remove request_mem_region
- * Fix: Horrible bugs in FIPS calculation and test execution
-
- Version 0.9.3:
- * Clean up rng_read a bit.
- * Update i810_rng driver Web site URL.
- * Increase default timer interval to 4 samples per second.
- * Abort if mem region is not available.
- * BSS zero-initialization cleanup.
- * Call misc_register() from rng_init_one.
- * Fix O_NONBLOCK to occur before we schedule.
-
- Version 0.9.2:
- * Simplify open blocking logic
-
- Version 0.9.1:
- * Support i815 chipsets too (Matt Sottek)
- * Fix reference counting when statically compiled (prumpf)
- * Rewrite rng_dev_read (prumpf)
- * Make module races less likely (prumpf)
- * Small miscellaneous bug fixes (prumpf)
- * Use pci table for PCI id list
-
- Version 0.9.0:
- * Don't register a pci_driver, because we are really
- using PCI bridge vendor/device ids, and someone
- may want to register a driver for the bridge. (bug fix)
- * Don't let the usage count go negative (bug fix)
- * Clean up spinlocks (bug fix)
- * Enable PCI device, if necessary (bug fix)
- * iounmap on module unload (bug fix)
- * If RNG chrdev is already in use when open(2) is called,
- sleep until it is available.
- * Remove redundant globals rng_allocated, rng_use_count
- * Convert numeric globals to unsigned
- * Module unload cleanup
-
- Version 0.6.2:
- * Clean up spinlocks. Since we don't have any interrupts
- to worry about, but we do have a timer to worry about,
- we use spin_lock_bh everywhere except the timer function
- itself.
- * Fix module load/unload.
- * Fix timer function and h/w enable/disable logic
- * New timer interval sysctl
- * Clean up sysctl names

2004-11-06 17:13:33

by Jeff Garzik

[permalink] [raw]
Subject: Re: [PATCH] hw_random: Update printk()'s in hw_random.c

[email protected] wrote:
> Update drivers/char/hw_random.c to pr_debug()/pr_info()
>
> Signed-off-by: James Nelson <[email protected]>
>
> diff -urN --exclude='*~' linux-2.6.9-original/drivers/char/hw_random.c linux-2.6.9/drivers/char/hw_random.c
> --- linux-2.6.9-original/drivers/char/hw_random.c 2004-10-18 17:53:50.000000000 -0400
> +++ linux-2.6.9/drivers/char/hw_random.c 2004-11-05 15:26:10.869606837 -0500
> @@ -56,31 +56,28 @@
> /*
> * debugging macros
> */
> -#undef RNG_DEBUG /* define to enable copious debugging info */
> +#undef DEBUG /* define to enable copious debugging info */

I think the '#undef DEBUG' line is supposed to precede all the
#includes, yes?


> +/* pr_debug() collapses to a no-op if DEBUG is not defined */
> +#define DPRINTK(fmt, args...) pr_debug(PFX "%s: " fmt, __FUNCTION__ , ## args)
>
> -#ifdef RNG_DEBUG
> -/* note: prints function name for you */
> -#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
> -#define assert(expr)
> +#define assert(expr) \
> + if(!(expr)) { \
> + pr_debug(PFX "Assertion failed! %s,%s,%s,line=%d\n", \
> + #expr,__FILE__,__FUNCTION__,__LINE__); \
> + }
> #else
> -#define assert(expr) \
> - if(!(expr)) { \
> - printk( "Assertion failed! %s,%s,%s,line=%d\n", \
> - #expr,__FILE__,__FUNCTION__,__LINE__); \
> - }
> +#define assert(expr)
> #endif
>
> #define RNG_MISCDEV_MINOR 183 /* official */
>
> 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,
> - loff_t * offp);
> + loff_t * offp);

seemingly bogus whitespace change


> static int __init intel_init (struct pci_dev *dev);
> static void intel_cleanup(void);
> @@ -322,7 +319,7 @@
> rnen |= (1 << 7); /* PMIO enable */
> 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;
>
> @@ -413,7 +410,8 @@
> * completes.
> */
> via_rng_datum = 0; /* paranoia, not really necessary */
> - bytes_out = xstore(&via_rng_datum, VIA_RNG_CHUNK_1) & VIA_XSTORE_CNT_MASK;
> + bytes_out = xstore(&via_rng_datum, VIA_RNG_CHUNK_1) &
> + VIA_XSTORE_CNT_MASK;

bogus whitespace change

2004-11-06 18:27:45

by Jim Nelson

[permalink] [raw]
Subject: Re: [PATCH] hw_random: Update printk()'s in hw_random.c

>> /*
>> * debugging macros
>> */
>> -#undef RNG_DEBUG /* define to enable copious debugging info */
>> +#undef DEBUG /* define to enable copious debugging info */
>
>
> I think the '#undef DEBUG' line is supposed to precede all the
> #includes, yes?
>
>

>> 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,
>> - loff_t * offp);
>> + loff_t * offp);
>
>
> seemingly bogus whitespace change
>
>

>> - bytes_out = xstore(&via_rng_datum, VIA_RNG_CHUNK_1) &
>> VIA_XSTORE_CNT_MASK;
>> + bytes_out = xstore(&via_rng_datum, VIA_RNG_CHUNK_1) &
>> + VIA_XSTORE_CNT_MASK;
>
>
> bogus whitespace change
> -


All right. I'll back out the whitespace changes and move the #undef to the top of
the #includes, and re-submit.