Commit 3912a677 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'pinctrl-fixes-for-v3.9' of...

Merge tag 'pinctrl-fixes-for-v3.9' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl

Pull pinctrl fixes from Linus Walleij:
 "Here are a few pinctrl fixes for the v3.9 rc series:
   - Usecount bounds checking so we do not go below zero on mux
     usecounts.
   - Loop range checking in GPIO ranges in the DT range parser.
   - Proper print in debugfs for pinconf state.
   - Fix compilation bug in generic pinconf code.
   - Minor bugfixes to abx500 and mvebu drivers."

* tag 'pinctrl-fixes-for-v3.9' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl:
  pinmux: forbid mux_usecount to be set at UINT_MAX
  pinctrl: mvebu: fix checking for SoC specific controls
  pinctrl: generic: Fix compilation error
  pinctrl: Print the correct information in debugfs pinconf-state file
  pinctrl: abx500: Fix checking if pin use AlternateFunction register
  gpio: fix wrong checking condition for gpio range
parents 33b73e9b 740924a2
...@@ -193,7 +193,7 @@ static void of_gpiochip_add_pin_range(struct gpio_chip *chip) ...@@ -193,7 +193,7 @@ static void of_gpiochip_add_pin_range(struct gpio_chip *chip)
if (!np) if (!np)
return; return;
do { for (;; index++) {
ret = of_parse_phandle_with_args(np, "gpio-ranges", ret = of_parse_phandle_with_args(np, "gpio-ranges",
"#gpio-range-cells", index, &pinspec); "#gpio-range-cells", index, &pinspec);
if (ret) if (ret)
...@@ -222,8 +222,7 @@ static void of_gpiochip_add_pin_range(struct gpio_chip *chip) ...@@ -222,8 +222,7 @@ static void of_gpiochip_add_pin_range(struct gpio_chip *chip)
if (ret) if (ret)
break; break;
}
} while (index++);
} }
#else #else
......
...@@ -620,7 +620,7 @@ int mvebu_pinctrl_probe(struct platform_device *pdev) ...@@ -620,7 +620,7 @@ int mvebu_pinctrl_probe(struct platform_device *pdev)
/* special soc specific control */ /* special soc specific control */
if (ctrl->mpp_get || ctrl->mpp_set) { if (ctrl->mpp_get || ctrl->mpp_set) {
if (!ctrl->name || !ctrl->mpp_set || !ctrl->mpp_set) { if (!ctrl->name || !ctrl->mpp_get || !ctrl->mpp_set) {
dev_err(&pdev->dev, "wrong soc control info\n"); dev_err(&pdev->dev, "wrong soc control info\n");
return -EINVAL; return -EINVAL;
} }
......
...@@ -622,7 +622,7 @@ static const struct file_operations pinconf_dbg_pinname_fops = { ...@@ -622,7 +622,7 @@ static const struct file_operations pinconf_dbg_pinname_fops = {
static int pinconf_dbg_state_print(struct seq_file *s, void *d) static int pinconf_dbg_state_print(struct seq_file *s, void *d)
{ {
if (strlen(dbg_state_name)) if (strlen(dbg_state_name))
seq_printf(s, "%s\n", dbg_pinname); seq_printf(s, "%s\n", dbg_state_name);
else else
seq_printf(s, "No pin state set\n"); seq_printf(s, "No pin state set\n");
return 0; return 0;
......
...@@ -90,7 +90,7 @@ static inline void pinconf_init_device_debugfs(struct dentry *devroot, ...@@ -90,7 +90,7 @@ static inline void pinconf_init_device_debugfs(struct dentry *devroot,
* pin config. * pin config.
*/ */
#ifdef CONFIG_GENERIC_PINCONF #if defined(CONFIG_GENERIC_PINCONF) && defined(CONFIG_DEBUG_FS)
void pinconf_generic_dump_pin(struct pinctrl_dev *pctldev, void pinconf_generic_dump_pin(struct pinctrl_dev *pctldev,
struct seq_file *s, unsigned pin); struct seq_file *s, unsigned pin);
......
...@@ -422,7 +422,7 @@ static u8 abx500_get_mode(struct pinctrl_dev *pctldev, struct gpio_chip *chip, ...@@ -422,7 +422,7 @@ static u8 abx500_get_mode(struct pinctrl_dev *pctldev, struct gpio_chip *chip,
} }
/* check if pin use AlternateFunction register */ /* check if pin use AlternateFunction register */
if ((af.alt_bit1 == UNUSED) && (af.alt_bit1 == UNUSED)) if ((af.alt_bit1 == UNUSED) && (af.alt_bit2 == UNUSED))
return mode; return mode;
/* /*
* if pin GPIOSEL bit is set and pin supports alternate function, * if pin GPIOSEL bit is set and pin supports alternate function,
......
...@@ -194,6 +194,11 @@ static const char *pin_free(struct pinctrl_dev *pctldev, int pin, ...@@ -194,6 +194,11 @@ static const char *pin_free(struct pinctrl_dev *pctldev, int pin,
} }
if (!gpio_range) { if (!gpio_range) {
/*
* A pin should not be freed more times than allocated.
*/
if (WARN_ON(!desc->mux_usecount))
return NULL;
desc->mux_usecount--; desc->mux_usecount--;
if (desc->mux_usecount) if (desc->mux_usecount)
return NULL; return NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment