All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rodolfo Giometti <giometti@enneenne.com>
To: lm-sensors@vger.kernel.org
Subject: Re: [lm-sensors] [PATCH] hwmon w83627hf: add mfd support.
Date: Fri, 18 Sep 2009 11:02:17 +0000	[thread overview]
Message-ID: <20090918110217.GP19578@gundam.enneenne.com> (raw)
In-Reply-To: <1252585810-5336-2-git-send-email-giometti@linux.it>


[-- Attachment #1.1: Type: text/plain, Size: 2942 bytes --]

On Thu, Sep 17, 2009 at 04:34:45PM +0200, Samuel Ortiz wrote:
> On Thu, Sep 17, 2009 at 03:34:50PM +0200, Jean Delvare wrote:
> 
> > > @@ -1532,37 +1381,39 @@ static int __devinit w83627thf_read_gpio5(struct platform_device *pdev)
> > >  	}
> > >  
> > >  	dev_info(&pdev->dev, "Reading VID from GPIO5\n");
> > > -	res = superio_inb(W83627THF_GPIO5_DR) & sel;
> > > +	res = superio_inb(sio_data, W83627THF_GPIO5_DR) & sel;
> > >  
> > >  exit:
> > > -	superio_exit();
> > > +	superio_exit(sio_data);
> > >  	return res;
> > >  }
> > 
> > This looks wrong. The whole point of the MFD infrastructure is to
> > control who is accessing the common registers. Here you let the hwmon
> > driver access the Super-I/O configuration registers without any kind of
> > synchronisation. What if another user of w83627hf-core does the same at
> > the same moment?
> > 
> > You need a way to protect common registers. You'll need a mutex, for
> > sure. Then you can either export this mutex and count on all "children"
> > drivers' cooperation to properly request and release it. Or you can
> > move all the code accessing the common registers into w83627hf-core,
> > and stop exporting the superio_* functions. I don't know if there is a
> > recommended practice for MFD drivers. Samuel?
> The recommended practice is definitely to have your register accessing
> routines defined from the MFD core. That's what all MFD drivers do.

Looking at chip's documentation I suppose I have to add a mutex and
then count on all "children" drivers' cooperation to properly request
and release the configuration register access. I cannot define
functions to manage such registers since a children may do several
reads/writes to complish its task.

> > > +	  This driver can also be built as a module.  If so, the module
> > > +	  will be called w83627hf-core.
> > > +
> > 
> > Shouldn't this option be selected automatically by the w83627hf (hwmon)
> > driver? Currently it is possible to select only the hwmon driver, but
> > that driver will never work because the required platform driver won't
> > be created. This is a problem for current users upgrading to a new
> > kernel, as CONFIG_MFD_W83627HF defaults to N.
> > 
> > But then again I don't know if there is already a policy regarding this
> > for MFD drivers. Samuel?
> If your subdevice driver is calling some of the MFD core routines, or if
> there's a platform dependency, then your subdevice driver (w83627hf in that
> case) Kconfig should depend on MFD_W83627HF.

Ok!

Thanks for your suggestions,

Rodolfo

-- 

GNU/Linux Solutions                  e-mail: giometti@enneenne.com
Linux Device Driver                          giometti@linux.it
Embedded Systems                     phone:  +39 349 2432127
UNIX programming                     skype:  rodolfo.giometti
Freelance ICT Italia - Consulente ICT Italia - www.consulenti-ict.it

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

[-- Attachment #2: Type: text/plain, Size: 153 bytes --]

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

  parent reply	other threads:[~2009-09-18 11:02 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-10 12:30 [lm-sensors] [PATCH] hwmon w83627hf: add mfd support Rodolfo Giometti
2009-09-10 12:56 ` Jean Delvare
2009-09-11  7:42 ` Rodolfo Giometti
2009-09-11 10:58 ` Samuel Ortiz
2009-09-11 15:07 ` Rodolfo Giometti
2009-09-15 11:38 ` Samuel Ortiz
2009-09-17 13:34 ` Jean Delvare
2009-09-17 13:51 ` Rodolfo Giometti
2009-09-17 13:57 ` Jean Delvare
2009-09-17 14:03 ` Rodolfo Giometti
2009-09-17 14:07 ` Jean Delvare
2009-09-17 14:34 ` Samuel Ortiz
2009-09-18  7:42 ` Jean Delvare
2009-09-18  8:01 ` Samuel Ortiz
2009-09-18 11:02 ` Rodolfo Giometti [this message]
2009-09-18 12:09 ` Rodolfo Giometti
2009-09-18 14:42 ` Samuel Ortiz
2009-09-18 14:49 ` Jean Delvare
2009-09-18 16:16 ` Jean Delvare
2009-09-20 23:48 ` Samuel Ortiz
2009-09-22  8:22 ` Rodolfo Giometti
2009-09-22  8:26 ` Rodolfo Giometti
2009-09-22  8:33 ` Rodolfo Giometti
2009-10-01 13:23 ` Jean Delvare
2009-10-01 13:53 ` Samuel Ortiz
2009-11-02 13:23 ` Jean Delvare
2009-11-03  8:17 ` Rodolfo Giometti
  -- strict thread matches above, loose matches on Subject: below --
2010-02-10 12:18 Rodolfo Giometti
2010-02-27 10:58 ` Jean Delvare
2011-09-22  9:11 ` Rodolfo Giometti

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=20090918110217.GP19578@gundam.enneenne.com \
    --to=giometti@enneenne.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.