Loading drivers/pinctrl/sh-pfc/core.c +10 −9 Original line number Diff line number Diff line Loading @@ -93,7 +93,7 @@ int sh_pfc_get_pin_index(struct sh_pfc *pfc, unsigned int pin) offset += range->end - range->begin + 1; } return -1; return -EINVAL; } static int sh_pfc_enum_in_range(pinmux_enum_t enum_id, Loading Loading @@ -233,7 +233,7 @@ static int sh_pfc_get_config_reg(struct sh_pfc *pfc, pinmux_enum_t enum_id, k++; } return -1; return -EINVAL; } static int sh_pfc_mark_to_enum(struct sh_pfc *pfc, pinmux_enum_t mark, int pos, Loading @@ -255,7 +255,7 @@ static int sh_pfc_mark_to_enum(struct sh_pfc *pfc, pinmux_enum_t mark, int pos, } pr_err("cannot locate data/mark enum_id for mark %d\n", mark); return -1; return -EINVAL; } int sh_pfc_config_mux(struct sh_pfc *pfc, unsigned mark, int pinmux_type) Loading @@ -264,6 +264,7 @@ int sh_pfc_config_mux(struct sh_pfc *pfc, unsigned mark, int pinmux_type) pinmux_enum_t enum_id; const struct pinmux_range *range; int in_range, pos, field, value; int ret; switch (pinmux_type) { Loading @@ -288,7 +289,7 @@ int sh_pfc_config_mux(struct sh_pfc *pfc, unsigned mark, int pinmux_type) break; default: return -1; return -EINVAL; } pos = 0; Loading @@ -297,8 +298,8 @@ int sh_pfc_config_mux(struct sh_pfc *pfc, unsigned mark, int pinmux_type) value = 0; while (1) { pos = sh_pfc_mark_to_enum(pfc, mark, pos, &enum_id); if (pos <= 0) return -1; if (pos < 0) return pos; if (!enum_id) break; Loading Loading @@ -341,9 +342,9 @@ int sh_pfc_config_mux(struct sh_pfc *pfc, unsigned mark, int pinmux_type) if (!in_range) continue; if (sh_pfc_get_config_reg(pfc, enum_id, &cr, &field, &value) != 0) return -1; ret = sh_pfc_get_config_reg(pfc, enum_id, &cr, &field, &value); if (ret < 0) return ret; sh_pfc_write_config_reg(pfc, cr, field, value); } Loading drivers/pinctrl/sh-pfc/gpio.c +4 −9 Original line number Diff line number Diff line Loading @@ -276,22 +276,17 @@ static int gpio_function_request(struct gpio_chip *gc, unsigned offset) struct sh_pfc *pfc = gpio_to_pfc(gc); unsigned int mark = pfc->info->func_gpios[offset].enum_id; unsigned long flags; int ret = -EINVAL; int ret; pr_notice_once("Use of GPIO API for function requests is deprecated, convert to pinctrl\n"); if (mark == 0) return ret; return -EINVAL; spin_lock_irqsave(&pfc->lock, flags); if (sh_pfc_config_mux(pfc, mark, PINMUX_TYPE_FUNCTION)) goto done; ret = 0; done: ret = sh_pfc_config_mux(pfc, mark, PINMUX_TYPE_FUNCTION); spin_unlock_irqrestore(&pfc->lock, flags); return ret; } Loading drivers/pinctrl/sh-pfc/pinctrl.c +11 −13 Original line number Diff line number Diff line Loading @@ -114,18 +114,16 @@ static int sh_pfc_func_enable(struct pinctrl_dev *pctldev, unsigned selector, const struct sh_pfc_pin_group *grp = &pfc->info->groups[group]; unsigned long flags; unsigned int i; int ret = -EINVAL; int ret = 0; spin_lock_irqsave(&pfc->lock, flags); for (i = 0; i < grp->nr_pins; ++i) { if (sh_pfc_config_mux(pfc, grp->mux[i], PINMUX_TYPE_FUNCTION)) goto done; ret = sh_pfc_config_mux(pfc, grp->mux[i], PINMUX_TYPE_FUNCTION); if (ret < 0) break; } ret = 0; done: spin_unlock_irqrestore(&pfc->lock, flags); return ret; } Loading @@ -144,7 +142,7 @@ static int sh_pfc_reconfig_pin(struct sh_pfc_pinctrl *pmx, unsigned offset, const struct sh_pfc_pin *pin = &pfc->info->pins[idx]; unsigned int mark = pin->enum_id; unsigned long flags; int ret = -EINVAL; int ret; spin_lock_irqsave(&pfc->lock, flags); Loading @@ -156,17 +154,17 @@ static int sh_pfc_reconfig_pin(struct sh_pfc_pinctrl *pmx, unsigned offset, case PINMUX_TYPE_INPUT_PULLDOWN: break; default: goto err; ret = -EINVAL; goto done; } if (sh_pfc_config_mux(pfc, mark, new_type) != 0) goto err; ret = sh_pfc_config_mux(pfc, mark, new_type); if (ret < 0) goto done; cfg->type = new_type; ret = 0; err: done: spin_unlock_irqrestore(&pfc->lock, flags); return ret; Loading Loading
drivers/pinctrl/sh-pfc/core.c +10 −9 Original line number Diff line number Diff line Loading @@ -93,7 +93,7 @@ int sh_pfc_get_pin_index(struct sh_pfc *pfc, unsigned int pin) offset += range->end - range->begin + 1; } return -1; return -EINVAL; } static int sh_pfc_enum_in_range(pinmux_enum_t enum_id, Loading Loading @@ -233,7 +233,7 @@ static int sh_pfc_get_config_reg(struct sh_pfc *pfc, pinmux_enum_t enum_id, k++; } return -1; return -EINVAL; } static int sh_pfc_mark_to_enum(struct sh_pfc *pfc, pinmux_enum_t mark, int pos, Loading @@ -255,7 +255,7 @@ static int sh_pfc_mark_to_enum(struct sh_pfc *pfc, pinmux_enum_t mark, int pos, } pr_err("cannot locate data/mark enum_id for mark %d\n", mark); return -1; return -EINVAL; } int sh_pfc_config_mux(struct sh_pfc *pfc, unsigned mark, int pinmux_type) Loading @@ -264,6 +264,7 @@ int sh_pfc_config_mux(struct sh_pfc *pfc, unsigned mark, int pinmux_type) pinmux_enum_t enum_id; const struct pinmux_range *range; int in_range, pos, field, value; int ret; switch (pinmux_type) { Loading @@ -288,7 +289,7 @@ int sh_pfc_config_mux(struct sh_pfc *pfc, unsigned mark, int pinmux_type) break; default: return -1; return -EINVAL; } pos = 0; Loading @@ -297,8 +298,8 @@ int sh_pfc_config_mux(struct sh_pfc *pfc, unsigned mark, int pinmux_type) value = 0; while (1) { pos = sh_pfc_mark_to_enum(pfc, mark, pos, &enum_id); if (pos <= 0) return -1; if (pos < 0) return pos; if (!enum_id) break; Loading Loading @@ -341,9 +342,9 @@ int sh_pfc_config_mux(struct sh_pfc *pfc, unsigned mark, int pinmux_type) if (!in_range) continue; if (sh_pfc_get_config_reg(pfc, enum_id, &cr, &field, &value) != 0) return -1; ret = sh_pfc_get_config_reg(pfc, enum_id, &cr, &field, &value); if (ret < 0) return ret; sh_pfc_write_config_reg(pfc, cr, field, value); } Loading
drivers/pinctrl/sh-pfc/gpio.c +4 −9 Original line number Diff line number Diff line Loading @@ -276,22 +276,17 @@ static int gpio_function_request(struct gpio_chip *gc, unsigned offset) struct sh_pfc *pfc = gpio_to_pfc(gc); unsigned int mark = pfc->info->func_gpios[offset].enum_id; unsigned long flags; int ret = -EINVAL; int ret; pr_notice_once("Use of GPIO API for function requests is deprecated, convert to pinctrl\n"); if (mark == 0) return ret; return -EINVAL; spin_lock_irqsave(&pfc->lock, flags); if (sh_pfc_config_mux(pfc, mark, PINMUX_TYPE_FUNCTION)) goto done; ret = 0; done: ret = sh_pfc_config_mux(pfc, mark, PINMUX_TYPE_FUNCTION); spin_unlock_irqrestore(&pfc->lock, flags); return ret; } Loading
drivers/pinctrl/sh-pfc/pinctrl.c +11 −13 Original line number Diff line number Diff line Loading @@ -114,18 +114,16 @@ static int sh_pfc_func_enable(struct pinctrl_dev *pctldev, unsigned selector, const struct sh_pfc_pin_group *grp = &pfc->info->groups[group]; unsigned long flags; unsigned int i; int ret = -EINVAL; int ret = 0; spin_lock_irqsave(&pfc->lock, flags); for (i = 0; i < grp->nr_pins; ++i) { if (sh_pfc_config_mux(pfc, grp->mux[i], PINMUX_TYPE_FUNCTION)) goto done; ret = sh_pfc_config_mux(pfc, grp->mux[i], PINMUX_TYPE_FUNCTION); if (ret < 0) break; } ret = 0; done: spin_unlock_irqrestore(&pfc->lock, flags); return ret; } Loading @@ -144,7 +142,7 @@ static int sh_pfc_reconfig_pin(struct sh_pfc_pinctrl *pmx, unsigned offset, const struct sh_pfc_pin *pin = &pfc->info->pins[idx]; unsigned int mark = pin->enum_id; unsigned long flags; int ret = -EINVAL; int ret; spin_lock_irqsave(&pfc->lock, flags); Loading @@ -156,17 +154,17 @@ static int sh_pfc_reconfig_pin(struct sh_pfc_pinctrl *pmx, unsigned offset, case PINMUX_TYPE_INPUT_PULLDOWN: break; default: goto err; ret = -EINVAL; goto done; } if (sh_pfc_config_mux(pfc, mark, new_type) != 0) goto err; ret = sh_pfc_config_mux(pfc, mark, new_type); if (ret < 0) goto done; cfg->type = new_type; ret = 0; err: done: spin_unlock_irqrestore(&pfc->lock, flags); return ret; Loading