From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Eric Andersson <eric.andersson@unixphere.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org,
alan@lxorguk.ukuu.org.uk, zhengguang.guo@bosch-sensortec.com,
peter.moeller@cn.bosch.com,
Stefan Nilsson <stefan.nilsson@unixphere.com>
Subject: Re: [PATCHv2 2/3] misc: add support for bmp18x chips to the bmp085 driver
Date: Wed, 7 Mar 2012 00:03:21 +0000 [thread overview]
Message-ID: <20120307000320.GG19635@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <20120306221752.GB18235@skinner.xfiles.lan>
[-- Attachment #1: Type: text/plain, Size: 1944 bytes --]
On Tue, Mar 06, 2012 at 11:17:52PM +0100, Eric Andersson wrote:
> On 21:27 Tue 06 Mar , Arnd Bergmann wrote:
> > I don't know much about regmap, but your description sounds like you
> > should be using it here, to simplify the differences between i2c and
> > spi in your driver instead of implementing your own abstraction
> > layer.
regmap provides I2C and SPI register I/O for most devices using those
buses (and will do more buses in future I expect) and also provides
diagnostic (things like register I/O logging and register map dumps) and
optional cache infrastructure on top of that very cheaply (so you can
easily do things like avoid the read part of read/modify/write cycles or
restore the register state on resume). The win is partly getting the
infrastructure and partly the fact that all the code for formatting the
data for the bus is factored out from the individual driver, usually
there's a substantial code saving.
> > IMHO this would be better expressed if you make CONFIG_BMP085 a hidden
> > option that is selected when either BMP085_I2C or BMP085_SPI are enabled.
> > Otherwise you make it possible to build just the base driver but neither
> > of the front-ends, which is a bit pointless.
> This setup is inspired from other drivers such as ad525x_dpot.c and
> ad714x.c, which also have their own bus abstraction. If regmap is a more
> generic way of solving this I am all for it!
The idiom Arnd describes is the more normal one for the reasons he
mentions - see for example what most MFDs that have this problem do.
You'll need the same setup even with regmap since you'll need to
register I2C and SPI drivers. What you save is all the register I/O
code - often the I2C and SPI specific code gets reduced to just calling
regmap_init_X(). The regmap subsystem only appeared in 3.1 so lots of
drivers predate it and could benefit from using it, we're starting to
see conversions happening in some subsystems.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2012-03-07 0:03 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-06 21:08 [PATCHv2 0/3] Add support for bmp18x to bmp085 Eric Andersson
2012-03-06 21:08 ` [PATCHv2 1/3] misc: clean up bmp085 driver Eric Andersson
2012-03-06 21:20 ` Arnd Bergmann
2012-03-12 22:53 ` Eric Andersson
2012-03-13 12:04 ` Arnd Bergmann
2012-03-06 21:08 ` [PATCHv2 2/3] misc: add support for bmp18x chips to the " Eric Andersson
2012-03-06 21:27 ` Arnd Bergmann
2012-03-06 22:17 ` Eric Andersson
2012-03-07 0:03 ` Mark Brown [this message]
2012-03-06 21:08 ` [PATCHv2 3/3] misc: rename bmp085 to bmp18x Eric Andersson
2012-03-06 21:14 ` Arnd Bergmann
2012-03-06 21:37 ` Alan Cox
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=20120307000320.GG19635@opensource.wolfsonmicro.com \
--to=broonie@opensource.wolfsonmicro.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=arnd@arndb.de \
--cc=eric.andersson@unixphere.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peter.moeller@cn.bosch.com \
--cc=stefan.nilsson@unixphere.com \
--cc=zhengguang.guo@bosch-sensortec.com \
/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