aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl/pinctrl-sirf.c
diff options
context:
space:
mode:
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>2013-03-11 10:23:45 -0400
committerLinus Walleij <linus.walleij@linaro.org>2013-03-27 17:57:14 -0400
commit3dcbd6f5789839c7fea8841088ed3a28688f81ed (patch)
tree463f2aae5508ccf46cdb8b598992e87dbcf7c058 /drivers/pinctrl/pinctrl-sirf.c
parent22ce4464fad1c0a90ed5c9a745a1fceabf69283d (diff)
pinctrl: sirf: using for_each_set_bit to simplify the code
Using for_each_set_bit() to simplify the code. Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Acked-by: Barry Song <Baohua.Song@csr.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/pinctrl-sirf.c')
-rw-r--r--drivers/pinctrl/pinctrl-sirf.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/drivers/pinctrl/pinctrl-sirf.c b/drivers/pinctrl/pinctrl-sirf.c
index 0990a721758e..fb9062570745 100644
--- a/drivers/pinctrl/pinctrl-sirf.c
+++ b/drivers/pinctrl/pinctrl-sirf.c
@@ -1685,15 +1685,12 @@ static void sirfsoc_gpio_set_pullup(const u32 *pullups)
1685 const unsigned long *p = (const unsigned long *)pullups; 1685 const unsigned long *p = (const unsigned long *)pullups;
1686 1686
1687 for (i = 0; i < SIRFSOC_GPIO_NO_OF_BANKS; i++) { 1687 for (i = 0; i < SIRFSOC_GPIO_NO_OF_BANKS; i++) {
1688 n = find_first_bit(p + i, BITS_PER_LONG); 1688 for_each_set_bit(n, p + i, BITS_PER_LONG) {
1689 while (n < BITS_PER_LONG) {
1690 u32 offset = SIRFSOC_GPIO_CTRL(i, n); 1689 u32 offset = SIRFSOC_GPIO_CTRL(i, n);
1691 u32 val = readl(sgpio_bank[i].chip.regs + offset); 1690 u32 val = readl(sgpio_bank[i].chip.regs + offset);
1692 val |= SIRFSOC_GPIO_CTL_PULL_MASK; 1691 val |= SIRFSOC_GPIO_CTL_PULL_MASK;
1693 val |= SIRFSOC_GPIO_CTL_PULL_HIGH; 1692 val |= SIRFSOC_GPIO_CTL_PULL_HIGH;
1694 writel(val, sgpio_bank[i].chip.regs + offset); 1693 writel(val, sgpio_bank[i].chip.regs + offset);
1695
1696 n = find_next_bit(p + i, BITS_PER_LONG, n + 1);
1697 } 1694 }
1698 } 1695 }
1699} 1696}
@@ -1704,15 +1701,12 @@ static void sirfsoc_gpio_set_pulldown(const u32 *pulldowns)
1704 const unsigned long *p = (const unsigned long *)pulldowns; 1701 const unsigned long *p = (const unsigned long *)pulldowns;
1705 1702
1706 for (i = 0; i < SIRFSOC_GPIO_NO_OF_BANKS; i++) { 1703 for (i = 0; i < SIRFSOC_GPIO_NO_OF_BANKS; i++) {
1707 n = find_first_bit(p + i, BITS_PER_LONG); 1704 for_each_set_bit(n, p + i, BITS_PER_LONG) {
1708 while (n < BITS_PER_LONG) {
1709 u32 offset = SIRFSOC_GPIO_CTRL(i, n); 1705 u32 offset = SIRFSOC_GPIO_CTRL(i, n);
1710 u32 val = readl(sgpio_bank[i].chip.regs + offset); 1706 u32 val = readl(sgpio_bank[i].chip.regs + offset);
1711 val |= SIRFSOC_GPIO_CTL_PULL_MASK; 1707 val |= SIRFSOC_GPIO_CTL_PULL_MASK;
1712 val &= ~SIRFSOC_GPIO_CTL_PULL_HIGH; 1708 val &= ~SIRFSOC_GPIO_CTL_PULL_HIGH;
1713 writel(val, sgpio_bank[i].chip.regs + offset); 1709 writel(val, sgpio_bank[i].chip.regs + offset);
1714
1715 n = find_next_bit(p + i, BITS_PER_LONG, n + 1);
1716 } 1710 }
1717 } 1711 }
1718} 1712}