All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/0] regmap: drop cache if the bus transfer error
@ 2016-08-18  9:01 Elaine Zhang
  2016-08-18  9:01 ` [PATCH 0/1] " Elaine Zhang
  2016-08-18  9:42 ` [PATCH 0/0] " Mark Brown
  0 siblings, 2 replies; 4+ messages in thread
From: Elaine Zhang @ 2016-08-18  9:01 UTC (permalink / raw)
  To: broonie; +Cc: huangtao, zyw, xxx, jay.xu, linux-kernel, Elaine Zhang

regmap_write
    ->_regmap_raw_write
    -->regcache_write first and than use map->bus->write to wirte i2c or spi
    But if the i2c or spi transfer failed, But the cache is updated, So if I use
    regmap_read will get the cache data which is not the real register value.

I think the regmap should handle that gracefully,
and may be my modify is not the best way.
But as I described is how to slove that problem.

Elaine Zhang (1):
  regmap: drop cache if the bus transfer error

 drivers/base/regmap/regmap.c | 2 ++
 1 file changed, 2 insertions(+)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 0/1] regmap: drop cache if the bus transfer error
  2016-08-18  9:01 [PATCH 0/0] regmap: drop cache if the bus transfer error Elaine Zhang
@ 2016-08-18  9:01 ` Elaine Zhang
  2016-08-18  9:42 ` [PATCH 0/0] " Mark Brown
  1 sibling, 0 replies; 4+ messages in thread
From: Elaine Zhang @ 2016-08-18  9:01 UTC (permalink / raw)
  To: broonie; +Cc: huangtao, zyw, xxx, jay.xu, linux-kernel, Elaine Zhang

regmap_write
->_regmap_raw_write
-->regcache_write first and than use map->bus->write to wirte i2c or spi
But if the i2c or spi transfer failed, But the cache is updated, So if I use
regmap_read will get the cache data which is not the real register value.

Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
---
 drivers/base/regmap/regmap.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 1f011f9d6dcb..369a4c3c933e 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -1497,6 +1497,8 @@ int _regmap_raw_write(struct regmap *map, unsigned int reg,
 		ret = map->bus->write(map->bus_context, buf, len);
 
 		kfree(buf);
+	} else if (ret != 0 && !map->cache_bypass && map->format.parse_val) {
+		regcache_drop_region(map, reg, reg + 1);
 	}
 
 	trace_regmap_hw_write_done(map, reg, val_len / map->format.val_bytes);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/0] regmap: drop cache if the bus transfer error
  2016-08-18  9:01 [PATCH 0/0] regmap: drop cache if the bus transfer error Elaine Zhang
  2016-08-18  9:01 ` [PATCH 0/1] " Elaine Zhang
@ 2016-08-18  9:42 ` Mark Brown
  1 sibling, 0 replies; 4+ messages in thread
From: Mark Brown @ 2016-08-18  9:42 UTC (permalink / raw)
  To: Elaine Zhang; +Cc: huangtao, zyw, xxx, jay.xu, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 657 bytes --]

On Thu, Aug 18, 2016 at 05:01:54PM +0800, Elaine Zhang wrote:
> regmap_write
>     ->_regmap_raw_write
>     -->regcache_write first and than use map->bus->write to wirte i2c or spi
>     But if the i2c or spi transfer failed, But the cache is updated, So if I use
>     regmap_read will get the cache data which is not the real register value.

Please don't send cover letters for single patches, if there is anything
that needs saying put it in the changelog of the patch or after the ---
if it's administrative stuff.  This reduces mail volume and ensures that 
any important information is recorded in the changelog rather than being
lost. 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 0/0] regmap: drop cache if the bus transfer error
@ 2016-08-18  6:43 Elaine Zhang
  0 siblings, 0 replies; 4+ messages in thread
From: Elaine Zhang @ 2016-08-18  6:43 UTC (permalink / raw)
  To: heiko; +Cc: huangtao, zyw, xxx, jay.xu, linux-kernel, Elaine Zhang

regmap_write
    ->_regmap_raw_write
    -->regcache_write first and than use map->bus->write to wirte i2c or spi
    But if the i2c or spi transfer failed, But the cache is updated, So if I use
    regmap_read will get the cache data which is not the real register value.

I think the regmap should handle that gracefully,
and may be my modify is not the best way.
But as I described is how to slove that problem.

Elaine Zhang (1):
  regmap: drop cache if the bus transfer error

 drivers/base/regmap/regmap.c | 2 ++
 1 file changed, 2 insertions(+)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-08-18  9:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-18  9:01 [PATCH 0/0] regmap: drop cache if the bus transfer error Elaine Zhang
2016-08-18  9:01 ` [PATCH 0/1] " Elaine Zhang
2016-08-18  9:42 ` [PATCH 0/0] " Mark Brown
  -- strict thread matches above, loose matches on Subject: below --
2016-08-18  6:43 Elaine Zhang

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.