From: Markus Pargmann <mpa@pengutronix.de>
To: Mark Brown <broonie@kernel.org>
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
Jonathan Cameron <jic23@kernel.org>,
kernel@pengutronix.de,
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 09/20] regmap: _regmap_raw_write fix for busses without write()
Date: Wed, 12 Aug 2015 14:20:11 +0200 [thread overview]
Message-ID: <20150812122011.GE19600@pengutronix.de> (raw)
In-Reply-To: <20150812112035.GX10748@sirena.org.uk>
[-- Attachment #1: Type: text/plain, Size: 2114 bytes --]
On Wed, Aug 12, 2015 at 12:20:35PM +0100, Mark Brown wrote:
> On Wed, Aug 12, 2015 at 12:12:34PM +0200, Markus Pargmann wrote:
>
> > @@ -1229,6 +1229,11 @@ int _regmap_raw_write(struct regmap *map, unsigned int reg,
> > }
> > }
> >
> > + if (!map->bus->write && val_len == map->format.val_bytes) {
> > + ret = _regmap_bus_reg_write(map, reg, *(unsigned int *)val);
> > + return ret;
> > + }
>
> This is broken - you can't use a raw value as a register value. The
I am not sure what you mean here?
The register value given to _regmap_raw_write is the real register
value, not formatted differenty. This is given directly towards
bus->reg_write() which should handle the rest.
At least that's how I understood the code. For example regmap_read()
directly calls _regmap_read() which in turn calls directly
bus->reg_read() without any formating.
> endianness of the device may not be the same as the endianness of the
> system and you can't cast a value to unsigned int, the value may be of
> any size.
Yes right. On the other hand if bus->read() and bus->write() was not set
in the init method (before this patch series) no formatting functions at
all were assigned. So it was always ignored for bus->reg_read() and
bus->reg_write()?!
>
> > @@ -1340,7 +1345,7 @@ int _regmap_raw_write(struct regmap *map, unsigned int reg,
> > * send the work_buf directly, otherwise try to do a gather
> > * write.
> > */
> > - if (val == work_val) {
> > + if (val == work_val && map->bus->write) {
> > ret = map->bus->write(map->bus_context, map->work_buf,
> > map->format.reg_bytes +
> > map->format.pad_bytes +
>
> This appears to be another case of merging an unrelated change :(
Yes, will fix.
Thanks,
Markus
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: mpa@pengutronix.de (Markus Pargmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 09/20] regmap: _regmap_raw_write fix for busses without write()
Date: Wed, 12 Aug 2015 14:20:11 +0200 [thread overview]
Message-ID: <20150812122011.GE19600@pengutronix.de> (raw)
In-Reply-To: <20150812112035.GX10748@sirena.org.uk>
On Wed, Aug 12, 2015 at 12:20:35PM +0100, Mark Brown wrote:
> On Wed, Aug 12, 2015 at 12:12:34PM +0200, Markus Pargmann wrote:
>
> > @@ -1229,6 +1229,11 @@ int _regmap_raw_write(struct regmap *map, unsigned int reg,
> > }
> > }
> >
> > + if (!map->bus->write && val_len == map->format.val_bytes) {
> > + ret = _regmap_bus_reg_write(map, reg, *(unsigned int *)val);
> > + return ret;
> > + }
>
> This is broken - you can't use a raw value as a register value. The
I am not sure what you mean here?
The register value given to _regmap_raw_write is the real register
value, not formatted differenty. This is given directly towards
bus->reg_write() which should handle the rest.
At least that's how I understood the code. For example regmap_read()
directly calls _regmap_read() which in turn calls directly
bus->reg_read() without any formating.
> endianness of the device may not be the same as the endianness of the
> system and you can't cast a value to unsigned int, the value may be of
> any size.
Yes right. On the other hand if bus->read() and bus->write() was not set
in the init method (before this patch series) no formatting functions at
all were assigned. So it was always ignored for bus->reg_read() and
bus->reg_write()?!
>
> > @@ -1340,7 +1345,7 @@ int _regmap_raw_write(struct regmap *map, unsigned int reg,
> > * send the work_buf directly, otherwise try to do a gather
> > * write.
> > */
> > - if (val == work_val) {
> > + if (val == work_val && map->bus->write) {
> > ret = map->bus->write(map->bus_context, map->work_buf,
> > map->format.reg_bytes +
> > map->format.pad_bytes +
>
> This appears to be another case of merging an unrelated change :(
Yes, will fix.
Thanks,
Markus
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150812/ac1570c7/attachment-0001.sig>
next prev parent reply other threads:[~2015-08-12 12:20 UTC|newest]
Thread overview: 146+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-12 10:12 [PATCH 00/20] Regmap max_raw_io and bmc150 SPI support Markus Pargmann
2015-08-12 10:12 ` Markus Pargmann
2015-08-12 10:12 ` [PATCH 01/20] regmap: Add missing comments about struct regmap_bus Markus Pargmann
2015-08-12 10:12 ` Markus Pargmann
2015-08-12 20:12 ` Hartmut Knaack
2015-08-12 20:12 ` Hartmut Knaack
2015-08-17 7:19 ` Markus Pargmann
2015-08-17 7:19 ` Markus Pargmann
2015-08-12 10:12 ` [PATCH 02/20] regmap: Remove regmap_bulk_write 64bit support Markus Pargmann
2015-08-12 10:12 ` Markus Pargmann
2015-08-12 10:25 ` Mark Brown
2015-08-12 10:25 ` Mark Brown
2015-08-12 10:44 ` Markus Pargmann
2015-08-12 10:44 ` Markus Pargmann
2015-08-12 10:57 ` Mark Brown
2015-08-12 10:57 ` Mark Brown
2015-08-12 12:28 ` Markus Pargmann
2015-08-12 12:28 ` Markus Pargmann
2015-08-12 12:35 ` Mark Brown
2015-08-12 12:35 ` Mark Brown
2015-08-12 13:08 ` Markus Pargmann
2015-08-12 13:08 ` Markus Pargmann
2015-08-12 14:56 ` Mark Brown
2015-08-12 14:56 ` Mark Brown
2015-08-12 10:12 ` [PATCH 03/20] regmap: Fix integertypes for register address and value Markus Pargmann
2015-08-12 10:12 ` Markus Pargmann
2015-08-12 10:12 ` [PATCH 04/20] regmap: Do not skip format initialization Markus Pargmann
2015-08-12 10:12 ` Markus Pargmann
2015-08-12 10:43 ` Mark Brown
2015-08-12 10:43 ` Mark Brown
2015-08-12 10:12 ` [PATCH 05/20] regmap: Restructure writes in _regmap_raw_write() Markus Pargmann
2015-08-12 10:12 ` Markus Pargmann
2015-08-12 10:54 ` Mark Brown
2015-08-12 10:54 ` Mark Brown
2015-08-12 10:12 ` [PATCH 06/20] regmap: Fix regmap_bulk_write for bus writes Markus Pargmann
2015-08-12 10:12 ` Markus Pargmann
2015-08-12 11:10 ` Mark Brown
2015-08-12 11:10 ` Mark Brown
2015-08-12 12:07 ` Markus Pargmann
2015-08-12 12:07 ` Markus Pargmann
2015-08-12 10:12 ` [PATCH 07/20] regmap: Without bus read() or write(), force use_single_rw Markus Pargmann
2015-08-12 10:12 ` Markus Pargmann
2015-08-12 10:33 ` Daniel Kurtz
2015-08-12 10:33 ` Daniel Kurtz
2015-08-12 10:45 ` Markus Pargmann
2015-08-12 10:45 ` Markus Pargmann
2015-08-12 11:13 ` Mark Brown
2015-08-12 11:13 ` Mark Brown
2015-08-12 10:12 ` [PATCH 08/20] regmap: Fix regmap_can_raw_write check Markus Pargmann
2015-08-12 10:12 ` Markus Pargmann
2015-08-12 10:12 ` [PATCH 09/20] regmap: _regmap_raw_write fix for busses without write() Markus Pargmann
2015-08-12 10:12 ` Markus Pargmann
2015-08-12 11:20 ` Mark Brown
2015-08-12 11:20 ` Mark Brown
2015-08-12 12:20 ` Markus Pargmann [this message]
2015-08-12 12:20 ` Markus Pargmann
2015-08-12 12:34 ` Mark Brown
2015-08-12 12:34 ` Mark Brown
2015-08-12 13:05 ` Markus Pargmann
2015-08-12 13:05 ` Markus Pargmann
2015-08-14 16:40 ` Mark Brown
2015-08-14 16:40 ` Mark Brown
2015-08-12 10:12 ` [PATCH 10/20] regmap: _regmap_raw_multi_reg_write: Add reg_write() support Markus Pargmann
2015-08-12 10:12 ` Markus Pargmann
2015-08-12 12:39 ` Mark Brown
2015-08-12 12:39 ` Mark Brown
2015-08-12 13:17 ` Markus Pargmann
2015-08-12 13:17 ` Markus Pargmann
2015-08-12 10:12 ` [PATCH 11/20] regmap: _regmap_raw_read: Add handling of busses without bus->read() Markus Pargmann
2015-08-12 10:12 ` Markus Pargmann
2015-08-12 11:27 ` Mark Brown
2015-08-12 11:27 ` Mark Brown
2015-08-12 12:34 ` Markus Pargmann
2015-08-12 12:34 ` Markus Pargmann
2015-08-14 16:34 ` Mark Brown
2015-08-14 16:34 ` Mark Brown
2015-08-12 10:12 ` [PATCH 12/20] regmap: Introduce max_raw_io for regmap_bulk_read/write Markus Pargmann
2015-08-12 10:12 ` Markus Pargmann
2015-08-12 11:49 ` Mark Brown
2015-08-12 11:49 ` Mark Brown
2015-08-12 12:38 ` Markus Pargmann
2015-08-12 12:38 ` Markus Pargmann
2015-08-12 10:12 ` [PATCH 13/20] regmap: regmap max_raw_io getter function Markus Pargmann
2015-08-12 10:12 ` Markus Pargmann
2015-08-12 11:51 ` Mark Brown
2015-08-12 11:51 ` Mark Brown
2015-08-12 12:51 ` Markus Pargmann
2015-08-12 12:51 ` Markus Pargmann
2015-08-12 10:12 ` [PATCH 14/20] regmap: Add raw_write/read checks for max_raw_write/read sizes Markus Pargmann
2015-08-12 10:12 ` Markus Pargmann
2015-08-12 11:57 ` Mark Brown
2015-08-12 11:57 ` Mark Brown
2015-08-12 12:47 ` Markus Pargmann
2015-08-12 12:47 ` Markus Pargmann
2015-08-14 16:36 ` Mark Brown
2015-08-14 16:36 ` Mark Brown
2015-08-12 10:12 ` [PATCH 15/20] regmap-i2c: Add smbus i2c block support Markus Pargmann
2015-08-12 10:12 ` Markus Pargmann
2015-08-12 11:59 ` Mark Brown
2015-08-12 11:59 ` Mark Brown
2015-08-12 12:52 ` Markus Pargmann
2015-08-12 12:52 ` Markus Pargmann
2015-08-12 10:12 ` [PATCH 16/20] iio: bmc150: Fix irq checks Markus Pargmann
2015-08-12 10:12 ` Markus Pargmann
2015-08-15 13:13 ` Jonathan Cameron
2015-08-15 13:13 ` Jonathan Cameron
2015-08-17 7:24 ` Markus Pargmann
2015-08-17 7:24 ` Markus Pargmann
2015-08-12 10:12 ` [PATCH 17/20] iio: bmc150: Use i2c regmap Markus Pargmann
2015-08-12 10:12 ` Markus Pargmann
2015-08-12 12:01 ` Mark Brown
2015-08-12 12:01 ` Mark Brown
2015-08-12 12:52 ` Markus Pargmann
2015-08-12 12:52 ` Markus Pargmann
2015-08-15 13:27 ` Jonathan Cameron
2015-08-15 13:27 ` Jonathan Cameron
2015-08-17 7:49 ` Markus Pargmann
2015-08-17 7:49 ` Markus Pargmann
2015-08-12 10:12 ` [PATCH 18/20] iio: bcm150: Remove i2c_client from private data Markus Pargmann
2015-08-12 10:12 ` Markus Pargmann
2015-08-15 13:33 ` Jonathan Cameron
2015-08-15 13:33 ` Jonathan Cameron
2015-08-17 7:57 ` Markus Pargmann
2015-08-17 7:57 ` Markus Pargmann
2015-08-12 10:12 ` [PATCH 19/20] iio: bmc150: Split the driver into core and i2c Markus Pargmann
2015-08-12 10:12 ` Markus Pargmann
2015-08-15 13:41 ` Jonathan Cameron
2015-08-15 13:41 ` Jonathan Cameron
2015-08-17 7:59 ` Markus Pargmann
2015-08-17 7:59 ` Markus Pargmann
2015-08-12 10:12 ` [PATCH 20/20] iio: bmc150: Add SPI driver Markus Pargmann
2015-08-12 10:12 ` Markus Pargmann
2015-08-12 12:03 ` Mark Brown
2015-08-12 12:03 ` Mark Brown
2015-08-17 8:00 ` Markus Pargmann
2015-08-17 8:00 ` Markus Pargmann
2015-08-15 13:47 ` Jonathan Cameron
2015-08-15 13:47 ` Jonathan Cameron
2015-08-17 8:03 ` Markus Pargmann
2015-08-17 8:03 ` Markus Pargmann
2015-08-12 10:37 ` [PATCH 00/20] Regmap max_raw_io and bmc150 SPI support Mark Brown
2015-08-12 10:37 ` Mark Brown
2015-08-12 10:47 ` Markus Pargmann
2015-08-12 10:47 ` Markus Pargmann
2015-08-14 16:34 ` Mark Brown
2015-08-14 16:34 ` Mark Brown
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=20150812122011.GE19600@pengutronix.de \
--to=mpa@pengutronix.de \
--cc=broonie@kernel.org \
--cc=jic23@kernel.org \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=srinivas.pandruvada@linux.intel.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 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.