All of lore.kernel.org
 help / color / mirror / Atom feed
From: jim.cromie@gmail.com (Jim Cromie)
To: lm-sensors@vger.kernel.org
Subject: [lm-sensors] [RFC-patch 3/3] SuperIO locks coordinator - use in
Date: Tue, 26 Sep 2006 14:12:43 +0000	[thread overview]
Message-ID: <4519355B.3030801@gmail.com> (raw)
In-Reply-To: <450902B8.6040407@gmail.com>

David Hubbard wrote:
> Hi Jim,

hi David :-)
>
> This is a question about the w83627ehf driver, but it's nice and
> general, so I'm looking at the way you did the pc8736x_gpio driver.
> There's this line:
>
> static struct superio* gate;
>
> And the driver uses the global 'gate' to access the Super-I/O. Right
> now in the w83627ehf driver, there are several globals:
>
> /* The actual ISA address is read from Super-I/O configuration space */
> static unsigned short address;
>
> /*
> * Super-I/O constants and functions
> */
>
> static int REG;        /* The register to read/write */
> static int VAL;        /* The value to read/write */
>
those should go away I think, which is good.  The uppercase gives me 
heartburn.

>
> Later on in the file, there's another global:
>
> static struct i2c_driver w83627ehf_driver;
>
>
> Now, I'm not the most knowledgeable one about the I2C subsystem, but I
> believe that w83627ehf_driver is redeclared a little later with this:
>
> static struct i2c_driver w83627ehf_driver = {
>     .driver = {
>         .name    = "w83627ehf",
>     },
>     .attach_adapter    = w83627ehf_detect,
>     .detach_client    = w83627ehf_detach_client,
> };
>
>

I believe the 1st is a forward-decl, its there to make following refs to 
it work.
$ grep -n w83627ehf_driver drivers/hwmon/w83627ehf.c
784:static struct i2c_driver w83627ehf_driver;
816:                        w83627ehf_driver.driver.name)) {
831:    client->driver = &w83627ehf_driver;
904:static struct i2c_driver w83627ehf_driver = {
951:    return i2c_isa_add_driver(&w83627ehf_driver);
956:    i2c_isa_del_driver(&w83627ehf_driver);



> Jean mentioned that it might be a good idea to define .name at
> runtime, depending on whether a w83627ehf or a w83627dhg was detected.
> But the global stays, as part of the driver.
>
> In moving to a driver / device model, it's possible to put a struct
> superio inside struct w83627ehf_data, inside struct device, which is
> part of struct i2c_adapter. (If I understand the I2C structures...if
> not, I think this is on the right track.) While I'm at it, I can put
> unsigned short address in there too. Personally, I'd like to remove
> all the global variables. (But not the struct i2c_driver
> w83627ehf_driver, plus the sensor_device_attribute structs, because
> they are more like constants such as function callbacks.)
>
> So I'm sitting here thinking about it, and it seems it could be done
> that way. There are some parts I haven't worked out yet. Especially
> embedding struct superio inside struct device. Is that valid?
>
No.  struct superio contains the lock itself, which must be shared by all
drivers using that superio-port.  This precludes it being sucked into 
private data.

WRT the placement of the static struct superio *gate,
pc8736x_gpio uses the gate-> during runtime, and therefore in a bunch of 
functions.
In contrast, pc87360 needs the superio port only at initialization 
(__init pc87360_find)
so it has its gate-> as an automatic/stack variable, which is released

Regarding the i2c & hwmon device remodeling, Im in need of an LDD3 re-read,
and a careful read of some of the newer (platform) drivers, vt1211 forex.
I was kinda hoping to watch someone else convert their driver, and learn 
from their
mistakes rather than my own.

With Superio in the mix, my uncertainty goes up; maybe it too should 
formally be
added to platform_driver (or parhaps isa_driver).  Or maybe it should be 
a sub-class
(is that even possible ?)  Jean's been clear that he doesnt have the 
time to review it,
which complicates things a bit since hwmon has many superio users, and 
thus presents
a good context to evaluate superio-locks.

RERO (release early & often) suggests I push it to LKML, or (maybe 
KMentors 1st),
but Im not a great juggler, and Jean wants separate alarms next,
and RERO doesnt say release prematurely :-O
OTOH, the superio-locks API might survive a platform conversion unchanged.


> Hmmm,
> David
>

hth, and thanks,
jimc


  parent reply	other threads:[~2006-09-26 14:12 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-06 10:29 [PATCH] watchdog: add support for w83697hg chip Samuel Tardieu
2006-09-06 11:14 ` Pádraig Brady
2006-09-06 11:29   ` Samuel Tardieu
2006-09-06 11:49     ` Pádraig Brady
2006-09-06 12:07       ` Samuel Tardieu
2006-09-06 12:48         ` Pádraig Brady
2006-09-06 19:41         ` Wim Van Sebroeck
2006-09-07  9:57           ` Samuel Tardieu
2006-09-07 13:24             ` Pádraig Brady
2006-09-07 16:44             ` Samuel Tardieu
2006-09-08  9:16               ` Pádraig Brady
2006-09-08  9:49                 ` Samuel Tardieu
2006-09-07 17:26   ` Jim Cromie
2006-09-07 18:06     ` Samuel Tardieu
2006-09-08 12:22     ` Jean Delvare
2006-09-09 15:25 ` Alan Cox
2006-09-09 15:18   ` Samuel Tardieu
2006-09-09 15:33     ` Samuel Tardieu
2006-09-09 15:58     ` Alan Cox
2006-09-09 15:38       ` Samuel Tardieu
2006-09-09 16:28         ` Samuel Tardieu
2006-09-09 21:49           ` Alexey Dobriyan
2006-09-09 22:11             ` Samuel Tardieu
2006-09-09 22:27               ` Alexey Dobriyan
2006-09-09 18:02   ` [lm-sensors] " Sergey Vlasov
2006-09-09 18:02     ` Sergey Vlasov
2006-09-09 18:35     ` [lm-sensors] " Samuel Tardieu
2006-09-09 18:35       ` Samuel Tardieu
2006-09-11  5:50     ` [lm-sensors] " Evgeniy Polyakov
2006-09-11  5:50       ` Evgeniy Polyakov
2006-09-13 19:15     ` Wim Van Sebroeck
2006-09-14  7:15       ` Wim Van Sebroeck
2006-09-14  7:05     ` [lm-sensors] [RFC-patch 0/3] SuperIO locks coordinator (was: Jim Cromie
2006-09-14  7:05       ` [RFC-patch 0/3] SuperIO locks coordinator (was: watchdog: add support for w83697hg chip) Jim Cromie
2006-09-14  7:13       ` [lm-sensors] [RFC-patch 1/3] SuperIO locks coordinator Jim Cromie
2006-09-14  7:13         ` Jim Cromie
2006-09-17 17:23         ` [lm-sensors] " Randy.Dunlap
2006-09-17 17:23           ` Randy.Dunlap
2006-09-14  7:16       ` [lm-sensors] [RFC-patch 2/3] " Jim Cromie
2006-09-14  7:16         ` Jim Cromie
2006-09-14  7:20       ` [lm-sensors] [RFC-patch 3/3] SuperIO locks coordinator - use in Jim Cromie
2006-09-14  7:20         ` [RFC-patch 3/3] SuperIO locks coordinator - use in pc8736x_gpio Jim Cromie
2006-09-26  4:33         ` [lm-sensors] [RFC-patch 3/3] SuperIO locks coordinator - use in David Hubbard
2006-09-26 14:12         ` Jim Cromie [this message]
2006-09-14 21:58       ` [lm-sensors] [RFC-patch 0/3] SuperIO locks coordinator Jim Cromie
2006-09-14 21:58         ` Jim Cromie
2006-09-15  0:53       ` [lm-sensors] " David Hubbard
2006-09-15  7:23       ` Jim Cromie
2006-09-15 18:18       ` David Hubbard
2006-09-16 17:17         ` Jim Cromie
2006-09-16 17:17           ` Jim Cromie
2006-09-19 13:11       ` Samuel Tardieu
2006-09-19 13:11         ` Samuel Tardieu
  -- strict thread matches above, loose matches on Subject: below --
2006-11-19 20:46 [lm-sensors] [RFC-patch 3/3] SuperIO locks coordinator - use in 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=4519355B.3030801@gmail.com \
    --to=jim.cromie@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.