Skip to content

Commit 4944790

Browse files
committed
Merge tag 'pinctrl-v3.14-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl
Pull pinctrl fixes from Linus Walleij: "First round of pin control fixes for v3.14: - Protect pinctrl_list_add() with the proper mutex. This was identified by RedHat. Caused nasty locking warnings was rootcased by Stanislaw Gruszka. - Avoid adding dangerous debugfs files when either half of the subsystem is unused: pinmux or pinconf. - Various fixes to various drivers: locking, hardware particulars, DT parsing, error codes" * tag 'pinctrl-v3.14-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl: pinctrl: tegra: return correct error type pinctrl: do not init debugfs entries for unimplemented functionalities pinctrl: protect pinctrl_list add pinctrl: sirf: correct the pin index of ac97_pins group pinctrl: imx27: fix offset calculation in imx_read_2bit pinctrl: vt8500: Change devicetree data parsing pinctrl: imx27: fix wrong offset to ICONFB pinctrl: at91: use locked variant of irq_set_handler
2 parents c132ade + 5b232c5 commit 4944790

File tree

6 files changed

+32
-15
lines changed

6 files changed

+32
-15
lines changed

drivers/pinctrl/core.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,9 @@ static struct pinctrl *create_pinctrl(struct device *dev)
851851
kref_init(&p->users);
852852

853853
/* Add the pinctrl handle to the global list */
854+
mutex_lock(&pinctrl_list_mutex);
854855
list_add_tail(&p->node, &pinctrl_list);
856+
mutex_unlock(&pinctrl_list_mutex);
855857

856858
return p;
857859
}
@@ -1642,8 +1644,10 @@ static void pinctrl_init_device_debugfs(struct pinctrl_dev *pctldev)
16421644
device_root, pctldev, &pinctrl_groups_ops);
16431645
debugfs_create_file("gpio-ranges", S_IFREG | S_IRUGO,
16441646
device_root, pctldev, &pinctrl_gpioranges_ops);
1645-
pinmux_init_device_debugfs(device_root, pctldev);
1646-
pinconf_init_device_debugfs(device_root, pctldev);
1647+
if (pctldev->desc->pmxops)
1648+
pinmux_init_device_debugfs(device_root, pctldev);
1649+
if (pctldev->desc->confops)
1650+
pinconf_init_device_debugfs(device_root, pctldev);
16471651
}
16481652

16491653
static void pinctrl_remove_device_debugfs(struct pinctrl_dev *pctldev)

drivers/pinctrl/pinctrl-at91.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1286,22 +1286,22 @@ static int alt_gpio_irq_type(struct irq_data *d, unsigned type)
12861286

12871287
switch (type) {
12881288
case IRQ_TYPE_EDGE_RISING:
1289-
irq_set_handler(d->irq, handle_simple_irq);
1289+
__irq_set_handler_locked(d->irq, handle_simple_irq);
12901290
writel_relaxed(mask, pio + PIO_ESR);
12911291
writel_relaxed(mask, pio + PIO_REHLSR);
12921292
break;
12931293
case IRQ_TYPE_EDGE_FALLING:
1294-
irq_set_handler(d->irq, handle_simple_irq);
1294+
__irq_set_handler_locked(d->irq, handle_simple_irq);
12951295
writel_relaxed(mask, pio + PIO_ESR);
12961296
writel_relaxed(mask, pio + PIO_FELLSR);
12971297
break;
12981298
case IRQ_TYPE_LEVEL_LOW:
1299-
irq_set_handler(d->irq, handle_level_irq);
1299+
__irq_set_handler_locked(d->irq, handle_level_irq);
13001300
writel_relaxed(mask, pio + PIO_LSR);
13011301
writel_relaxed(mask, pio + PIO_FELLSR);
13021302
break;
13031303
case IRQ_TYPE_LEVEL_HIGH:
1304-
irq_set_handler(d->irq, handle_level_irq);
1304+
__irq_set_handler_locked(d->irq, handle_level_irq);
13051305
writel_relaxed(mask, pio + PIO_LSR);
13061306
writel_relaxed(mask, pio + PIO_REHLSR);
13071307
break;
@@ -1310,7 +1310,7 @@ static int alt_gpio_irq_type(struct irq_data *d, unsigned type)
13101310
* disable additional interrupt modes:
13111311
* fall back to default behavior
13121312
*/
1313-
irq_set_handler(d->irq, handle_simple_irq);
1313+
__irq_set_handler_locked(d->irq, handle_simple_irq);
13141314
writel_relaxed(mask, pio + PIO_AIMDR);
13151315
return 0;
13161316
case IRQ_TYPE_NONE:

drivers/pinctrl/pinctrl-imx1-core.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ struct imx1_pinctrl {
4545
#define MX1_DDIR 0x00
4646
#define MX1_OCR 0x04
4747
#define MX1_ICONFA 0x0c
48-
#define MX1_ICONFB 0x10
48+
#define MX1_ICONFB 0x14
4949
#define MX1_GIUS 0x20
5050
#define MX1_GPR 0x38
5151
#define MX1_PUEN 0x40
@@ -97,13 +97,13 @@ static void imx1_write_2bit(struct imx1_pinctrl *ipctl, unsigned int pin_id,
9797
u32 old_val;
9898
u32 new_val;
9999

100-
dev_dbg(ipctl->dev, "write: register 0x%p offset %d value 0x%x\n",
101-
reg, offset, value);
102-
103100
/* Use the next register if the pin's port pin number is >=16 */
104101
if (pin_id % 32 >= 16)
105102
reg += 0x04;
106103

104+
dev_dbg(ipctl->dev, "write: register 0x%p offset %d value 0x%x\n",
105+
reg, offset, value);
106+
107107
/* Get current state of pins */
108108
old_val = readl(reg);
109109
old_val &= mask;
@@ -139,7 +139,7 @@ static int imx1_read_2bit(struct imx1_pinctrl *ipctl, unsigned int pin_id,
139139
u32 reg_offset)
140140
{
141141
void __iomem *reg = imx1_mem(ipctl, pin_id) + reg_offset;
142-
int offset = pin_id % 16;
142+
int offset = (pin_id % 16) * 2;
143143

144144
/* Use the next register if the pin's port pin number is >=16 */
145145
if (pin_id % 32 >= 16)

drivers/pinctrl/pinctrl-tegra.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ int tegra_pinctrl_probe(struct platform_device *pdev,
645645
GFP_KERNEL);
646646
if (!pmx->regs) {
647647
dev_err(&pdev->dev, "Can't alloc regs pointer\n");
648-
return -ENODEV;
648+
return -ENOMEM;
649649
}
650650

651651
for (i = 0; i < pmx->nbanks; i++) {

drivers/pinctrl/sirf/pinctrl-prima2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ static const struct sirfsoc_padmux ac97_padmux = {
413413
.funcval = 0,
414414
};
415415

416-
static const unsigned ac97_pins[] = { 33, 34, 35, 36 };
416+
static const unsigned ac97_pins[] = { 43, 44, 45, 46 };
417417

418418
static const struct sirfsoc_muxmask spi1_muxmask[] = {
419419
{

drivers/pinctrl/vt8500/pinctrl-wmt.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,20 @@ static int wmt_pctl_dt_node_to_map_pull(struct wmt_pinctrl_data *data,
276276
if (!configs)
277277
return -ENOMEM;
278278

279-
configs[0] = pull;
279+
switch (pull) {
280+
case 0:
281+
configs[0] = PIN_CONFIG_BIAS_DISABLE;
282+
break;
283+
case 1:
284+
configs[0] = PIN_CONFIG_BIAS_PULL_DOWN;
285+
break;
286+
case 2:
287+
configs[0] = PIN_CONFIG_BIAS_PULL_UP;
288+
break;
289+
default:
290+
configs[0] = PIN_CONFIG_BIAS_DISABLE;
291+
dev_err(data->dev, "invalid pull state %d - disabling\n", pull);
292+
}
280293

281294
map->type = PIN_MAP_TYPE_CONFIGS_PIN;
282295
map->data.configs.group_or_pin = data->groups[group];

0 commit comments

Comments
 (0)