Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1206013

Re: [PATCH 09/20] regmap: _regmap_raw_write fix for busses without write()

From Markus Pargmann <mpa@pengutronix.de>
Newsgroups linux.kernel
Subject Re: [PATCH 09/20] regmap: _regmap_raw_write fix for busses without write()
Date 2015-08-12 14:30 +0200
Message-ID <pWDko-4hj-49@gated-at.bofh.it> (permalink)
References <pWBix-1oV-9@gated-at.bofh.it> <pWBse-1Ag-25@gated-at.bofh.it> <pWCoi-2VG-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

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 |

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/20] Regmap max_raw_io and bmc150 SPI support Markus Pargmann <mpa@pengutronix.de> - 2015-08-12 12:20 +0200
  [PATCH 17/20] iio: bmc150: Use i2c regmap Markus Pargmann <mpa@pengutronix.de> - 2015-08-12 12:20 +0200
    Re: [PATCH 17/20] iio: bmc150: Use i2c regmap Mark Brown <broonie@kernel.org> - 2015-08-12 14:10 +0200
      Re: [PATCH 17/20] iio: bmc150: Use i2c regmap Markus Pargmann <mpa@pengutronix.de> - 2015-08-12 15:00 +0200
    Re: [PATCH 17/20] iio: bmc150: Use i2c regmap Jonathan Cameron <jic23@kernel.org> - 2015-08-15 15:30 +0200
      Re: [PATCH 17/20] iio: bmc150: Use i2c regmap Markus Pargmann <mpa@pengutronix.de> - 2015-08-17 09:50 +0200
  [PATCH 15/20] regmap-i2c: Add smbus i2c block support Markus Pargmann <mpa@pengutronix.de> - 2015-08-12 12:20 +0200
    Re: [PATCH 15/20] regmap-i2c: Add smbus i2c block support Mark Brown <broonie@kernel.org> - 2015-08-12 14:00 +0200
      Re: [PATCH 15/20] regmap-i2c: Add smbus i2c block support Markus Pargmann <mpa@pengutronix.de> - 2015-08-12 15:00 +0200
  [PATCH 01/20] regmap: Add missing comments about struct regmap_bus Markus Pargmann <mpa@pengutronix.de> - 2015-08-12 12:30 +0200
    Re: [PATCH 01/20] regmap: Add missing comments about struct regmap_bus Hartmut Knaack <knaack.h@gmx.de> - 2015-08-12 22:20 +0200
      Re: [PATCH 01/20] regmap: Add missing comments about struct  regmap_bus Markus Pargmann <mpa@pengutronix.de> - 2015-08-17 09:20 +0200
  [PATCH 09/20] regmap: _regmap_raw_write fix for busses without write() Markus Pargmann <mpa@pengutronix.de> - 2015-08-12 12:30 +0200
    Re: [PATCH 09/20] regmap: _regmap_raw_write fix for busses without  write() Mark Brown <broonie@kernel.org> - 2015-08-12 13:30 +0200
      Re: [PATCH 09/20] regmap: _regmap_raw_write fix for busses without  write() Markus Pargmann <mpa@pengutronix.de> - 2015-08-12 14:30 +0200
        Re: [PATCH 09/20] regmap: _regmap_raw_write fix for busses without  write() Mark Brown <broonie@kernel.org> - 2015-08-12 14:40 +0200
          Re: [PATCH 09/20] regmap: _regmap_raw_write fix for busses without  write() Markus Pargmann <mpa@pengutronix.de> - 2015-08-12 15:10 +0200
            Re: [PATCH 09/20] regmap: _regmap_raw_write fix for busses without  write() Mark Brown <broonie@kernel.org> - 2015-08-15 04:20 +0200
  [PATCH 10/20] regmap: _regmap_raw_multi_reg_write: Add reg_write() support Markus Pargmann <mpa@pengutronix.de> - 2015-08-12 12:30 +0200
    Re: [PATCH 10/20] regmap: _regmap_raw_multi_reg_write: Add  reg_write() support Mark Brown <broonie@kernel.org> - 2015-08-12 14:50 +0200
      Re: [PATCH 10/20] regmap: _regmap_raw_multi_reg_write: Add  reg_write() support Markus Pargmann <mpa@pengutronix.de> - 2015-08-12 15:20 +0200
  [PATCH 08/20] regmap: Fix regmap_can_raw_write check Markus Pargmann <mpa@pengutronix.de> - 2015-08-12 12:30 +0200
  Re: [PATCH 00/20] Regmap max_raw_io and bmc150 SPI support Mark Brown <broonie@kernel.org> - 2015-08-12 12:40 +0200
    Re: [PATCH 00/20] Regmap max_raw_io and bmc150 SPI support Markus Pargmann <mpa@pengutronix.de> - 2015-08-12 12:50 +0200
      Re: [PATCH 00/20] Regmap max_raw_io and bmc150 SPI support Mark Brown <broonie@kernel.org> - 2015-08-15 04:20 +0200

csiph-web