public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jim Cromie <jim.cromie@gmail.com>
To: Jim Cromie <jim.cromie@gmail.com>
Cc: Sergey Vlasov <vsu@altlinux.ru>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Samuel Tardieu <sam@rfc1149.net>,
	Evgeniy Polyakov <johnpol@2ka.mipt.ru>,
	linux-kernel@vger.kernel.org, lm-sensors@lm-sensors.org,
	Rudolf Marek <r.marek@sh.cvut.cz>
Subject: Re: [RFC-patch 0/3] SuperIO locks coordinator
Date: Thu, 14 Sep 2006 15:58:36 -0600	[thread overview]
Message-ID: <4509D08C.7020901@gmail.com> (raw)
In-Reply-To: <4508FF2F.5020504@gmail.com>

Jim Cromie wrote:

[ adding Rudolf Marek to cc, since he was kind enough to review the 
original patch ]
>
>
> Ive done limited testing, using the 2 drivers for my PC-87366 chip,
> to insure that I havent badly botched something, (I still may have ;)
> and looked at several of the hwmon drivers that operate superio ports.
> comments in code speak to those observations.
>
one of those observations, stated so they can be more easily reviewed 
(and refuted)

idle/activate IO-sequences:

Some SuperIO devices implement a pseudo-locking scheme which
turns off the port unless an activation-sequence is used 1st.
Once a port is 'idled', it will ignore access until it is re-activated
by doing a specific sequence of operations. 

Those sequences vary per-device, and generally would require a callback
to accomodate the variations.  This implies that all drivers for a 
superio device
would have to supply the (same) callbacks, with superio-locks remembering
only the 1st (they better all be the same anyway, so this by itself isnt 
a limitation).

w83627ehf.c:
static inline void superio_enter(void)
{
    outb(0x87, REG);
    outb(0x87, REG);
}
static inline void superio_exit(void)
{
    outb(0x02, REG);
    outb(0x02, VAL);
}

w83627hf.c differs from above !!!

static inline void superio_exit(void)
{
    outb(0xAA, REG);
}


The problem with these pseudo-locks is they dont really protect anyway;
if the sequences are used at all, every driver would have to unlock the 
chip b4 doing
anything else, and (I assume) activating an already active port will work,
allowing one driver to interfere with another.

I therefore redefined those functions: superio_enter/exit() now do 
mutex_lock/unlock()
on the reserved mutex.  Perhaps the API should have 
superio_lock/unlock() instead,
and leave superio_enter/exit() for drivers to implement themselves if 
they need/want it.


And let me be the 1st to throw a few rocks at my patches.

1- several devices in drivers/hwmon have 2-byte DEVICE_IDs,
and effectively have superio_inw(), (in both open-coded, and explicit 
forms).
My superio_get() cannot handle those devices.  I can fix it 'easily' by 
doing an inw()
if wanted devid>255, but that may be -ETOOHACKY

comments ?


  parent reply	other threads:[~2006-09-14 21:58 UTC|newest]

Thread overview: 37+ 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   ` Sergey Vlasov
2006-09-09 18:35     ` Samuel Tardieu
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     ` [RFC-patch 0/3] SuperIO locks coordinator (was: watchdog: add support for w83697hg chip) Jim Cromie
2006-09-14  7:13       ` [RFC-patch 1/3] SuperIO locks coordinator Jim Cromie
2006-09-17 17:23         ` Randy.Dunlap
2006-09-14  7:16       ` [RFC-patch 2/3] " Jim Cromie
2006-09-14  7:20       ` [RFC-patch 3/3] SuperIO locks coordinator - use in pc8736x_gpio Jim Cromie
2006-09-14 21:58       ` Jim Cromie [this message]
     [not found]         ` <4dfa50520609141753h34e54fdayba62f1b127d58036@mail.gmail.com>
     [not found]           ` <450A54EB.1020305@gmail.com>
     [not found]             ` <4dfa50520609151118s65a980b4td143a9fbbfeb1798@mail.gmail.com>
2006-09-16 17:17               ` [lm-sensors] [RFC-patch 0/3] SuperIO locks coordinator Jim Cromie
2006-09-19 13:11       ` Samuel Tardieu

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=4509D08C.7020901@gmail.com \
    --to=jim.cromie@gmail.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=johnpol@2ka.mipt.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lm-sensors@lm-sensors.org \
    --cc=r.marek@sh.cvut.cz \
    --cc=sam@rfc1149.net \
    --cc=vsu@altlinux.ru \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox