All of lore.kernel.org
 help / color / mirror / Atom feed
From: lutchann@litech.org (Nathan Lutchansky)
To: Jean Delvare <khali@linux-fr.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	LM Sensors <lm-sensors@lm-sensors.org>, Greg KH <greg@kroah.com>
Subject: [lm-sensors] Re: [PATCH 1/5] call i2c_probe from i2c core
Date: Tue, 16 Aug 2005 05:15:33 +0000	[thread overview]
Message-ID: <20050816031454.GH24959@litech.org> (raw)
In-Reply-To: <20050815235531.2a7d2bb6.khali@linux-fr.org>

On Mon, Aug 15, 2005 at 11:55:31PM +0200, Jean Delvare wrote:
> You should probably be using the --no-index option of quilt 0.42 (if you
> are using quilt as I presumed), as I heard Linus doesn't like these
> index lines in the patches he receives.

Ooh, thanks!

> >  	if (driver->flags & I2C_DF_NOTIFY) {
> >  		list_for_each(item,&adapters) {
> >  			adapter = list_entry(item, struct i2c_adapter, list);
> > -			driver->attach_adapter(adapter);
> > +			if (driver->attach_adapter)
> > +				driver->attach_adapter(adapter);
> > +			if (driver->detect_client && driver->address_data &&
> > +					((driver->class & adapter->class) ||
> > +						driver->class = 0))
> > +				i2c_probe(adapter, driver->address_data,
> > +						driver->detect_client);
> >  		}
> >  	}
> 
> Couldn't we check for the return value of driver->attach_adapter()? That
> way this function could conditionally prevent i2c_probe() from being
> run. This is just a random proposal, I don't know if some drivers would
> have an interest in doing that.

Yeah, I was thinking about that too, but I can't think of a reasonable
return code to use.  -1 for "don't probe"?  Or <0 for "fatal error,
don't touch this bus any more"?  Anyway, client drivers will probably
only use one of the two detection methods because if they need to
implement attach_adapter they can just call i2c_probe from there.

> Also, maybe we can put this new code in a separate function to be called
> from both i2c_add_adapter and i2c_add_driver, so as to not duplicate
> code? Or would this be too much overhead? It could be made inline then.
> Again, just a random thought.

Sure, I can do that.

> > --- linux-2.6.13-rc6+gregkh.orig/Documentation/i2c/writing-clients
> > +++ linux-2.6.13-rc6+gregkh/Documentation/i2c/writing-clients
> 
> Thanks for the documentation update. However, you didn't update
> i2c/porting-clients accordingly. Could you please?

I didn't think anybody was porting client drivers any more, but if
you're still updating that doc, I can too.  :-)  -Nathan

WARNING: multiple messages have this Message-ID (diff)
From: Nathan Lutchansky <lutchann@litech.org>
To: Jean Delvare <khali@linux-fr.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	LM Sensors <lm-sensors@lm-sensors.org>, Greg KH <greg@kroah.com>
Subject: Re: [PATCH 1/5] call i2c_probe from i2c core
Date: Mon, 15 Aug 2005 23:14:54 -0400	[thread overview]
Message-ID: <20050816031454.GH24959@litech.org> (raw)
In-Reply-To: <20050815235531.2a7d2bb6.khali@linux-fr.org>

On Mon, Aug 15, 2005 at 11:55:31PM +0200, Jean Delvare wrote:
> You should probably be using the --no-index option of quilt 0.42 (if you
> are using quilt as I presumed), as I heard Linus doesn't like these
> index lines in the patches he receives.

Ooh, thanks!

> >  	if (driver->flags & I2C_DF_NOTIFY) {
> >  		list_for_each(item,&adapters) {
> >  			adapter = list_entry(item, struct i2c_adapter, list);
> > -			driver->attach_adapter(adapter);
> > +			if (driver->attach_adapter)
> > +				driver->attach_adapter(adapter);
> > +			if (driver->detect_client && driver->address_data &&
> > +					((driver->class & adapter->class) ||
> > +						driver->class == 0))
> > +				i2c_probe(adapter, driver->address_data,
> > +						driver->detect_client);
> >  		}
> >  	}
> 
> Couldn't we check for the return value of driver->attach_adapter()? That
> way this function could conditionally prevent i2c_probe() from being
> run. This is just a random proposal, I don't know if some drivers would
> have an interest in doing that.

Yeah, I was thinking about that too, but I can't think of a reasonable
return code to use.  -1 for "don't probe"?  Or <0 for "fatal error,
don't touch this bus any more"?  Anyway, client drivers will probably
only use one of the two detection methods because if they need to
implement attach_adapter they can just call i2c_probe from there.

> Also, maybe we can put this new code in a separate function to be called
> from both i2c_add_adapter and i2c_add_driver, so as to not duplicate
> code? Or would this be too much overhead? It could be made inline then.
> Again, just a random thought.

Sure, I can do that.

> > --- linux-2.6.13-rc6+gregkh.orig/Documentation/i2c/writing-clients
> > +++ linux-2.6.13-rc6+gregkh/Documentation/i2c/writing-clients
> 
> Thanks for the documentation update. However, you didn't update
> i2c/porting-clients accordingly. Could you please?

I didn't think anybody was porting client drivers any more, but if
you're still updating that doc, I can too.  :-)  -Nathan

  reply	other threads:[~2005-08-16  5:15 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-15 17:51 [PATCH 0/5] improve i2c probing Nathan Lutchansky
2005-08-15 19:51 ` [lm-sensors] " Nathan Lutchansky
2005-08-15 17:52 ` [PATCH 1/5] call i2c_probe from i2c core Nathan Lutchansky
2005-08-15 19:53   ` [lm-sensors] " Nathan Lutchansky
2005-08-15 21:55   ` Jean Delvare
2005-08-15 23:55     ` [lm-sensors] " Jean Delvare
2005-08-16  3:14     ` Nathan Lutchansky [this message]
2005-08-16  5:15       ` Nathan Lutchansky
2005-08-16 12:13       ` Jean Delvare
2005-08-16 14:13         ` [lm-sensors] " Jean Delvare
2005-08-15 17:53 ` [PATCH 2/5] remove attach_adapter from i2c hwmon drivers Nathan Lutchansky
2005-08-15 19:54   ` [lm-sensors] [PATCH 2/5] remove attach_adapter from i2c hwmon Nathan Lutchansky
2005-08-15 22:00   ` [PATCH 2/5] remove attach_adapter from i2c hwmon drivers Jean Delvare
2005-08-16  0:00     ` [lm-sensors] Re: [PATCH 2/5] remove attach_adapter from i2c hwmon Jean Delvare
2005-08-15 17:54 ` [PATCH 3/5] remove attach_adapter from misc i2c chip drivers Nathan Lutchansky
2005-08-15 19:54   ` [lm-sensors] [PATCH 3/5] remove attach_adapter from misc i2c chip Nathan Lutchansky
2005-08-15 17:54 ` [PATCH 4/5] add i2c_probe_device and i2c_remove_device Nathan Lutchansky
2005-08-15 19:55   ` [lm-sensors] " Nathan Lutchansky
2005-08-15 22:14   ` Jean Delvare
2005-08-16  0:14     ` [lm-sensors] Re: [PATCH 4/5] add i2c_probe_device and Jean Delvare
2005-08-16  3:33     ` [PATCH 4/5] add i2c_probe_device and i2c_remove_device Nathan Lutchansky
2005-08-16  5:34       ` [lm-sensors] Re: [PATCH 4/5] add i2c_probe_device and Nathan Lutchansky
2005-08-16 16:38       ` [PATCH 4/5] add i2c_probe_device and i2c_remove_device Jean Delvare
2005-08-16 18:38         ` [lm-sensors] Re: [PATCH 4/5] add i2c_probe_device and Jean Delvare
2005-08-15 17:55 ` [PATCH 5/5] new flag to disable i2c probing for an adapter Nathan Lutchansky
2005-08-15 19:55   ` [lm-sensors] [PATCH 5/5] new flag to disable i2c probing for an Nathan Lutchansky
2005-08-15 21:39 ` [PATCH 0/5] improve i2c probing Jean Delvare
2005-08-16  9:43   ` [lm-sensors] " Jean Delvare
2005-08-16  3:05   ` Nathan Lutchansky
2005-08-16 10:01     ` [lm-sensors] " Nathan Lutchansky
2005-08-16 20:30     ` Jean Delvare
2005-08-16 22:30       ` [lm-sensors] " Jean Delvare
2005-08-18 18:54 ` Greg KH
2005-08-18 20:56   ` [lm-sensors] " Greg KH
2005-08-20  0:11   ` Nathan Lutchansky
2005-08-20  2:12     ` [lm-sensors] " Nathan Lutchansky

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=20050816031454.GH24959@litech.org \
    --to=lutchann@litech.org \
    --cc=greg@kroah.com \
    --cc=khali@linux-fr.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lm-sensors@lm-sensors.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.