All of lore.kernel.org
 help / color / mirror / Atom feed
From: Axel Lin <axel.lin@ingics.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] gpio: stm32_gpio: Use clrsetbits_le32() at appropriate places
Date: Fri, 24 Apr 2015 16:09:33 +0800	[thread overview]
Message-ID: <1429862973.26579.1.camel@ingics.com> (raw)

Use clrsetbits_le32() to replace clrbits_le32() + setbits_le32().

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/gpio/stm32_gpio.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/drivers/gpio/stm32_gpio.c b/drivers/gpio/stm32_gpio.c
index d3497e9..76f7b1b 100644
--- a/drivers/gpio/stm32_gpio.c
+++ b/drivers/gpio/stm32_gpio.c
@@ -74,17 +74,10 @@ int stm32_gpio_config(const struct stm32_gpio_dsc *dsc,
 
 	i = dsc->pin * 2;
 
-	clrbits_le32(&gpio_regs->moder, (0x3 << i));
-	setbits_le32(&gpio_regs->moder, ctl->mode << i);
-
-	clrbits_le32(&gpio_regs->otyper, (0x3 << i));
-	setbits_le32(&gpio_regs->otyper, ctl->otype << i);
-
-	clrbits_le32(&gpio_regs->ospeedr, (0x3 << i));
-	setbits_le32(&gpio_regs->ospeedr, ctl->speed << i);
-
-	clrbits_le32(&gpio_regs->pupdr, (0x3 << i));
-	setbits_le32(&gpio_regs->pupdr, ctl->pupd << i);
+	clrsetbits_le32(&gpio_regs->moder, 0x3 << i, ctl->mode << i);
+	clrsetbits_le32(&gpio_regs->otyper, 0x3 << i, ctl->otype << i);
+	clrsetbits_le32(&gpio_regs->ospeedr, 0x3 << i, ctl->speed << i);
+	clrsetbits_le32(&gpio_regs->pupdr, 0x3 << i, ctl->pupd << i);
 
 	rv = 0;
 out:
-- 
2.1.0

                 reply	other threads:[~2015-04-24  8:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1429862973.26579.1.camel@ingics.com \
    --to=axel.lin@ingics.com \
    --cc=u-boot@lists.denx.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 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.