Skip to content

Commit

Permalink
pinctrl: pinmux: Don't free pins requested by other devices in pinmux…
Browse files Browse the repository at this point in the history
…_disable_setting.

One peripheral may share part of its pins with the 2nd
peripheral and the other pins with the 3rd. If it requests all pins
when part of them has already be requested and owned by the 2nd
peripheral, this request fails and pinmux_disable_setting() is called.
The pinmux_disable_setting() frees all pins of the first peripheral
without checking if the pin is owned by itself or the 2nd, which
results in the malfunction of the 2nd peripheral driver.

Signed-off-by: Sonic Zhang <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
  • Loading branch information
sonicz authored and linusw committed Aug 14, 2013
1 parent bf4dae5 commit 744f0a9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions drivers/pinctrl/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -482,13 +482,13 @@ void pinmux_disable_setting(struct pinctrl_setting const *setting)
pins[i]);
continue;
}
desc->mux_setting = NULL;
if (desc->mux_setting == &(setting->data.mux)) {
desc->mux_setting = NULL;
/* And release the pin */
pin_free(pctldev, pins[i], NULL);
}
}

/* And release the pins */
for (i = 0; i < num_pins; i++)
pin_free(pctldev, pins[i], NULL);

if (ops->disable)
ops->disable(pctldev, setting->data.mux.func, setting->data.mux.group);
}
Expand Down

0 comments on commit 744f0a9

Please sign in to comment.