2013-06-20 14:06:12

by Patrice Chotard

[permalink] [raw]
Subject: [PATCH v2 0/4] pinctrl: ABX500: fix

From: Patrice Chotard <[email protected]>

Patrice Chotard (4):
pinctrl: abx500: suppress hardcoded value
pinctrl: abx500: fix abx500_gpio_get()
pinctrl: abx500: factorize code
pinctrl: abx500: rework error path

drivers/pinctrl/pinctrl-abx500.c | 173 +++++++++++++++++++++++---------
include/linux/mfd/abx500/ab8500-gpio.h | 5 +
2 files changed, 132 insertions(+), 46 deletions(-)

--
1.7.10


2013-06-20 14:06:59

by Patrice Chotard

[permalink] [raw]
Subject: [PATCH v2 1/4] pinctrl: abx500: suppress hardcoded value

From: Patrice Chotard <[email protected]>

Replace hardcoded value by corresponding #define's.

Signed-off-by: Patrice Chotard <[email protected]>
---
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

2013-06-20 14:07:12

by Patrice Chotard

[permalink] [raw]
Subject: [PATCH v2 4/4] pinctrl: abx500: rework error path

From: Patrice Chotard <[email protected]>

At several places, return value was not tested
and error output was missing.

Signed-off-by: Patrice Chotard <[email protected]>
---
drivers/pinctrl/pinctrl-abx500.c | 114 +++++++++++++++++++++++++++++---------
1 file changed, 87 insertions(+), 27 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-abx500.c b/drivers/pinctrl/pinctrl-abx500.c
index f1ff701..2b1da8f 100644
--- a/drivers/pinctrl/pinctrl-abx500.c
+++ b/drivers/pinctrl/pinctrl-abx500.c
@@ -131,8 +131,8 @@ static int abx500_gpio_get_bit(struct gpio_chip *chip, u8 reg,

if (ret < 0)
dev_err(pct->dev,
- "%s read reg =%x, offset=%x failed\n",
- __func__, reg, offset);
+ "%s read reg =%x, offset=%x failed (%d)\n",
+ __func__, reg, offset, ret);

return ret;
}
@@ -148,7 +148,8 @@ static int abx500_gpio_set_bits(struct gpio_chip *chip, u8 reg,
ret = abx500_mask_and_set_register_interruptible(pct->dev,
AB8500_MISC, reg, BIT(pos), val << pos);
if (ret < 0)
- dev_err(pct->dev, "%s write failed\n", __func__);
+ dev_err(pct->dev, "%s write reg, %x offset %x failed (%d)\n",
+ __func__, reg, offset, ret);

return ret;
}
@@ -168,10 +169,8 @@ static int abx500_gpio_get(struct gpio_chip *chip, unsigned offset)

ret = abx500_gpio_get_bit(chip, AB8500_GPIO_DIR1_REG,
gpio_offset, &is_out);
- if (ret < 0) {
- dev_err(pct->dev, "%s failed\n", __func__);
- return ret;
- }
+ if (ret < 0)
+ goto out;

if (is_out)
ret = abx500_gpio_get_bit(chip, AB8500_GPIO_OUT1_REG,
@@ -179,8 +178,9 @@ static int abx500_gpio_get(struct gpio_chip *chip, unsigned offset)
else
ret = abx500_gpio_get_bit(chip, AB8500_GPIO_IN1_REG,
gpio_offset, &bit);
+out:
if (ret < 0) {
- dev_err(pct->dev, "%s failed\n", __func__);
+ dev_err(pct->dev, "%s failed (%d)\n", __func__, ret);
return ret;
}

@@ -194,7 +194,7 @@ static void abx500_gpio_set(struct gpio_chip *chip, unsigned offset, int val)

ret = abx500_gpio_set_bits(chip, AB8500_GPIO_OUT1_REG, offset, val);
if (ret < 0)
- dev_err(pct->dev, "%s write failed\n", __func__);
+ dev_err(pct->dev, "%s write failed (%d)\n", __func__, ret);
}

static int abx500_get_pull_updown(struct abx500_pinctrl *pct, int offset,
@@ -291,7 +291,7 @@ static int abx500_gpio_direction_output(struct gpio_chip *chip,
offset,
ABX500_GPIO_OUTPUT);
if (ret < 0)
- return ret;
+ goto out;

/* disable pull down */
ret = abx500_gpio_set_bits(chip,
@@ -299,7 +299,7 @@ static int abx500_gpio_direction_output(struct gpio_chip *chip,
offset,
ABX500_GPIO_PULL_NONE);
if (ret < 0)
- return ret;
+ goto out;

/* if supported, disable both pull down and pull up */
gpio = offset + 1;
@@ -307,8 +307,11 @@ static int abx500_gpio_direction_output(struct gpio_chip *chip,
ret = abx500_set_pull_updown(pct,
gpio,
ABX500_GPIO_PULL_NONE);
- if (ret < 0)
- return ret;
+ }
+out:
+ if (ret < 0) {
+ dev_err(pct->dev, "%s failed (%d)\n", __func__, ret);
+ return ret;
}

/* set the output as 1 or 0 */
@@ -406,10 +409,16 @@ static int abx500_set_mode(struct pinctrl_dev *pctldev, struct gpio_chip *chip,
if (af.alt_bit1 != UNUSED) {
ret = abx500_gpio_set_bits(chip, AB8500_GPIO_SEL1_REG,
offset, 0);
+ if (ret < 0)
+ goto out;
+
ret = abx500_gpio_set_bits(chip,
AB8500_GPIO_ALTFUN_REG,
af.alt_bit1,
!!(af.alta_val && BIT(0)));
+ if (ret < 0)
+ goto out;
+
if (af.alt_bit2 != UNUSED)
ret = abx500_gpio_set_bits(chip,
AB8500_GPIO_ALTFUN_REG,
@@ -423,8 +432,14 @@ static int abx500_set_mode(struct pinctrl_dev *pctldev, struct gpio_chip *chip,
case ABX500_ALT_B:
ret = abx500_gpio_set_bits(chip, AB8500_GPIO_SEL1_REG,
offset, 0);
+ if (ret < 0)
+ goto out;
+
ret = abx500_gpio_set_bits(chip, AB8500_GPIO_ALTFUN_REG,
af.alt_bit1, !!(af.altb_val && BIT(0)));
+ if (ret < 0)
+ goto out;
+
if (af.alt_bit2 != UNUSED)
ret = abx500_gpio_set_bits(chip,
AB8500_GPIO_ALTFUN_REG,
@@ -435,8 +450,14 @@ static int abx500_set_mode(struct pinctrl_dev *pctldev, struct gpio_chip *chip,
case ABX500_ALT_C:
ret = abx500_gpio_set_bits(chip, AB8500_GPIO_SEL1_REG,
offset, 0);
+ if (ret < 0)
+ goto out;
+
ret = abx500_gpio_set_bits(chip, AB8500_GPIO_ALTFUN_REG,
af.alt_bit2, !!(af.altc_val && BIT(0)));
+ if (ret < 0)
+ goto out;
+
ret = abx500_gpio_set_bits(chip, AB8500_GPIO_ALTFUN_REG,
af.alt_bit2, !!(af.altc_val && BIT(1)));
break;
@@ -446,11 +467,14 @@ static int abx500_set_mode(struct pinctrl_dev *pctldev, struct gpio_chip *chip,

return -EINVAL;
}
+out:
+ if (ret < 0)
+ dev_err(pct->dev, "%s failed (%d)\n", __func__, ret);

return ret;
}

-static u8 abx500_get_mode(struct pinctrl_dev *pctldev, struct gpio_chip *chip,
+static int abx500_get_mode(struct pinctrl_dev *pctldev, struct gpio_chip *chip,
unsigned gpio)
{
u8 mode;
@@ -461,6 +485,7 @@ static u8 abx500_get_mode(struct pinctrl_dev *pctldev, struct gpio_chip *chip,
struct alternate_functions af = pct->soc->alternate_functions[gpio];
/* on ABx5xx, there is no GPIO0, so adjust the offset */
unsigned offset = gpio - 1;
+ int ret;

/*
* if gpiosel_bit is set to unused,
@@ -470,8 +495,11 @@ static u8 abx500_get_mode(struct pinctrl_dev *pctldev, struct gpio_chip *chip,
return ABX500_DEFAULT;

/* read GpioSelx register */
- abx500_gpio_get_bit(chip, AB8500_GPIO_SEL1_REG + (offset / 8),
+ ret = abx500_gpio_get_bit(chip, AB8500_GPIO_SEL1_REG + (offset / 8),
af.gpiosel_bit, &bit_mode);
+ if (ret < 0)
+ goto out;
+
mode = bit_mode;

/* sanity check */
@@ -503,14 +531,19 @@ static u8 abx500_get_mode(struct pinctrl_dev *pctldev, struct gpio_chip *chip,
* pin use the AlternatFunction register
* read alt_bit1 value
*/
- abx500_gpio_get_bit(chip, AB8500_GPIO_ALTFUN_REG,
+ ret = abx500_gpio_get_bit(chip, AB8500_GPIO_ALTFUN_REG,
af.alt_bit1, &alt_bit1);
+ if (ret < 0)
+ goto out;

- if (af.alt_bit2 != UNUSED)
+ if (af.alt_bit2 != UNUSED) {
/* read alt_bit2 value */
- abx500_gpio_get_bit(chip, AB8500_GPIO_ALTFUN_REG, af.alt_bit2,
+ ret = abx500_gpio_get_bit(chip, AB8500_GPIO_ALTFUN_REG,
+ af.alt_bit2,
&alt_bit2);
- else
+ if (ret < 0)
+ goto out;
+ } else
alt_bit2 = 0;

mode = (alt_bit2 << 1) + alt_bit1;
@@ -520,6 +553,10 @@ static u8 abx500_get_mode(struct pinctrl_dev *pctldev, struct gpio_chip *chip,
return ABX500_ALT_B;
else
return ABX500_ALT_C;
+
+out:
+ dev_err(pct->dev, "%s failed (%d)\n", __func__, ret);
+ return ret;
}

#ifdef CONFIG_DEBUG_FS
@@ -538,6 +575,7 @@ static void abx500_gpio_dbg_show_one(struct seq_file *s,
bool is_out;
bool pd;
enum abx500_gpio_pull_updown pud = 0;
+ int ret;

const char *modes[] = {
[ABX500_DEFAULT] = "default",
@@ -553,7 +591,10 @@ static void abx500_gpio_dbg_show_one(struct seq_file *s,
[ABX500_GPIO_PULL_UP] = "pull up",
};

- abx500_gpio_get_bit(chip, AB8500_GPIO_DIR1_REG, gpio_offset, &is_out);
+ ret = abx500_gpio_get_bit(chip, AB8500_GPIO_DIR1_REG,
+ gpio_offset, &is_out);
+ if (ret < 0)
+ goto out;

seq_printf(s, " gpio-%-3d (%-20.20s) %-3s",
gpio, label ?: "(none)",
@@ -561,11 +602,17 @@ static void abx500_gpio_dbg_show_one(struct seq_file *s,

if (!is_out) {
if (abx500_pullud_supported(chip, offset)) {
- abx500_get_pull_updown(pct, offset, &pud);
+ ret = abx500_get_pull_updown(pct, offset, &pud);
+ if (ret < 0)
+ goto out;
+
seq_printf(s, " %-9s", pull_up_down[pud]);
} else {
- abx500_gpio_get_bit(chip, AB8500_GPIO_PUD1_REG,
- gpio_offset, &pd);
+ ret = abx500_gpio_get_bit(chip, AB8500_GPIO_PUD1_REG,
+ gpio_offset, &pd);
+ if (ret < 0)
+ goto out;
+
seq_printf(s, " %-9s", pull_up_down[pd]);
}
} else
@@ -575,6 +622,10 @@ static void abx500_gpio_dbg_show_one(struct seq_file *s,
mode = abx500_get_mode(pctldev, chip, offset);

seq_printf(s, " %s", (mode < 0) ? "unknown" : modes[mode]);
+
+out:
+ if (ret < 0)
+ dev_err(pct->dev, "%s failed (%d)\n", __func__, ret);
}

static void abx500_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
@@ -678,6 +729,9 @@ static int abx500_pmx_enable(struct pinctrl_dev *pctldev, unsigned function,
ret = abx500_set_mode(pctldev, chip, g->pins[i], g->altsetting);
}

+ if (ret < 0)
+ dev_err(pct->dev, "%s failed (%d)\n", __func__, ret);
+
return ret;
}

@@ -726,10 +780,8 @@ static int abx500_gpio_request_enable(struct pinctrl_dev *pctldev,

ret = abx500_set_mode(pct->pctldev, &pct->chip,
offset, p->altfunc);
- if (ret < 0) {
+ if (ret < 0)
dev_err(pct->dev, "%s setting altfunc failed\n", __func__);
- return ret;
- }

return ret;
}
@@ -1006,6 +1058,8 @@ static int abx500_pin_config_set(struct pinctrl_dev *pctldev,
switch (param) {
case PIN_CONFIG_BIAS_DISABLE:
ret = abx500_gpio_direction_input(chip, offset);
+ if (ret < 0)
+ goto out;
/*
* Some chips only support pull down, while some actually
* support both pull up and pull down. Such chips have
@@ -1025,6 +1079,8 @@ static int abx500_pin_config_set(struct pinctrl_dev *pctldev,

case PIN_CONFIG_BIAS_PULL_DOWN:
ret = abx500_gpio_direction_input(chip, offset);
+ if (ret < 0)
+ goto out;
/*
* if argument = 1 set the pull down
* else clear the pull down
@@ -1047,6 +1103,8 @@ static int abx500_pin_config_set(struct pinctrl_dev *pctldev,

case PIN_CONFIG_BIAS_PULL_UP:
ret = abx500_gpio_direction_input(chip, offset);
+ if (ret < 0)
+ goto out;
/*
* if argument = 1 set the pull up
* else clear the pull up
@@ -1067,12 +1125,14 @@ static int abx500_pin_config_set(struct pinctrl_dev *pctldev,

case PIN_CONFIG_OUTPUT:
ret = abx500_gpio_direction_output(chip, offset, argument);
-
break;

default:
dev_err(chip->dev, "illegal configuration requested\n");
}
+out:
+ if (ret < 0)
+ dev_err(pct->dev, "%s failed (%d)\n", __func__, ret);

return ret;
}
--
1.7.10

2013-06-20 14:07:07

by Patrice Chotard

[permalink] [raw]
Subject: [PATCH v2 2/4] pinctrl: abx500: fix abx500_gpio_get()

From: Patrice Chotard <[email protected]>

_ allow to get output GPIO value
_ as there is no GPIO0 on ABX500, use correct offset with
abx500_gpio_get_bit()

Signed-off-by: Patrice Chotard <[email protected]>
---
drivers/pinctrl/pinctrl-abx500.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-abx500.c b/drivers/pinctrl/pinctrl-abx500.c
index d1d42e7..5bf66ad 100644
--- a/drivers/pinctrl/pinctrl-abx500.c
+++ b/drivers/pinctrl/pinctrl-abx500.c
@@ -162,10 +162,23 @@ static int abx500_gpio_get(struct gpio_chip *chip, unsigned offset)
{
struct abx500_pinctrl *pct = to_abx500_pinctrl(chip);
bool bit;
+ bool is_out;
+ u8 gpio_offset = offset - 1;
int ret;

- ret = abx500_gpio_get_bit(chip, AB8500_GPIO_IN1_REG,
- offset, &bit);
+ ret = abx500_gpio_get_bit(chip, AB8500_GPIO_DIR1_REG,
+ gpio_offset, &is_out);
+ if (ret < 0) {
+ dev_err(pct->dev, "%s failed\n", __func__);
+ return ret;
+ }
+
+ if (is_out)
+ ret = abx500_gpio_get_bit(chip, AB8500_GPIO_OUT1_REG,
+ gpio_offset, &bit);
+ else
+ ret = abx500_gpio_get_bit(chip, AB8500_GPIO_IN1_REG,
+ gpio_offset, &bit);
if (ret < 0) {
dev_err(pct->dev, "%s failed\n", __func__);
return ret;
--
1.7.10

2013-06-20 14:07:45

by Patrice Chotard

[permalink] [raw]
Subject: [PATCH v2 3/4] pinctrl: abx500: factorize code

From: Patrice Chotard <[email protected]>

Factorize code by adding abx500_pullud_supported()
which improve code readability.

Signed-off-by: Patrice Chotard <[email protected]>
---
drivers/pinctrl/pinctrl-abx500.c | 32 +++++++++++++++-----------------
1 file changed, 15 insertions(+), 17 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-abx500.c b/drivers/pinctrl/pinctrl-abx500.c
index 5bf66ad..f1ff701 100644
--- a/drivers/pinctrl/pinctrl-abx500.c
+++ b/drivers/pinctrl/pinctrl-abx500.c
@@ -267,12 +267,21 @@ out:
return ret;
}

+static bool abx500_pullud_supported(struct gpio_chip *chip, unsigned gpio)
+{
+ struct abx500_pinctrl *pct = to_abx500_pinctrl(chip);
+ struct pullud *pullud = pct->soc->pullud;
+
+ return (pullud &&
+ gpio >= pullud->first_pin &&
+ gpio <= pullud->last_pin);
+}
+
static int abx500_gpio_direction_output(struct gpio_chip *chip,
unsigned offset,
int val)
{
struct abx500_pinctrl *pct = to_abx500_pinctrl(chip);
- struct pullud *pullud = pct->soc->pullud;
unsigned gpio;
int ret;

@@ -294,7 +303,7 @@ static int abx500_gpio_direction_output(struct gpio_chip *chip,

/* if supported, disable both pull down and pull up */
gpio = offset + 1;
- if (pullud && gpio >= pullud->first_pin && gpio <= pullud->last_pin) {
+ if (abx500_pullud_supported(chip, gpio)) {
ret = abx500_set_pull_updown(pct,
gpio,
ABX500_GPIO_PULL_NONE);
@@ -523,7 +532,6 @@ static void abx500_gpio_dbg_show_one(struct seq_file *s,
unsigned offset, unsigned gpio)
{
struct abx500_pinctrl *pct = pinctrl_dev_get_drvdata(pctldev);
- struct pullud *pullud = pct->soc->pullud;
const char *label = gpiochip_is_requested(chip, offset - 1);
u8 gpio_offset = offset - 1;
int mode = -1;
@@ -552,9 +560,7 @@ static void abx500_gpio_dbg_show_one(struct seq_file *s,
is_out ? "out" : "in ");

if (!is_out) {
- if (pullud &&
- (offset >= pullud->first_pin) &&
- (offset <= pullud->last_pin)) {
+ if (abx500_pullud_supported(chip, offset)) {
abx500_get_pull_updown(pct, offset, &pud);
seq_printf(s, " %-9s", pull_up_down[pud]);
} else {
@@ -983,7 +989,6 @@ static int abx500_pin_config_set(struct pinctrl_dev *pctldev,
unsigned long config)
{
struct abx500_pinctrl *pct = pinctrl_dev_get_drvdata(pctldev);
- struct pullud *pullud = pct->soc->pullud;
struct gpio_chip *chip = &pct->chip;
unsigned offset;
int ret = -EINVAL;
@@ -1008,9 +1013,7 @@ static int abx500_pin_config_set(struct pinctrl_dev *pctldev,
* both features. If the pin is not within that range, we
* fall back to the old bit set that only support pull down.
*/
- if (pullud &&
- pin >= pullud->first_pin &&
- pin <= pullud->last_pin)
+ if (abx500_pullud_supported(chip, pin))
ret = abx500_set_pull_updown(pct,
pin,
ABX500_GPIO_PULL_NONE);
@@ -1031,9 +1034,7 @@ static int abx500_pin_config_set(struct pinctrl_dev *pctldev,
* both features. If the pin is not within that range, we
* fall back to the old bit set that only support pull down.
*/
- if (pullud &&
- pin >= pullud->first_pin &&
- pin <= pullud->last_pin)
+ if (abx500_pullud_supported(chip, pin))
ret = abx500_set_pull_updown(pct,
pin,
argument ? ABX500_GPIO_PULL_DOWN : ABX500_GPIO_PULL_NONE);
@@ -1058,13 +1059,10 @@ static int abx500_pin_config_set(struct pinctrl_dev *pctldev,
* both features. If the pin is not within that range, do
* nothing
*/
- if (pullud &&
- pin >= pullud->first_pin &&
- pin <= pullud->last_pin) {
+ if (abx500_pullud_supported(chip, pin))
ret = abx500_set_pull_updown(pct,
pin,
argument ? ABX500_GPIO_PULL_UP : ABX500_GPIO_PULL_NONE);
- }
break;

case PIN_CONFIG_OUTPUT:
--
1.7.10

2013-06-24 11:29:41

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH v2 1/4] pinctrl: abx500: suppress hardcoded value

On Thu, Jun 20, 2013 at 4:05 PM, <[email protected]> wrote:

> From: Patrice Chotard <[email protected]>
>
> Replace hardcoded value by corresponding #define's.
>
> Signed-off-by: Patrice Chotard <[email protected]>

This is not so good. The commit message is saying it
replaces values by #defines but is actually replacing it
by an enum.

Then you're in each instance calling

abx500_gpio_set_bits(struct gpio_chip *chip, u8 reg,
unsigned offset, int val)

The last argument is a hardware register value, but here you
case an enum abx500_gpio_direction to an integer and pass
to this function.

It would be better if the patch did what it says: create a
#define for ABX500_GPIO_INPUT and ABX500_GPIO_OUTPUT
locally in drivers/pinctrl/pinctrl-abx500.c and use it locally
instead of touching <mfd/abx500/ab8500-gpio.h>.

Thanks,
Linus Walleij

2013-06-24 11:32:26

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH v2 2/4] pinctrl: abx500: fix abx500_gpio_get()

On Thu, Jun 20, 2013 at 4:05 PM, <[email protected]> wrote:

> From: Patrice Chotard <[email protected]>
>
> _ allow to get output GPIO value
> _ as there is no GPIO0 on ABX500, use correct offset with
> abx500_gpio_get_bit()

Pls use a common dash "-" to prefix the items instead of
_underscore.

> Signed-off-by: Patrice Chotard <[email protected]>

Patch applied (after fixing commit message).

Yours,
Linus Walleij

2013-06-24 11:34:20

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH v2 3/4] pinctrl: abx500: factorize code

On Thu, Jun 20, 2013 at 4:05 PM, <[email protected]> wrote:

> From: Patrice Chotard <[email protected]>
>
> Factorize code by adding abx500_pullud_supported()
> which improve code readability.
>
> Signed-off-by: Patrice Chotard <[email protected]>

Patch applied, thanks!

Yours,
Linus Walleij

2013-06-24 11:37:42

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH v2 4/4] pinctrl: abx500: rework error path

On Thu, Jun 20, 2013 at 4:05 PM, <[email protected]> wrote:

> From: Patrice Chotard <[email protected]>
>
> At several places, return value was not tested
> and error output was missing.
>
> Signed-off-by: Patrice Chotard <[email protected]>

This looks fine, but does not apply since I didn't accept patch 1/4.

Please resend 1/4 and this 4/4 after fixing up 1/4.

(You can rebase onto devel if you want to be 100% sure it applies.)

Yours,
Linus Walleij

2013-06-24 12:14:20

by Patrice CHOTARD

[permalink] [raw]
Subject: Re: [PATCH v2 1/4] pinctrl: abx500: suppress hardcoded value

On 06/24/2013 01:29 PM, Linus Walleij wrote:

> On Thu, Jun 20, 2013 at 4:05 PM, <[email protected]> wrote:
>
>> From: Patrice Chotard <[email protected]>
>>
>> Replace hardcoded value by corresponding #define's.
>>
>> Signed-off-by: Patrice Chotard <[email protected]>
>
> This is not so good. The commit message is saying it
> replaces values by #defines but is actually replacing it
> by an enum.
>
> Then you're in each instance calling
>
> abx500_gpio_set_bits(struct gpio_chip *chip, u8 reg,
> unsigned offset, int val)
>
> The last argument is a hardware register value, but here you
> case an enum abx500_gpio_direction to an integer and pass
> to this function.
>
> It would be better if the patch did what it says: create a
> #define for ABX500_GPIO_INPUT and ABX500_GPIO_OUTPUT
> locally in drivers/pinctrl/pinctrl-abx500.c and use it locally
> instead of touching <mfd/abx500/ab8500-gpio.h>.


Ok, i'll resubmit this

>
> Thanks,
> Linus Walleij

2013-06-24 12:23:48

by Patrice CHOTARD

[permalink] [raw]
Subject: Re: [PATCH v2 4/4] pinctrl: abx500: rework error path

On 06/24/2013 01:37 PM, Linus Walleij wrote:

> On Thu, Jun 20, 2013 at 4:05 PM, <[email protected]> wrote:
>
>> From: Patrice Chotard <[email protected]>
>>
>> At several places, return value was not tested
>> and error output was missing.
>>
>> Signed-off-by: Patrice Chotard <[email protected]>
>
> This looks fine, but does not apply since I didn't accept patch 1/4.


I am surprised that patch 4/4 doesn't apply, because in my side i am
able to apply it on your devel branch even without patch 1/4

Anyway, i'll submit 1/4 and 4/4.

Thanks

Patrice

>

> Please resend 1/4 and this 4/4 after fixing up 1/4.
>
> (You can rebase onto devel if you want to be 100% sure it applies.)
>
> Yours,
> Linus Walleij