All of lore.kernel.org
 help / color / mirror / Atom feed
From: khali@linux-fr.org (Jean Delvare)
To: lm-sensors@vger.kernel.org
Subject: [lm-sensors] [PATCH] W83627EHF driver update
Date: Wed, 14 Jun 2006 15:06:58 +0000	[thread overview]
Message-ID: <20060614170658.56cadfe9.khali@linux-fr.org> (raw)
In-Reply-To: <4485CB7A.9050209@sh.cvut.cz>

Hi Rudolf,

> > The name is not very well chosen, these registers can hold both a target
> > temperature or a target fan speed depending on the control mode (even
> > if we don't support the latter at the moment.) What about just
> > W83627EHF_REG_TARGET?
> 
> I think this is in the plan for future driver upgrade.

Let's get the name right now, so that this future driver upgrade
doesn't have to change it everywhere.

> > > +	struct i2c_client *client = to_i2c_client(dev);
> > > +	struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
> > > +	int nr = sensor_attr->index;
> > > +	u32 val = SENSORS_LIMIT(simple_strtoul(buf, NULL, 10), 0, 1);
> > 
> > Using SENSOR_LIMIT here doesn't make sense, as we're not dealing with a
> > range. Better return -EINVAL if value is neither 0 nor 1.
> 
> Well yes why not, maybe we should write a note to a docs?

I think the best we can do is to make it right in our drivers, because
this is where people look when writing new drivers. If you want to
extend the sysfs-interface documentation file to describe how invalid
values should be handled (on write), feel free to do so.

> > I just realized that you are emulating pwm_enable = 0. I guess the chip
> > doesn't support it? Then you don't want to implement it in the driver.
> > This emulation makes your code much more complex with no gain at all.
> > Drivers must implement what the chip support, they must NOT emulate
> > features.
> 
> On the other hand we want consistent interface... I thought that either the file
> could be present or not, but if present it MUST support 0 and 1 at least.
> 
> I think you told me that that -EINVAL should do it and I can revert the
> emulation stuff back. But I think we should FIX this in docs so it cannot be a
> matter of interpretation.

Patch welcome :)

> As for the conditional register writes. You just told me to save one read and
> you dont want the conditional writes? hmmm?

Saving one read in a safe way, in a function which will be called
hundreds of times in the driver lifetime, is worth it. Saving a write
in a function which will be called only a few times in the driver
lifetime, in an unsafe way, is not good.

> Many thanks for the review. As I already told you we need some kind of wiki page
> describing all those pitfalls so I can easily check the stuff and dont forget
> about anything..
> 
> Anyone will help me?

I think I already helped much by reviewing so much code in the past.
Everything I said there is a candidate for your page if you want to
write it.

-- 
Jean Delvare


  parent reply	other threads:[~2006-06-14 15:06 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-06 18:37 [lm-sensors] [PATCH] W83627EHF driver update Rudolf Marek
2006-06-06 21:02 ` David Hubbard
2006-06-07 10:29 ` Jim Cromie
2006-06-07 20:51 ` David Hubbard
2006-06-07 21:00 ` Rudolf Marek
2006-06-07 21:06 ` Rudolf Marek
2006-06-07 22:13 ` Sylvain Jeaugey
2006-06-08  1:01 ` David Hubbard
2006-06-08  7:51 ` Sylvain Jeaugey
2006-06-12 16:30 ` Jean Delvare
2006-06-12 23:12 ` David Hubbard
2006-06-13  8:53 ` Jean Delvare
2006-06-13 16:03 ` David Hubbard
2006-06-14 12:48 ` Rudolf Marek
2006-06-14 15:06 ` Jean Delvare [this message]
2006-06-14 15:14 ` Rudolf Marek
2006-06-14 15:50 ` Jean Delvare
2006-06-14 21:29 ` Rudolf Marek
2006-06-15 14:55 ` David Hubbard
2006-06-15 15:20 ` Sylvain Jeaugey
2006-06-16  4:29 ` David Hubbard
2006-06-16 21:33 ` Rudolf Marek
2006-06-19 15:53 ` David Hubbard
2006-06-20 12:41 ` Jean Delvare
2006-06-21 15:10 ` David Hubbard
2006-06-24 16:42 ` Rudolf Marek
2006-06-25 14:04 ` Jean Delvare
2006-06-25 16:00 ` Rudolf Marek
2006-06-26 19:33 ` Jean Delvare
2006-06-26 20:34 ` Rudolf Marek

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=20060614170658.56cadfe9.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.