From 7803d9775835d08b4b2cf48582cb0250d3ce06e7 Mon Sep 17 00:00:00 2001 From: Daniel Kurtz Date: Wed, 15 Aug 2012 15:26:25 +0800 Subject: [PATCH] CHROMIUM: mfd: max77686: don't read when updating if mask is 0xff If an update is going to set all of the bits of a register, there is no reason to read its value first. Signed-off-by: Daniel Kurtz BUG=chrome-os-partner:10891 TEST=builds clean and snow boots; TEST=ftrace shows that most update_reg calls, when mask is 0xff, only cause a single i2c write Change-Id: I14270ba5f3ef6d060401a7c6c69b6f493a9f6588 Reviewed-on: https://gerrit.chromium.org/gerrit/30551 Reviewed-by: Doug Anderson Reviewed-by: Sonny Rao Reviewed-by: Olof Johansson Commit-Ready: Daniel Kurtz Reviewed-by: Daniel Kurtz Tested-by: Daniel Kurtz --- drivers/mfd/max77686.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/mfd/max77686.c b/drivers/mfd/max77686.c index 3a3c75f2e411..e78e2f9626aa 100644 --- a/drivers/mfd/max77686.c +++ b/drivers/mfd/max77686.c @@ -110,6 +110,9 @@ int max77686_update_reg(struct i2c_client *i2c, u8 reg, u8 val, u8 mask) struct max77686_dev *max77686 = i2c_get_clientdata(i2c); int ret; + if (mask == 0xff) + return max77686_write_reg(i2c, reg, val); + mutex_lock(&max77686->iolock); ret = i2c_smbus_read_byte_data(i2c, reg); if (ret >= 0) { -- 2.20.1