mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Grant Likely <grant.likely@secretlab.ca>
Cc: linux-kernel@vger.kernel.org, sodaville@linutronix.de
Subject: [PATCH 1/2] gpio/gpio-generic: read set register for caching if available
Date: Mon, 27 Jun 2011 09:26:22 +0200	[thread overview]
Message-ID: <1309159583-11339-1-git-send-email-bigeasy@linutronix.de> (raw)

The ->data is a shadow copy which is used during the ->set callback in
order to avoid a read of the register before write.
If ->reg_set is set then we write to this location therefore we should
cache that value.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 drivers/gpio/gpio-generic.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/gpio/gpio-generic.c b/drivers/gpio/gpio-generic.c
index 231714d..9f8b5c6 100644
--- a/drivers/gpio/gpio-generic.c
+++ b/drivers/gpio/gpio-generic.c
@@ -398,7 +398,10 @@ int __devinit bgpio_init(struct bgpio_chip *bgc,
 	if (ret)
 		return ret;
 
-	bgc->data = bgc->read_reg(bgc->reg_dat);
+	if (bgc->reg_set)
+		bgc->data = bgc->read_reg(bgc->reg_set);
+	else
+		bgc->data = bgc->read_reg(bgc->reg_dat);
 
 	return ret;
 }
-- 
1.7.4.4


             reply	other threads:[~2011-06-27  7:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-27  7:26 Sebastian Andrzej Siewior [this message]
2011-06-27  7:26 ` [PATCH v2 2/2] gpio: Add a driver for Sodaville GPIO controller Sebastian Andrzej Siewior
2011-06-27  9:33   ` Alan Cox
2011-06-27 10:34     ` Sebastian Andrzej Siewior
2011-07-04  7:26   ` [sodaville] " Sebastian Andrzej Siewior
2011-07-04 16:19   ` Grant Likely
2011-07-04 16:29     ` Sebastian Andrzej Siewior
2011-07-04 16:33       ` Grant Likely
2011-07-04 16:35         ` Grant Likely
2011-08-01 16:44           ` [sodaville] " Sebastian Andrzej Siewior
2011-07-04 15:44 ` [PATCH 1/2] gpio/gpio-generic: read set register for caching if available Grant Likely
2011-07-04 15:57   ` Sebastian Andrzej Siewior
2011-07-20  7:24   ` [PATCH 1/2 v2] gpio/gpio-generic: read correct " Sebastian Andrzej Siewior

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=1309159583-11339-1-git-send-email-bigeasy@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=grant.likely@secretlab.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sodaville@linutronix.de \
    /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

all inboxes | Powered by JetHome®