소스 검색

[PATCH] i2c: Big i2c-elektor cleanup

Cleanups to the i2c-elektor driver:

* Set the i2c_adapter name field to "i2c-elektor" and use this string
  in all resource requests and printks.
* Change space-padding for tab indentation, kill trailing white space,
  remove space before comma.
* Use dev_info, pr_info and pr_debug instead of printk.
* Lines chopped to 80 columns.

Signed-off-by: Stig Telfer <stig@lizardlogic.co.uk>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Stig Telfer 19 년 전
부모
커밋
fe3d6a9978
1개의 변경된 파일45개의 추가작업 그리고 39개의 파일을 삭제
  1. 45 39
      drivers/i2c/busses/i2c-elektor.c

+ 45 - 39
drivers/i2c/busses/i2c-elektor.c

@@ -22,7 +22,7 @@
 /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even
 /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even
    Frodo Looijaard <frodol@dds.nl> */
    Frodo Looijaard <frodol@dds.nl> */
 
 
-/* Partialy rewriten by Oleg I. Vdovikin for mmapped support of 
+/* Partialy rewriten by Oleg I. Vdovikin for mmapped support of
    for Alpha Processor Inc. UP-2000(+) boards */
    for Alpha Processor Inc. UP-2000(+) boards */
 
 
 #include <linux/kernel.h>
 #include <linux/kernel.h>
@@ -53,7 +53,7 @@ static int clock  = 0x1c;
 static int own    = 0x55;
 static int own    = 0x55;
 static int mmapped;
 static int mmapped;
 
 
-/* vdovikin: removed static struct i2c_pcf_isa gpi; code - 
+/* vdovikin: removed static struct i2c_pcf_isa gpi; code -
   this module in real supports only one device, due to missing arguments
   this module in real supports only one device, due to missing arguments
   in some functions, called from the algo-pcf module. Sometimes it's
   in some functions, called from the algo-pcf module. Sometimes it's
   need to be rewriten - but for now just remove this for simpler reading */
   need to be rewriten - but for now just remove this for simpler reading */
@@ -62,6 +62,8 @@ static wait_queue_head_t pcf_wait;
 static int pcf_pending;
 static int pcf_pending;
 static spinlock_t lock;
 static spinlock_t lock;
 
 
+static struct i2c_adapter pcf_isa_ops;
+
 /* ----- local functions ----------------------------------------------	*/
 /* ----- local functions ----------------------------------------------	*/
 
 
 static void pcf_isa_setbyte(void *data, int ctl, int val)
 static void pcf_isa_setbyte(void *data, int ctl, int val)
@@ -73,7 +75,7 @@ static void pcf_isa_setbyte(void *data, int ctl, int val)
 		val |= I2C_PCF_ENI;
 		val |= I2C_PCF_ENI;
 	}
 	}
 
 
-	pr_debug("i2c-elektor: Write %p 0x%02X\n", address, val);
+	pr_debug("%s: Write %p 0x%02X\n", pcf_isa_ops.name, address, val);
 	iowrite8(val, address);
 	iowrite8(val, address);
 #ifdef __alpha__
 #ifdef __alpha__
 	/* API UP2000 needs some hardware fudging to make the write stick */
 	/* API UP2000 needs some hardware fudging to make the write stick */
@@ -86,7 +88,7 @@ static int pcf_isa_getbyte(void *data, int ctl)
 	u8 __iomem *address = ctl ? (base_iomem + 1) : base_iomem;
 	u8 __iomem *address = ctl ? (base_iomem + 1) : base_iomem;
 	int val = ioread8(address);
 	int val = ioread8(address);
 
 
-	pr_debug("i2c-elektor: Read %p 0x%02X\n", address, val);
+	pr_debug("%s: Read %p 0x%02X\n", pcf_isa_ops.name, address, val);
 	return (val);
 	return (val);
 }
 }
 
 
@@ -142,39 +144,40 @@ static int pcf_isa_init(void)
 {
 {
 	spin_lock_init(&lock);
 	spin_lock_init(&lock);
 	if (!mmapped) {
 	if (!mmapped) {
-		if (!request_region(base, 2, "i2c (isa bus adapter)")) {
-			printk(KERN_ERR
-			       "i2c-elektor: requested I/O region (0x%X:2) "
-			       "is in use.\n", base);
+		if (!request_region(base, 2, pcf_isa_ops.name)) {
+			printk(KERN_ERR "%s: requested I/O region (%#x:2) is "
+			       "in use\n", pcf_isa_ops.name, base);
 			return -ENODEV;
 			return -ENODEV;
 		}
 		}
 		base_iomem = ioport_map(base, 2);
 		base_iomem = ioport_map(base, 2);
 		if (!base_iomem) {
 		if (!base_iomem) {
-			printk(KERN_ERR "i2c-elektor: remap of I/O region "
-			       "%#x failed\n", base);
+			printk(KERN_ERR "%s: remap of I/O region %#x failed\n",
+			       pcf_isa_ops.name, base);
 			release_region(base, 2);
 			release_region(base, 2);
 			return -ENODEV;
 			return -ENODEV;
 		}
 		}
 	} else {
 	} else {
-		if (!request_mem_region(base, 2, "i2c-elektor")) {
-			printk(KERN_ERR "i2c-elektor: requested memory region "
-			       "(%#x:2) is in use\n", base);
+		if (!request_mem_region(base, 2, pcf_isa_ops.name)) {
+			printk(KERN_ERR "%s: requested memory region (%#x:2) "
+			       "is in use\n", pcf_isa_ops.name, base);
 			return -ENODEV;
 			return -ENODEV;
 		}
 		}
 		base_iomem = ioremap(base, 2);
 		base_iomem = ioremap(base, 2);
 		if (base_iomem == NULL) {
 		if (base_iomem == NULL) {
-			printk(KERN_ERR "i2c-elektor: remap of memory region "
-			       "%#x failed\n", base);
+			printk(KERN_ERR "%s: remap of memory region %#x "
+			       "failed\n", pcf_isa_ops.name, base);
 			release_mem_region(base, 2);
 			release_mem_region(base, 2);
 			return -ENODEV;
 			return -ENODEV;
 		}
 		}
 	}
 	}
-	pr_debug("i2c-elektor: registers %#x remapped to %p\n", base,
+	pr_debug("%s: registers %#x remapped to %p\n", pcf_isa_ops.name, base,
 		 base_iomem);
 		 base_iomem);
 
 
 	if (irq > 0) {
 	if (irq > 0) {
-		if (request_irq(irq, pcf_isa_handler, 0, "PCF8584", NULL) < 0) {
-			printk(KERN_ERR "i2c-elektor: Request irq%d failed\n", irq);
+		if (request_irq(irq, pcf_isa_handler, 0, pcf_isa_ops.name,
+				NULL) < 0) {
+			printk(KERN_ERR "%s: Request irq%d failed\n",
+			       pcf_isa_ops.name, irq);
 			irq = 0;
 			irq = 0;
 		} else
 		} else
 			enable_irq(irq);
 			enable_irq(irq);
@@ -202,45 +205,49 @@ static struct i2c_adapter pcf_isa_ops = {
 	.class		= I2C_CLASS_HWMON,
 	.class		= I2C_CLASS_HWMON,
 	.id		= I2C_HW_P_ELEK,
 	.id		= I2C_HW_P_ELEK,
 	.algo_data	= &pcf_isa_data,
 	.algo_data	= &pcf_isa_data,
-	.name		= "PCF8584 ISA adapter",
+	.name		= "i2c-elektor",
 };
 };
 
 
-static int __init i2c_pcfisa_init(void) 
+static int __init i2c_pcfisa_init(void)
 {
 {
 #ifdef __alpha__
 #ifdef __alpha__
-	/* check to see we have memory mapped PCF8584 connected to the 
+	/* check to see we have memory mapped PCF8584 connected to the
 	Cypress cy82c693 PCI-ISA bridge as on UP2000 board */
 	Cypress cy82c693 PCI-ISA bridge as on UP2000 board */
 	if (base == 0) {
 	if (base == 0) {
 		struct pci_dev *cy693_dev;
 		struct pci_dev *cy693_dev;
-		
-		cy693_dev = pci_get_device(PCI_VENDOR_ID_CONTAQ, 
+
+		cy693_dev = pci_get_device(PCI_VENDOR_ID_CONTAQ,
 					   PCI_DEVICE_ID_CONTAQ_82C693, NULL);
 					   PCI_DEVICE_ID_CONTAQ_82C693, NULL);
 		if (cy693_dev) {
 		if (cy693_dev) {
 			unsigned char config;
 			unsigned char config;
 			/* yeap, we've found cypress, let's check config */
 			/* yeap, we've found cypress, let's check config */
 			if (!pci_read_config_byte(cy693_dev, 0x47, &config)) {
 			if (!pci_read_config_byte(cy693_dev, 0x47, &config)) {
-				
-				pr_debug("i2c-elektor: found cy82c693, config register 0x47 = 0x%02x.\n", config);
+
+				pr_debug("%s: found cy82c693, config "
+					 "register 0x47 = 0x%02x\n",
+					 pcf_isa_ops.name, config);
 
 
 				/* UP2000 board has this register set to 0xe1,
 				/* UP2000 board has this register set to 0xe1,
-                                   but the most significant bit as seems can be 
+				   but the most significant bit as seems can be
 				   reset during the proper initialisation
 				   reset during the proper initialisation
-                                   sequence if guys from API decides to do that
-                                   (so, we can even enable Tsunami Pchip
-                                   window for the upper 1 Gb) */
+				   sequence if guys from API decides to do that
+				   (so, we can even enable Tsunami Pchip
+				   window for the upper 1 Gb) */
 
 
 				/* so just check for ROMCS at 0xe0000,
 				/* so just check for ROMCS at 0xe0000,
-                                   ROMCS enabled for writes
+				   ROMCS enabled for writes
 				   and external XD Bus buffer in use. */
 				   and external XD Bus buffer in use. */
 				if ((config & 0x7f) == 0x61) {
 				if ((config & 0x7f) == 0x61) {
 					/* seems to be UP2000 like board */
 					/* seems to be UP2000 like board */
 					base = 0xe0000;
 					base = 0xe0000;
 					mmapped = 1;
 					mmapped = 1;
-                                        /* UP2000 drives ISA with
+					/* UP2000 drives ISA with
 					   8.25 MHz (PCI/4) clock
 					   8.25 MHz (PCI/4) clock
 					   (this can be read from cypress) */
 					   (this can be read from cypress) */
 					clock = I2C_PCF_CLK | I2C_PCF_TRNS90;
 					clock = I2C_PCF_CLK | I2C_PCF_TRNS90;
-					printk(KERN_INFO "i2c-elektor: found API UP2000 like board, will probe PCF8584 later.\n");
+					pr_info("%s: found API UP2000 like "
+						"board, will probe PCF8584 "
+						"later\n", pcf_isa_ops.name);
 				}
 				}
 			}
 			}
 			pci_dev_put(cy693_dev);
 			pci_dev_put(cy693_dev);
@@ -250,12 +257,11 @@ static int __init i2c_pcfisa_init(void)
 
 
 	/* sanity checks for mmapped I/O */
 	/* sanity checks for mmapped I/O */
 	if (mmapped && base < 0xc8000) {
 	if (mmapped && base < 0xc8000) {
-		printk(KERN_ERR "i2c-elektor: incorrect base address (0x%0X) specified for mmapped I/O.\n", base);
+		printk(KERN_ERR "%s: incorrect base address (%#x) specified "
+		       "for mmapped I/O\n", pcf_isa_ops.name, base);
 		return -ENODEV;
 		return -ENODEV;
 	}
 	}
 
 
-	printk(KERN_INFO "i2c-elektor: i2c pcf8584-isa adapter driver\n");
-
 	if (base == 0) {
 	if (base == 0) {
 		base = DEFAULT_BASE;
 		base = DEFAULT_BASE;
 	}
 	}
@@ -265,8 +271,8 @@ static int __init i2c_pcfisa_init(void)
 		return -ENODEV;
 		return -ENODEV;
 	if (i2c_pcf_add_bus(&pcf_isa_ops) < 0)
 	if (i2c_pcf_add_bus(&pcf_isa_ops) < 0)
 		goto fail;
 		goto fail;
-	
-	printk(KERN_ERR "i2c-elektor: found device at %#x.\n", base);
+
+	dev_info(&pcf_isa_ops.dev, "found device at %#x\n", base);
 
 
 	return 0;
 	return 0;
 
 
@@ -278,7 +284,7 @@ static int __init i2c_pcfisa_init(void)
 
 
 	if (!mmapped) {
 	if (!mmapped) {
 		ioport_unmap(base_iomem);
 		ioport_unmap(base_iomem);
-		release_region(base , 2);
+		release_region(base, 2);
 	} else {
 	} else {
 		iounmap(base_iomem);
 		iounmap(base_iomem);
 		release_mem_region(base, 2);
 		release_mem_region(base, 2);
@@ -297,7 +303,7 @@ static void i2c_pcfisa_exit(void)
 
 
 	if (!mmapped) {
 	if (!mmapped) {
 		ioport_unmap(base_iomem);
 		ioport_unmap(base_iomem);
-		release_region(base , 2);
+		release_region(base, 2);
 	} else {
 	} else {
 		iounmap(base_iomem);
 		iounmap(base_iomem);
 		release_mem_region(base, 2);
 		release_mem_region(base, 2);