Skip to contentSkip to conversation

PATCH: cleanup printk and a 32/64bitism

PATCH Alan Cox 3 participants 3 messages Oct 21, 2005

Subsystems (2)
lore
Share & tools
lore

Alan Cox

author
#0 lore raw

Not sure if this board can exist with a 64bit CPU but if not then Kconfig wants fixing too.

- Fix various chaotic printks
- Remove the exclamation marks from every printk (!!!)
- Fix the 64/32bit pointer cast by removing the printing in question. The value is always NULL on that path anyway.

drivers/char/tlclk.c +7 -8
diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.14-rc4-mm1/drivers/char/tlclk.c linux-2.6.14-rc4-mm1/drivers/char/tlclk.c
@@ -210,7 +210,7 @@
 	result = request_irq(telclk_interrupt, &tlclk_interrupt,
 			     SA_INTERRUPT, "telco_clock", tlclk_interrupt);
 	if (result == -EBUSY) {
-		printk(KERN_ERR "telco_clock: Interrupt can't be reserved!\n");
+		printk(KERN_ERR "telco_clock: Interrupt can't be reserved.\n");
 		return -EBUSY;
 	}
 	inb(TLCLK_REG6);	/* Clear interrupt events */
@@ -740,7 +740,7 @@
 
 	ret = register_chrdev(tlclk_major, "telco_clock", &tlclk_fops);
 	if (ret < 0) {
-		printk(KERN_ERR "telco_clock: can't get major! %d\n", tlclk_major);
+		printk(KERN_ERR "tlclk: can't get major %d.\n", tlclk_major);
 		return ret;
 	}
 	alarm_events = kzalloc( sizeof(struct tlclk_alarms), GFP_KERNEL);
@@ -749,7 +749,7 @@
 
 	/* Read telecom clock IRQ number (Set by BIOS) */
 	if (!request_region(TLCLK_BASE, 8, "telco_clock")) {
-		printk(KERN_ERR "tlclk: request_region failed! 0x%X\n",
+		printk(KERN_ERR "tlclk: request_region 0x%X failed.\n",
 			TLCLK_BASE);
 		ret = -EBUSY;
 		goto out2;
@@ -757,7 +757,7 @@
 	telclk_interrupt = (inb(TLCLK_REG7) & 0x0f);
 
 	if (0x0F == telclk_interrupt ) { /* not MCPBL0010 ? */
-		printk(KERN_ERR "telclk_interrup = 0x%x non-mcpbl0010 hw\n",
+		printk(KERN_ERR "telclk_interrup = 0x%x non-mcpbl0010 hw.\n",
 			telclk_interrupt);
 		ret = -ENXIO;
 		goto out3;
@@ -767,7 +767,7 @@
 
 	ret = misc_register(&tlclk_miscdev);
 	if (ret < 0) {
-		printk(KERN_ERR " misc_register retruns %d\n", ret);
+		printk(KERN_ERR "tlclk: misc_register returns %d.\n", ret);
 		ret = -EBUSY;
 		goto out3;
 	}
@@ -775,8 +775,7 @@
 	tlclk_device = platform_device_register_simple("telco_clock",
 				-1, NULL, 0);
 	if (!tlclk_device) {
-		printk(KERN_ERR " platform_device_register retruns 0x%X\n",
-			(unsigned int) tlclk_device);
+		printk(KERN_ERR "tlclk: platform_device_register failed.\n");
 		ret = -EBUSY;
 		goto out4;
 	}
@@ -784,7 +783,7 @@
 	ret = sysfs_create_group(&tlclk_device->dev.kobj,
 			&tlclk_attribute_group);
 	if (ret) {
-		printk(KERN_ERR "failed to create sysfs device attributes\n");
+		printk(KERN_ERR "tlclk: failed to create sysfs device attributes.\n");
 		sysfs_remove_group(&tlclk_device->dev.kobj,
 			&tlclk_attribute_group);
 		goto out5;
#1 lore raw

drivers/char/tlclk.c line 773

Quoted 7 lines
drivers/char/tlclk.c +1 -1
 	ret = misc_register(&tlclk_miscdev);
 	if (ret < 0) {
-		printk(KERN_ERR " misc_register retruns %d\n", ret);
+		printk(KERN_ERR "tlclk: misc_register returns %d.\n", ret);
 		ret = -EBUSY;
 		goto out3;
 	}

Since you're getting nitpicky with this patch, then hopefully this correction is ok :)

	printk(KERN_ERR "tlclk: misc_register returned %d.\n", ret);
						    ^^
Signature · 4 lines
Ubuntu     - http://www.ubuntu.com/
Debian     - http://www.debian.org/
Linux 1394 - http://www.linux1394.org/
SwissDisk  - http://www.swissdisk.com/
#2 lore raw
In reply to Alan Cox
Quoted 70 lines · Alan Cox

Not sure if this board can exist with a 64bit CPU but if not then Kconfig wants fixing too.

- Fix various chaotic printks
- Remove the exclamation marks from every printk (!!!)
- Fix the 64/32bit pointer cast by removing the printing in question. The value is always NULL on that path anyway.

diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.14-rc4-mm1/drivers/char/tlclk.c linux-2.6.14-rc4-mm1/drivers/char/tlclk.c

drivers/char/tlclk.c 2005-10-20 17:44:53.000000000 +0100 renamed from drivers/char/tlclk.c 2005-10-20 16:12:39.000000000 +0100 +6 -7
@@ -210,7 +210,7 @@
  result = request_irq(telclk_interrupt, &tlclk_interrupt,
         SA_INTERRUPT, "telco_clock", tlclk_interrupt);
  if (result == -EBUSY) {
-  printk(KERN_ERR "telco_clock: Interrupt can't be reserved!\n");
+  printk(KERN_ERR "telco_clock: Interrupt can't be reserved.\n");
   return -EBUSY;
  }
  inb(TLCLK_REG6); /* Clear interrupt events */
@@ -740,7 +740,7 @@
 
  ret = register_chrdev(tlclk_major, "telco_clock", &tlclk_fops);
  if (ret < 0) {
-  printk(KERN_ERR "telco_clock: can't get major! %d\n", tlclk_major);
+  printk(KERN_ERR "tlclk: can't get major %d.\n", tlclk_major);
   return ret;
  }
  alarm_events = kzalloc( sizeof(struct tlclk_alarms), GFP_KERNEL);
@@ -749,7 +749,7 @@
 
  /* Read telecom clock IRQ number (Set by BIOS) */
  if (!request_region(TLCLK_BASE, 8, "telco_clock")) {
-  printk(KERN_ERR "tlclk: request_region failed! 0x%X\n",
+  printk(KERN_ERR "tlclk: request_region 0x%X failed.\n",
    TLCLK_BASE);
   ret = -EBUSY;
   goto out2;
@@ -757,7 +757,7 @@
  telclk_interrupt = (inb(TLCLK_REG7) & 0x0f);
 
  if (0x0F == telclk_interrupt ) { /* not MCPBL0010 ? */
-  printk(KERN_ERR "telclk_interrup = 0x%x non-mcpbl0010 hw\n",
+  printk(KERN_ERR "telclk_interrup = 0x%x non-mcpbl0010 hw.\n",
    telclk_interrupt);
   ret = -ENXIO;
   goto out3;
@@ -767,7 +767,7 @@
 
  ret = misc_register(&tlclk_miscdev);
  if (ret < 0) {
-  printk(KERN_ERR " misc_register retruns %d\n", ret);
+  printk(KERN_ERR "tlclk: misc_register returns %d.\n", ret);
   ret = -EBUSY;
   goto out3;
  }
@@ -775,8 +775,7 @@
  tlclk_device = platform_device_register_simple("telco_clock",
     -1, NULL, 0);
  if (!tlclk_device) {
-  printk(KERN_ERR " platform_device_register retruns 0x%X\n",
-   (unsigned int) tlclk_device);
+  printk(KERN_ERR "tlclk: platform_device_register failed.\n");
   ret = -EBUSY;
   goto out4;
  }

drivers/char/tlclk.c 2005-10-20 17:44:53.000000000 +0100 line 789

Quoted 8 lines
drivers/char/tlclk.c 2005-10-20 17:44:53.000000000 +0100 renamed from drivers/char/tlclk.c 2005-10-20 16:12:39.000000000 +0100 +1 -1
@@ -784,7 +783,7 @@
  ret = sysfs_create_group(&tlclk_device->dev.kobj,
    &tlclk_attribute_group);
  if (ret) {
-  printk(KERN_ERR "failed to create sysfs device attributes\n");
+  printk(KERN_ERR "tlclk: failed to create sysfs device attributes.\n");
   sysfs_remove_group(&tlclk_device->dev.kobj,
    &tlclk_attribute_group);
   goto out5;

Thanks, These are all good changes. I'm putting this into my code this AM.

This driver does need to work on x86_64 as well as i368. Thanks again.

thanks again.

Signature · 2 lines
--mgross
Intel Open Source Technology Center