public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jean Delvare <khali@linux-fr.org>
To: Marcelo Tosatti <marcelo.tosatti@cyclades.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	LM Sensors <sensors@Stimpy.netroedge.com>
Subject: [PATCH 2.4] i2c cleanups, third wave (3/8)
Date: Sun, 11 Jan 2004 15:08:27 +0100	[thread overview]
Message-ID: <20040111150827.48b9a144.khali@linux-fr.org> (raw)
In-Reply-To: <20040111144214.7a6a4e59.khali@linux-fr.org>

Remove bus scanning from various algorithms (i2c-algo-bit, i2c-algo-ite,
i2c-algo-pcf and i2c-algo-sibyte). This was discussed on the LM Sensors
mailing list:
http://archives.andrew.net.au/lm-sensors/msg05639.html
Main reason is that there is the i2cdetect user-space tools for that,
which works with all i2c busses (except i2c-isa) and does a better job.

A similar patch was sent to Greg KH for linux 2.6 and was applied in
2.6.1-rc1.

Note that this patch was voluntarily generated using diff -U2, because
it contains only removals, so much context isn't required.


diff -U2 -rN linux-2.4.24-pre3-k1/drivers/i2c/i2c-algo-bit.c linux-2.4.24-pre3-k2/drivers/i2c/i2c-algo-bit.c
--- linux-2.4.24-pre3-k1/drivers/i2c/i2c-algo-bit.c	2004-01-05 09:44:26.000000000 +0100
+++ linux-2.4.24-pre3-k2/drivers/i2c/i2c-algo-bit.c	2004-01-05 15:22:54.000000000 +0100
@@ -51,5 +51,4 @@
 static int i2c_debug;
 static int bit_test;	/* see if the line-setting functions work	*/
-static int bit_scan;	/* have a look at what's hanging 'round		*/
 
 /* --- setting states on the bus with the right timing: ---------------	*/
@@ -527,5 +526,4 @@
 int i2c_bit_add_bus(struct i2c_adapter *adap)
 {
-	int i;
 	struct i2c_algo_bit_data *bit_adap = adap->algo_data;
 
@@ -547,21 +545,4 @@
 	adap->retries = 3;	/* be replaced by defines	*/
 
-	/* scan bus */
-	if (bit_scan) {
-		int ack;
-		printk(KERN_INFO " i2c-algo-bit.o: scanning bus %s.\n",
-		       adap->name);
-		for (i = 0x00; i < 0xff; i+=2) {
-			i2c_start(bit_adap);
-			ack = i2c_outb(adap,i);
-			i2c_stop(bit_adap);
-			if (ack>0) {
-				printk("(%02x)",i>>1); 
-			} else 
-				printk("."); 
-		}
-		printk("\n");
-	}
-
 #ifdef MODULE
 	MOD_INC_USE_COUNT;
@@ -605,9 +586,7 @@
 
 MODULE_PARM(bit_test, "i");
-MODULE_PARM(bit_scan, "i");
 MODULE_PARM(i2c_debug,"i");
 
 MODULE_PARM_DESC(bit_test, "Test the lines of the bus to see if it is stuck");
-MODULE_PARM_DESC(bit_scan, "Scan for active chips on the bus");
 MODULE_PARM_DESC(i2c_debug,
             "debug level - 0 off; 1 normal; 2,3 more verbose; 9 bit-protocol");
diff -U2 -rN linux-2.4.24-pre3-k1/drivers/i2c/i2c-algo-ite.c linux-2.4.24-pre3-k2/drivers/i2c/i2c-algo-ite.c
--- linux-2.4.24-pre3-k1/drivers/i2c/i2c-algo-ite.c	2004-01-05 09:43:53.000000000 +0100
+++ linux-2.4.24-pre3-k2/drivers/i2c/i2c-algo-ite.c	2004-01-06 11:56:13.000000000 +0100
@@ -68,5 +68,4 @@
 static int i2c_debug=1;
 static int iic_test=0;	/* see if the line-setting functions work	*/
-static int iic_scan=0;	/* have a look at what's hanging 'round		*/
 
 /* --- setting states on the bus with the right timing: ---------------	*/
@@ -745,6 +744,4 @@
 int i2c_iic_add_bus(struct i2c_adapter *adap)
 {
-	int i;
-	short status;
 	struct i2c_algo_iic_data *iic_adap = adap->algo_data;
 
@@ -774,22 +771,4 @@
 	iic_init(iic_adap);
 
-	/* scan bus */
-	/* By default scanning the bus is turned off. */
-	if (iic_scan) {
-		printk(KERN_INFO " i2c-algo-ite: scanning bus %s.\n",
-		       adap->name);
-		for (i = 0x00; i < 0xff; i+=2) {
-			iic_outw(iic_adap, ITE_I2CSAR, i);
-			iic_start(iic_adap);
-			if ( (wait_for_pin(iic_adap, &status) == 0) && 
-			    ((status & ITE_I2CHSR_DNE) == 0) ) { 
-				printk(KERN_INFO "\n(%02x)\n",i>>1); 
-			} else {
-				printk(KERN_INFO "."); 
-				iic_reset(iic_adap);
-			}
-			udelay(iic_adap->udelay);
-		}
-	}
 	return 0;
 }
@@ -834,9 +813,7 @@
 
 MODULE_PARM(iic_test, "i");
-MODULE_PARM(iic_scan, "i");
 MODULE_PARM(i2c_debug,"i");
 
 MODULE_PARM_DESC(iic_test, "Test if the I2C bus is available");
-MODULE_PARM_DESC(iic_scan, "Scan for active chips on the bus");
 MODULE_PARM_DESC(i2c_debug,
         "debug level - 0 off; 1 normal; 2,3 more verbose; 9 iic-protocol");
diff -U2 -rN linux-2.4.24-pre3-k1/drivers/i2c/i2c-algo-pcf.c linux-2.4.24-pre3-k2/drivers/i2c/i2c-algo-pcf.c
--- linux-2.4.24-pre3-k1/drivers/i2c/i2c-algo-pcf.c	2003-12-31 14:50:59.000000000 +0100
+++ linux-2.4.24-pre3-k2/drivers/i2c/i2c-algo-pcf.c	2004-01-06 12:01:10.000000000 +0100
@@ -53,5 +53,4 @@
  */
 static int i2c_debug=0;
-static int pcf_scan=0;	/* have a look at what's hanging 'round		*/
 
 /* --- setting states on the bus with the right timing: ---------------	*/
@@ -458,5 +457,5 @@
 int i2c_pcf_add_bus(struct i2c_adapter *adap)
 {
-	int i, status;
+	int i;
 	struct i2c_algo_pcf_data *pcf_adap = adap->algo_data;
 
@@ -481,28 +480,4 @@
 
 	i2c_add_adapter(adap);
-
-	/* scan bus */
-	if (pcf_scan) {
-		printk(KERN_INFO " i2c-algo-pcf.o: scanning bus %s.\n",
-		       adap->name);
-		for (i = 0x00; i < 0xff; i+=2) {
-			if (wait_for_bb(pcf_adap)) {
-    			printk(KERN_INFO " i2c-algo-pcf.o: scanning bus %s - TIMEOUTed.\n",
-		           adap->name);
-			    break;
-			}
-			i2c_outb(pcf_adap, i);
-			i2c_start(pcf_adap);
-			if ((wait_for_pin(pcf_adap, &status) >= 0) && 
-			    ((status & I2C_PCF_LRB) == 0)) { 
-				printk("(%02x)",i>>1); 
-			} else {
-				printk("."); 
-			}
-			i2c_stop(pcf_adap);
-			udelay(pcf_adap->udelay);
-		}
-		printk("\n");
-	}
 	return 0;
 }
@@ -537,12 +512,8 @@
 MODULE_LICENSE("GPL");
 
-MODULE_PARM(pcf_scan, "i");
 MODULE_PARM(i2c_debug,"i");
-
-MODULE_PARM_DESC(pcf_scan, "Scan for active chips on the bus");
 MODULE_PARM_DESC(i2c_debug,
         "debug level - 0 off; 1 normal; 2,3 more verbose; 9 pcf-protocol");
 
-
 int init_module(void) 
 {
diff -U2 -rN linux-2.4.24-pre3-k1/drivers/i2c/i2c-algo-sibyte.c linux-2.4.24-pre3-k2/drivers/i2c/i2c-algo-sibyte.c
--- linux-2.4.24-pre3-k1/drivers/i2c/i2c-algo-sibyte.c	2003-08-25 13:44:41.000000000 +0200
+++ linux-2.4.24-pre3-k2/drivers/i2c/i2c-algo-sibyte.c	2004-01-06 12:09:46.000000000 +0100
@@ -40,10 +40,5 @@
 #define SMB_CSR(a,r) ((long)(a->reg_base + r))
 
-/* ----- global variables ---------------------------------------------	*/
-
-/* module parameters:
- */
-static int bit_scan=0;	/* have a look at what's hanging 'round		*/
-
+/* ----- functions ---------------------------------------------------- */
 
 static int smbus_xfer(struct i2c_adapter *i2c_adap, u16 addr, 
@@ -152,5 +147,4 @@
 int i2c_sibyte_add_bus(struct i2c_adapter *i2c_adap, int speed)
 {
-	int i;
 	struct i2c_algo_sibyte_data *adap = i2c_adap->algo_data;
 
@@ -164,22 +158,4 @@
         csr_out32(0, SMB_CSR(adap,R_SMB_CONTROL));
 
-	/* scan bus */
-	if (bit_scan) {
-                union i2c_smbus_data data;
-                int rc;
-		printk(KERN_INFO " i2c-algo-sibyte.o: scanning bus %s.\n",
-		       i2c_adap->name);
-		for (i = 0x00; i < 0x7f; i++) {
-                        /* XXXKW is this a realistic probe? */
-                        rc = smbus_xfer(i2c_adap, i, 0, I2C_SMBUS_READ, 0,
-                                        I2C_SMBUS_BYTE_DATA, &data);
-			if (!rc) {
-				printk("(%02x)",i); 
-			} else 
-				printk("."); 
-		}
-		printk("\n");
-	}
-
 #ifdef MODULE
 	MOD_INC_USE_COUNT;
@@ -217,6 +193,4 @@
 MODULE_AUTHOR("Kip Walker, Broadcom Corp.");
 MODULE_DESCRIPTION("SiByte I2C-Bus algorithm");
-MODULE_PARM(bit_scan, "i");
-MODULE_PARM_DESC(bit_scan, "Scan for active chips on the bus");
 MODULE_LICENSE("GPL");
 

-- 
Jean Delvare
http://www.ensicaen.ismra.fr/~delvare/

  parent reply	other threads:[~2004-01-11 14:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-11 13:42 [PATCH 2.4] i2c cleanups, third wave Jean Delvare
2004-01-11 13:51 ` [PATCH 2.4] i2c cleanups, third wave (1/8) Jean Delvare
2004-01-11 13:59 ` [PATCH 2.4] i2c cleanups, third wave (2/8) Jean Delvare
2004-01-11 14:08 ` Jean Delvare [this message]
2004-01-11 14:50 ` [PATCH 2.4] i2c cleanups, third wave (4/8) Jean Delvare
2004-01-11 15:04 ` [PATCH 2.4] i2c cleanups, third wave (5/8) Jean Delvare
2004-01-11 15:10 ` [PATCH 2.4] i2c cleanups, third wave (6/8) Jean Delvare
2004-01-11 15:20 ` [PATCH 2.4] i2c cleanups, third wave (7/8) Jean Delvare
2004-01-11 15:28 ` [PATCH 2.4] i2c cleanups, third wave (8/8) Jean Delvare
2004-01-12  1:48 ` [PATCH 2.4] i2c cleanups, third wave Mike Fedyk
2004-01-14 18:30   ` Jean Delvare
2004-01-14 12:55 ` Marcelo Tosatti
2004-01-14 14:55   ` Jean Delvare

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040111150827.48b9a144.khali@linux-fr.org \
    --to=khali@linux-fr.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo.tosatti@cyclades.com \
    --cc=sensors@Stimpy.netroedge.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox