History

Merge tag 'pinctrl-v4.5-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl

Pull Pin control fixes from Linus Walleij: "Pin control fixes for the v4.5 series, all are individual driver fixes: - Fix the PXA2xx driver to export its init function so we do not break modular compiles. - Hide unused functions in the Nomadik driver. - Fix up direction control in the Mediatek driver. - Toggle the sunxi GPIO lines to input when you read them on the H3 GPIO controller, lest you only get garbage. - Fix up the number of settings in the MVEBU driver. - Fix a serious SMP race condition in the Samsung driver" * tag 'pinctrl-v4.5-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl: pinctrl: samsung: fix SMP race condition pinctrl: mvebu: fix num_settings in mpp group assignment pinctrl: sunxi: H3 requires irq_read_needs_mux pinctrl: mediatek: fix direction control issue pinctrl: nomadik: hide unused functions pinctrl: pxa: export pxa2xx_pinctrl_init()

Linus Torvalds committed 10 years ago

Commit 409ee132 parents 9001b8e d9ff0eb6 files · +48 −18Browse files

Unified · Split

6 files
  1. drivers/pinctrl/mediatek/pinctrl-mtk-common.c +2 −0
  2. drivers/pinctrl/mvebu/pinctrl-mvebu.c +6 −3
  3. drivers/pinctrl/nomadik/pinctrl-abx500.c +3 −2
  4. drivers/pinctrl/pxa/pinctrl-pxa2xx.c +1 −0
  5. drivers/pinctrl/samsung/pinctrl-samsung.c +35 −13
  6. drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c +1 −0
drivers/pinctrl/mediatek/pinctrl-mtk-common.c+2−0
@@ -347,6 +347,7 @@ static int mtk_pconf_parse_conf(struct pinctrl_dev *pctldev, · 346 unmodified lines
347347 ret = mtk_pconf_set_pull_select(pctl, pin, true, false, arg);
348348 break;
349349 case PIN_CONFIG_INPUT_ENABLE:
350+ mtk_pmx_gpio_set_direction(pctldev, NULL, pin, true);
350351 ret = mtk_pconf_set_ies_smt(pctl, pin, arg, param);
351352 break;
352353 case PIN_CONFIG_OUTPUT:
@@ -354,6 +355,7 @@ static int mtk_pconf_parse_conf(struct pinctrl_dev *pctldev, · 1 unmodified line
354355 ret = mtk_pmx_gpio_set_direction(pctldev, NULL, pin, false);
355356 break;
356357 case PIN_CONFIG_INPUT_SCHMITT_ENABLE:
358+ mtk_pmx_gpio_set_direction(pctldev, NULL, pin, true);
357359 ret = mtk_pconf_set_ies_smt(pctl, pin, arg, param);
358360 break;
359361 case PIN_CONFIG_DRIVE_STRENGTH:
drivers/pinctrl/mvebu/pinctrl-mvebu.c+6−3
@@ -666,16 +666,19 @@ int mvebu_pinctrl_probe(struct platform_device *pdev) · 665 unmodified lines
666666 struct mvebu_mpp_ctrl_setting *set = &mode->settings[0];
667667 struct mvebu_pinctrl_group *grp;
668668 unsigned num_settings;
669+ unsigned supp_settings;
669670
670− for (num_settings = 0; ; set++) {
671+ for (num_settings = 0, supp_settings = 0; ; set++) {
671672 if (!set->name)
672673 break;
673674
675+ num_settings++;
676+
674677 /* skip unsupported settings for this variant */
675678 if (pctl->variant && !(pctl->variant & set->variant))
676679 continue;
677680
678− num_settings++;
681+ supp_settings++;
679682
680683 /* find gpio/gpo/gpi settings */
681684 if (strcmp(set->name, "gpio") == 0)
@@ -688,7 +691,7 @@ int mvebu_pinctrl_probe(struct platform_device *pdev) · 6 unmodified lines
688691 }
689692
690693 /* skip modes with no settings for this variant */
691− if (!num_settings)
694+ if (!supp_settings)
692695 continue;
693696
694697 grp = mvebu_pinctrl_find_group_by_pid(pctl, mode->pid);
drivers/pinctrl/nomadik/pinctrl-abx500.c+3−2
@@ -191,6 +191,7 @@ static void abx500_gpio_set(struct gpio_chip *chip, unsigned offset, int val) · 190 unmodified lines
191191 dev_err(pct->dev, "%s write failed (%d)\n", __func__, ret);
192192 }
193193
194+#ifdef CONFIG_DEBUG_FS
194195 static int abx500_get_pull_updown(struct abx500_pinctrl *pct, int offset,
195196 enum abx500_gpio_pull_updown *pull_updown)
196197 {
@@ -226,6 +227,7 @@ out: · 29 unmodified lines
226227
227228 return ret;
228229 }
230+#endif
229231
230232 static int abx500_set_pull_updown(struct abx500_pinctrl *pct,
231233 int offset, enum abx500_gpio_pull_updown val)
@@ -468,6 +470,7 @@ out: · 236 unmodified lines
468470 return ret;
469471 }
470472
473+#ifdef CONFIG_DEBUG_FS
471474 static int abx500_get_mode(struct pinctrl_dev *pctldev, struct gpio_chip *chip,
472475 unsigned gpio)
473476 {
@@ -553,8 +556,6 @@ out: · 79 unmodified lines
553556 return ret;
554557 }
555558
556−#ifdef CONFIG_DEBUG_FS
557−
558559 #include <linux/seq_file.h>
559560
560561 static void abx500_gpio_dbg_show_one(struct seq_file *s,
drivers/pinctrl/pxa/pinctrl-pxa2xx.c+1−0
@@ -426,6 +426,7 @@ int pxa2xx_pinctrl_init(struct platform_device *pdev, · 425 unmodified lines
426426
427427 return 0;
428428 }
429+EXPORT_SYMBOL(pxa2xx_pinctrl_init);
429430
430431 int pxa2xx_pinctrl_exit(struct platform_device *pdev)
431432 {
drivers/pinctrl/samsung/pinctrl-samsung.c+35−13
@@ -514,25 +514,35 @@ static const struct pinconf_ops samsung_pinconf_ops = { · 513 unmodified lines
514514 .pin_config_group_set = samsung_pinconf_group_set,
515515 };
516516
517−/* gpiolib gpio_set callback function */
518−static void samsung_gpio_set(struct gpio_chip *gc, unsigned offset, int value)
517+/*
518+ * The samsung_gpio_set_vlaue() should be called with "bank->slock" held
519+ * to avoid race condition.
520+ */
521+static void samsung_gpio_set_value(struct gpio_chip *gc,
522+ unsigned offset, int value)
519523 {
520524 struct samsung_pin_bank *bank = gpiochip_get_data(gc);
521525 const struct samsung_pin_bank_type *type = bank->type;
522− unsigned long flags;
523526 void __iomem *reg;
524527 u32 data;
525528
526529 reg = bank->drvdata->virt_base + bank->pctl_offset;
527530
528− spin_lock_irqsave(&bank->slock, flags);
529−
530531 data = readl(reg + type->reg_offset[PINCFG_TYPE_DAT]);
531532 data &= ~(1 << offset);
532533 if (value)
533534 data |= 1 << offset;
534535 writel(data, reg + type->reg_offset[PINCFG_TYPE_DAT]);
536+}
537+
538+/* gpiolib gpio_set callback function */
539+static void samsung_gpio_set(struct gpio_chip *gc, unsigned offset, int value)
540+{
541+ struct samsung_pin_bank *bank = gpiochip_get_data(gc);
542+ unsigned long flags;
535543
544+ spin_lock_irqsave(&bank->slock, flags);
545+ samsung_gpio_set_value(gc, offset, value);
536546 spin_unlock_irqrestore(&bank->slock, flags);
537547 }
538548
@@ -553,6 +563,8 @@ static int samsung_gpio_get(struct gpio_chip *gc, unsigned offset) · 14 unmodified lines
553563 }
554564
555565 /*
566+ * The samsung_gpio_set_direction() should be called with "bank->slock" held
567+ * to avoid race condition.
556568 * The calls to gpio_direction_output() and gpio_direction_input()
557569 * leads to this function call.
558570 */
@@ -564,7 +576,6 @@ static int samsung_gpio_set_direction(struct gpio_chip *gc, · 5 unmodified lines
564576 struct samsung_pinctrl_drv_data *drvdata;
565577 void __iomem *reg;
566578 u32 data, mask, shift;
567− unsigned long flags;
568579
569580 bank = gpiochip_get_data(gc);
570581 type = bank->type;
@@ -581,31 +592,42 @@ static int samsung_gpio_set_direction(struct gpio_chip *gc, · 10 unmodified lines
581592 reg += 4;
582593 }
583594
584− spin_lock_irqsave(&bank->slock, flags);
585−
586595 data = readl(reg);
587596 data &= ~(mask << shift);
588597 if (!input)
589598 data |= FUNC_OUTPUT << shift;
590599 writel(data, reg);
591600
592− spin_unlock_irqrestore(&bank->slock, flags);
593−
594601 return 0;
595602 }
596603
597604 /* gpiolib gpio_direction_input callback function. */
598605 static int samsung_gpio_direction_input(struct gpio_chip *gc, unsigned offset)
599606 {
600− return samsung_gpio_set_direction(gc, offset, true);
607+ struct samsung_pin_bank *bank = gpiochip_get_data(gc);
608+ unsigned long flags;
609+ int ret;
610+
611+ spin_lock_irqsave(&bank->slock, flags);
612+ ret = samsung_gpio_set_direction(gc, offset, true);
613+ spin_unlock_irqrestore(&bank->slock, flags);
614+ return ret;
601615 }
602616
603617 /* gpiolib gpio_direction_output callback function. */
604618 static int samsung_gpio_direction_output(struct gpio_chip *gc, unsigned offset,
605619 int value)
606620 {
607− samsung_gpio_set(gc, offset, value);
608− return samsung_gpio_set_direction(gc, offset, false);
621+ struct samsung_pin_bank *bank = gpiochip_get_data(gc);
622+ unsigned long flags;
623+ int ret;
624+
625+ spin_lock_irqsave(&bank->slock, flags);
626+ samsung_gpio_set_value(gc, offset, value);
627+ ret = samsung_gpio_set_direction(gc, offset, false);
628+ spin_unlock_irqrestore(&bank->slock, flags);
629+
630+ return ret;
609631 }
610632
611633 /*
drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c+1−0
@@ -492,6 +492,7 @@ static const struct sunxi_pinctrl_desc sun8i_h3_pinctrl_data = { · 491 unmodified lines
492492 .pins = sun8i_h3_pins,
493493 .npins = ARRAY_SIZE(sun8i_h3_pins),
494494 .irq_banks = 2,
495+ .irq_read_needs_mux = true
495496 };
496497
497498 static int sun8i_h3_pinctrl_probe(struct platform_device *pdev)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t