Skip to contentSkip to conversation

2.5.36 i2c new adapter i2c-pport driver]

PATCH New Albert Cranford 1 participant 1 message May 19, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 3/3 2.5.36 i2c new adapter i2c-pport driver]

Again, tried to submit i2c-pport.c but the usage of udelay(#) has to change to schedule_timeout(#).

I think this is going to affect lots of drivers and needs
converting before we will get sensors included into the
kernel.
Albert
-------- Original Message --------
Subject: Re: [patch 3/3] 2.5.36 i2c new adapter i2c-pport driver
Date: Wed, 18 Sep 2002 12:33:46 -0400
From: Jeff Garzik <[email protected]>
Organization: MandrakeSoft
To: Albert Cranford <[email protected]>
CC: Linus Torvalds <[email protected]>,Kernel mailing list <[email protected]>
References: <Pine.LNX.4.44.0209180205270.358-200000@home1>

Quoted 12 lines · Albert Cranford
(quoted diff) +12 -0
+static int bit_pport_init(void)
+{
+	if (!request_region((base+2),1, "i2c (PPORT adapter)")) {
+		return -ENODEV;	
+	} else {
+
+		/* test for PPORT adap. 	*/
+	
+
+		PortData=inb(base+2);
+		PortData= (PortData SET_SDA) SET_SCL;
+		outb(PortData,base+2);				

Review

Quoted 10 lines
(quoted diff) +10 -0
+
+		if (!(inb(base+2) | 0x06)) {	/* SDA and SCL will be high	*/
+			DEBINIT(printk("i2c-pport.o: SDA and SCL was low.\n"));
+			return -ENODEV;
+		} else {
+		
+			/*SCL high and SDA low*/
+			PortData = PortData SET_SCL CLR_SDA;
+			outb(PortData,base+2);	
+			udelay(400);

use schedule_timeout() instead of udelay() since you're in process context. otherwise, looks ok...