From: khali@linux-fr.org (Jean Delvare)
To: lm-sensors@vger.kernel.org
Subject: [lm-sensors] Question on platform drivers
Date: Fri, 24 Feb 2006 22:01:25 +0000 [thread overview]
Message-ID: <20060224230125.5afbf92d.khali@linux-fr.org> (raw)
In-Reply-To: <191fb4ca0602191403u1392a3b4hc5d7b93720c57355@mail.gmail.com>
Hi Mark, Juerg,
On 2006-02-24, Mark M. Hoffman wrote:
> > Hmmm... I guess it's a libsensors bug - try this patch.
> >
> > Jean: comments?
> >
> > Index: lib/sysfs.c
> > =================================> > RCS file: /home/cvs/lm_sensors2/lib/sysfs.c,v
> > retrieving revision 1.4
> > diff -u -r1.4 sysfs.c
> > --- lib/sysfs.c 9 Jan 2006 19:55:18 -0000 1.4
> > +++ lib/sysfs.c 24 Feb 2006 05:23:58 -0000
> > @@ -171,7 +171,7 @@
> > int ret = 0;
> >
> > if (!(cls = sysfs_open_class("i2c-adapter"))) {
> > - ret = -SENSORS_ERR_PROC;
> > + /* not an error - sensors completely without I2C is
> > + possible */
> > goto exit0;
> > }
>
> Seems so. I could reproduce the bug yesterday evening by removing all i2c
> stuff from my kernel. I had never tried that before, because even on the
> system where I can use a totally i2c-free hardware monitoring driver
> (f71805f), I have other devices which use i2c (my DC10+ grabber).
>
> I did not send a patch yesterday as I first wanted to make sure it would
> work properly, and I was short of time for the additional tests. We need
> to make sure that nowhere in the libsensors code we assumed that at
> least one i2c adapter had been found. I'll look into it this evening.
Further investigations reveal that the patch above isn't sufficient. It
covers the case where no i2c driver at all is loaded, but fails again
is i2c-core is loaded but no bus driver is. It is also a bit too loose
with error checking in my opinion.
Here is the patch I have come up with. Juerg, please give it a try and
report. It works fine for me at least.
Index: lib/sysfs.c
=================================RCS file: /home/cvs/lm_sensors2/lib/sysfs.c,v
retrieving revision 1.4
diff -u -r1.4 sysfs.c
--- lib/sysfs.c 9 Jan 2006 19:55:18 -0000 1.4
+++ lib/sysfs.c 24 Feb 2006 22:49:09 -0000
@@ -22,6 +22,7 @@
#include <string.h>
#include <limits.h>
+#include <errno.h>
#include <sysfs/libsysfs.h>
#include "data.h"
#include "error.h"
@@ -171,12 +172,14 @@
int ret = 0;
if (!(cls = sysfs_open_class("i2c-adapter"))) {
- ret = -SENSORS_ERR_PROC;
+ if (errno && errno != ENOENT)
+ ret = -SENSORS_ERR_PROC;
goto exit0;
}
if (!(clsdevs = sysfs_get_class_devices(cls))) {
- ret = -SENSORS_ERR_PROC;
+ if (errno)
+ ret = -SENSORS_ERR_PROC;
goto exit1;
}
Thanks,
--
Jean Delvare
next prev parent reply other threads:[~2006-02-24 22:01 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-19 22:03 [lm-sensors] Question on platform drivers Juerg Haefliger
2006-02-19 22:12 ` Jean Delvare
2006-02-22 5:17 ` Juerg Haefliger
2006-02-22 8:37 ` Jean Delvare
2006-02-23 2:02 ` Juerg Haefliger
2006-02-24 4:31 ` Mark M. Hoffman
2006-02-24 8:21 ` Jean Delvare
2006-02-24 22:01 ` Jean Delvare [this message]
2006-02-25 15:27 ` Mark M. Hoffman
2006-02-25 19:27 ` Juerg Haefliger
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=20060224230125.5afbf92d.khali@linux-fr.org \
--to=khali@linux-fr.org \
--cc=lm-sensors@vger.kernel.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.