All of lore.kernel.org
 help / color / mirror / Atom feed
From: yani.ioannou@gmail.com (Yani Ioannou)
To: lm-sensors@vger.kernel.org
Subject: [lm-sensors] Re: [patch] pc87360 de-macro and code shrink
Date: Thu, 04 Aug 2005 05:32:21 +0000	[thread overview]
Message-ID: <2538186705080320316e6e8b80@mail.gmail.com> (raw)
In-Reply-To: <42E87A0F.8060709@divsol.com>

On 8/3/05, Jim Cromie <jcromie@divsol.com> wrote:
> IIUC, the 'much better' is passing a *dev-attr,
> doing to_sensor_dev_attr() on it to get the full SDA
> in a typesafe manner, then using whatever new members
> you have added (ex index, and for sda2, nr also)
> 
> or have I missed something ?

Well the change affects more than sensors of course, and there is a
lot of code other places in the kernel with the same problem (and not
just for device_attribute), so I expect to see other structs out there
like sensor_device_attribute, but yes basically :-). Its much less
error prone than a void * as you say because of it's typesafe manner,
and doesn't require us to add anything to the sysfs attribute struct
itself.

> just to follow up,  rc4-mm1 has
> 
> struct sensor_device_attribute{
>         struct device_attribute dev_attr;
>         int index;
> };
> struct sensor_device_attribute_2 {
>         struct device_attribute dev_attr;
>         u8 index;
>         u8 nr;
> };

I never noticed that, looks like it originated in this patch:
http://lists.lm-sensors.org/pipermail/lm-sensors/2005-July/013104.html.

Is sensor_device_attribute_2 useful to enough drivers (>1) to justify
putting it in hwmon-sysfs? Otherwise maybe its better off just being
defined by that driver itself...
 
> Ive used the 1st sda in my latest patch-set, are these structs 'stable' ?
Is anything stable in the kernel? I don't expect it to disappear
anytime soon though.

> .index is still there, with more room than is useful for file-entries in
> a sysfs dir-node.
> Any reason not to shorten the index, to 'reserve' another short ?

Hmm..that's an interesting proposition, what is the limit for the
number of sysfs attributes in a directory? It certainly doesn't make
any sense to use an int if a short will suffice for even the maximum.

Yani

  parent reply	other threads:[~2005-08-04  5:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-28  8:27 [lm-sensors] [patch] pc87360 de-macro and code shrink Jim Cromie
2005-07-28 10:16 ` [lm-sensors] " Jean Delvare
2005-07-28 18:37 ` Yani Ioannou
2005-08-04  3:25 ` Jim Cromie
2005-08-04  5:32 ` Yani Ioannou [this message]
2005-08-04 22:03 ` Jean Delvare

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=2538186705080320316e6e8b80@mail.gmail.com \
    --to=yani.ioannou@gmail.com \
    --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.