From: <patrice.chotard.st@gmail.com>
To: <linux-kernel@vger.kernel.org>, Linus Walleij <linus.walleij@linaro.org>
Cc: Olivier Clergeaud <olivier.clergeaud@st.com>,
Lee Jones <lee.jones@linaro.org>,
Fabio Baltieri <fabio.baltieri@linaro.org>,
Patrice Chotard <patrice.chotard@st.com>
Subject: [PATCH v2 1/4] pinctrl: abx500: suppress hardcoded value
Date: Thu, 20 Jun 2013 16:05:42 +0200 [thread overview]
Message-ID: <1371737145-27662-2-git-send-email-patrice.chotard.st@gmail.com> (raw)
In-Reply-To: <1371737145-27662-1-git-send-email-patrice.chotard.st@gmail.com>
From: Patrice Chotard <patrice.chotard@st.com>
Replace hardcoded value by corresponding #define's.
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
---
drivers/pinctrl/pinctrl-abx500.c | 18 ++++++++++++++----
include/linux/mfd/abx500/ab8500-gpio.h | 5 +++++
2 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-abx500.c b/drivers/pinctrl/pinctrl-abx500.c
index caa7ab6..d1d42e7 100644
--- a/drivers/pinctrl/pinctrl-abx500.c
+++ b/drivers/pinctrl/pinctrl-abx500.c
@@ -264,12 +264,18 @@ static int abx500_gpio_direction_output(struct gpio_chip *chip,
int ret;
/* set direction as output */
- ret = abx500_gpio_set_bits(chip, AB8500_GPIO_DIR1_REG, offset, 1);
+ ret = abx500_gpio_set_bits(chip,
+ AB8500_GPIO_DIR1_REG,
+ offset,
+ ABX500_GPIO_OUTPUT);
if (ret < 0)
return ret;
/* disable pull down */
- ret = abx500_gpio_set_bits(chip, AB8500_GPIO_PUD1_REG, offset, 1);
+ ret = abx500_gpio_set_bits(chip,
+ AB8500_GPIO_PUD1_REG,
+ offset,
+ ABX500_GPIO_PULL_NONE);
if (ret < 0)
return ret;
@@ -290,7 +296,10 @@ static int abx500_gpio_direction_output(struct gpio_chip *chip,
static int abx500_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
{
/* set the register as input */
- return abx500_gpio_set_bits(chip, AB8500_GPIO_DIR1_REG, offset, 0);
+ return abx500_gpio_set_bits(chip,
+ AB8500_GPIO_DIR1_REG,
+ offset,
+ ABX500_GPIO_INPUT);
}
static int abx500_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
@@ -1018,7 +1027,8 @@ static int abx500_pin_config_set(struct pinctrl_dev *pctldev,
else
/* Chip only supports pull down */
ret = abx500_gpio_set_bits(chip, AB8500_GPIO_PUD1_REG,
- offset, argument ? 0 : 1);
+ offset,
+ argument ? ABX500_GPIO_PULL_DOWN : ABX500_GPIO_PULL_NONE);
break;
case PIN_CONFIG_BIAS_PULL_UP:
diff --git a/include/linux/mfd/abx500/ab8500-gpio.h b/include/linux/mfd/abx500/ab8500-gpio.h
index 172b2f2..dafeca4 100644
--- a/include/linux/mfd/abx500/ab8500-gpio.h
+++ b/include/linux/mfd/abx500/ab8500-gpio.h
@@ -30,4 +30,9 @@ enum abx500_gpio_vinsel {
ABX500_GPIO_VINSEL_VDD_BIF = 0x2,
};
+enum abx500_gpio_direction {
+ ABX500_GPIO_INPUT = 0x0,
+ ABX500_GPIO_OUTPUT = 0x1,
+};
+
#endif /* _AB8500_GPIO_H */
--
1.7.10
next prev parent reply other threads:[~2013-06-20 14:06 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-20 14:05 [PATCH v2 0/4] pinctrl: ABX500: fix patrice.chotard.st
2013-06-20 14:05 ` patrice.chotard.st [this message]
2013-06-24 11:29 ` [PATCH v2 1/4] pinctrl: abx500: suppress hardcoded value Linus Walleij
2013-06-24 12:13 ` Patrice CHOTARD
2013-06-20 14:05 ` [PATCH v2 2/4] pinctrl: abx500: fix abx500_gpio_get() patrice.chotard.st
2013-06-24 11:32 ` Linus Walleij
2013-06-20 14:05 ` [PATCH v2 3/4] pinctrl: abx500: factorize code patrice.chotard.st
2013-06-24 11:34 ` Linus Walleij
2013-06-20 14:05 ` [PATCH v2 4/4] pinctrl: abx500: rework error path patrice.chotard.st
2013-06-24 11:37 ` Linus Walleij
2013-06-24 12:23 ` Patrice CHOTARD
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=1371737145-27662-2-git-send-email-patrice.chotard.st@gmail.com \
--to=patrice.chotard.st@gmail.com \
--cc=fabio.baltieri@linaro.org \
--cc=lee.jones@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=olivier.clergeaud@st.com \
--cc=patrice.chotard@st.com \
/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;
as well as URLs for NNTP newsgroup(s).