mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jeff Garzik <jgarzik@pobox.com>
To: Albert Cranford <ac9410@attbi.com>
Cc: Linus Torvalds <torvalds@transmeta.com>,
	Kernel mailing list <linux-kernel@vger.kernel.org>
Subject: Re: [patch] linux-2.5.38 new i2c parallel port adapter
Date: Tue, 24 Sep 2002 01:07:22 -0400	[thread overview]
Message-ID: <3D8FF30A.1060609@pobox.com> (raw)
In-Reply-To: <Pine.LNX.4.44.0209240044400.16117-200000@home1>

Albert Cranford wrote:
> +#define DEFAULT_BASE 0x378

surely there is a parport define for this?


> +static int base=0;
> +static unsigned char PortData = 0;

don't explicitly init to zero... you were told this before :)


> +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);				
> +
> +		if (!(inb(base+2) | 0x06)) {	/* SDA and SCL will be high	*/
> +			DEBINIT(printk("i2c-pport.o: SDA and SCL was low.\n"));
> +			return -ENODEV;

leak, no release_region


> +		} else {
> +		
> +			/*SCL high and SDA low*/
> +			PortData = PortData SET_SCL CLR_SDA;
> +			outb(PortData,base+2);	
> +			schedule_timeout(400);

ugly... use a constant based on HZ



> +			if ( !(inb(base+2) | 0x4) ) {
> +				//outb(0x04,base+2);
> +				DEBINIT(printk("i2c-port.o: SDA was high.\n"));
> +				return -ENODEV;

likewise


> +static void bit_pport_inc_use(struct i2c_adapter *adap)
> +{
> +#ifdef MODULE
> +	MOD_INC_USE_COUNT;
> +#endif
> +}
> +
> +static void bit_pport_dec_use(struct i2c_adapter *adap)
> +{
> +#ifdef MODULE
> +	MOD_DEC_USE_COUNT;
> +#endif
> +}

remove the ifdefs... you were told this too :)



> +int __init i2c_bitpport_init(void)
> +{
> +	printk("i2c-pport.o: i2c Primitive parallel port adapter module version %s (%s)\n", I2C_VERSION, I2C_DATE);
> +
> +	if (base==0) {
> +		/* probe some values */
> +		base=DEFAULT_BASE;
> +		bit_pport_data.data=(void*)DEFAULT_BASE;
> +		if (bit_pport_init()==0) {
> +			if(i2c_bit_add_bus(&bit_pport_ops) < 0)
> +				return -ENODEV;

bug, no release_region


> +		} else {
> +			return -ENODEV;
> +		}
> +	} else {
> +		bit_pport_data.data=(void*)base;
> +		if (bit_pport_init()==0) {
> +			if(i2c_bit_add_bus(&bit_pport_ops) < 0)
> +				return -ENODEV;

likewise



  reply	other threads:[~2002-09-24  5:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-24  4:45 Albert Cranford
2002-09-24  5:07 ` Jeff Garzik [this message]
2002-09-24  5:02   ` David S. Miller

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=3D8FF30A.1060609@pobox.com \
    --to=jgarzik@pobox.com \
    --cc=ac9410@attbi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.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

all inboxes | Powered by JetHome®