All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Fainelli <ffainelli-MmRyKUhfbQ9GWvitb5QawA@public.gmane.org>
To: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
Cc: Linux I2C <linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Florian Fainelli
	<ffainelli-MmRyKUhfbQ9GWvitb5QawA@public.gmane.org>
Subject: Re: [PATCH] i2c-tools: do not fail opening bus if /dev/i2c is not a directory
Date: Wed, 18 Aug 2010 14:45:14 +0200 (CEST)	[thread overview]
Message-ID: <57080007.49741282135514070.JavaMail.root@zimbra-corp-1-b7> (raw)
In-Reply-To: <20100818144329.50711481-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>

Hi Jean,

----- "Jean Delvare" <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org> a écrit :

> Hi Florian,
> 
> On Wed, 18 Aug 2010 14:33:50 +0200, Florian Fainelli wrote:
> > In case /dev/i2c is not a directory, open_i2c_dev will fail opening
> > /dev/i2c/<i2cbus> but only handles the ENOENT errno, while we should
> also
> > handle ENOTDIR errno because this is the returned error code. The
> patch
> > attached fixes the issue.
> 
> This is better discussed on the linux-i2c list. Redirecting...
> 
> > Signed-off-by: Florian Fainelli <ffainelli-MmRyKUhfbQ9GWvitb5QawA@public.gmane.org>
> > --
> > Index: tools/i2cbusses.c
> > ===================================================================
> > --- tools/.svn/text-base/i2cbusses.c.svn-base	2010-08-18
> 14:22:18.000000000 +0200
> > +++ /tmp/tempfile.2.tmp	2010-08-18 14:33:12.000000000 +0200
> 
> What a ugly header. How am I supposed to apply this?
> 
> > @@ -378,7 +378,7 @@
> >  	sprintf(filename, "/dev/i2c/%d", i2cbus);
> >  	file = open(filename, O_RDWR);
> >  
> > -	if (file < 0 && errno == ENOENT) {
> > +	if (file < 0 && (errno == ENOENT || errno == ENOTDIR)) {
> >  		sprintf(filename, "/dev/i2c-%d", i2cbus);
> >  		file = open(filename, O_RDWR);
> >  	}
> > 
> 
> I've never seen the case where /dev/i2c exists but isn't a directory
> (which is why that case isn't handled.) How did you get in this
> situation? It doesn't make much sense IMHO.

Well, I got another driver here living at /dev/i2c which I am slowly migrating, but I would like to have i2cdetect working anyway ;)

> 
> That being said, we can certainly apply your patch if it makes you
> happy, I don't see it as being terribly useful, but it also shouldn't
> hurt.

I would be glad if you apply it. Thanks!
--
Florian

      parent reply	other threads:[~2010-08-18 12:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-18 12:33 [lm-sensors] [PATCH] i2c-tools: do not fail opening bus if /dev/i2c Florian Fainelli
     [not found] ` <201008181433.50995.ffainelli-MmRyKUhfbQ9GWvitb5QawA@public.gmane.org>
2010-08-18 12:43   ` [PATCH] i2c-tools: do not fail opening bus if /dev/i2c is not a directory Jean Delvare
     [not found]     ` <20100818144329.50711481-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2010-08-18 12:45       ` Florian Fainelli [this message]

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=57080007.49741282135514070.JavaMail.root@zimbra-corp-1-b7 \
    --to=ffainelli-mmrykuhfbq9gwvitb5qawa@public.gmane.org \
    --cc=khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.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.