lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 21 Feb 2022 17:59:39 +0800
From:   Chen-Yu Tsai <wenst@...omium.org>
To:     AngeloGioacchino Del Regno 
        <angelogioacchino.delregno@...labora.com>
Cc:     sean.wang@...nel.org, linus.walleij@...aro.org,
        matthias.bgg@...il.com, linux-mediatek@...ts.infradead.org,
        linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org, kernel@...labora.com
Subject: Re: [PATCH 4/5] pinctrl: mediatek: common-v1: Commonize spec_pupd callback

On Thu, Feb 10, 2022 at 10:20 PM AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com> wrote:
>
> Reduce code size and duplication by using a common spec_pupd callback,
> which is possible to use on all of the pinctrl drivers that are
> using the v1 pinctrl-mtk-common code, with the exception of mt8135,
> which has a different handling compared to the others.
> Since the callback function signature was changed, this had to be
> propagated to pinctrl-mt8135's spec_pull_set().
>
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>
> ---

[...]

> diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> index 007da39b68c9..5e1d17512a0d 100644
> --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> @@ -222,9 +222,8 @@ static int mtk_pconf_set_driving(struct mtk_pinctrl *pctl,
>  }
>
>  int mtk_pctrl_spec_pull_set_samereg(struct regmap *regmap,
> -               const struct mtk_pin_spec_pupd_set_samereg *pupd_infos,
> -               unsigned int info_num, unsigned int pin,
> -               unsigned char align, bool isup, unsigned int r1r0)
> +               const struct mtk_pinctrl_devdata *devdata,
> +               unsigned int pin, bool isup, unsigned int r1r0)
>  {
>         unsigned int i;
>         unsigned int reg_pupd, reg_set, reg_rst;
> @@ -232,8 +231,11 @@ int mtk_pctrl_spec_pull_set_samereg(struct regmap *regmap,
>         const struct mtk_pin_spec_pupd_set_samereg *spec_pupd_pin;
>         bool find = false;
>
> -       for (i = 0; i < info_num; i++) {
> -               if (pin == pupd_infos[i].pin) {
> +       if (!devdata->spec_pupd)
> +               return -EINVAL;
> +
> +       for (i = 0; i < devdata->n_spec_pupd; i++) {
> +               if (pin == devdata->spec_pupd[i].pin) {
>                         find = true;
>                         break;
>                 }
> @@ -242,9 +244,9 @@ int mtk_pctrl_spec_pull_set_samereg(struct regmap *regmap,
>         if (!find)
>                 return -EINVAL;
>
> -       spec_pupd_pin = pupd_infos + i;
> -       reg_set = spec_pupd_pin->offset + align;
> -       reg_rst = spec_pupd_pin->offset + (align << 1);
> +       spec_pupd_pin = devdata->spec_pupd + i;
> +       reg_set = spec_pupd_pin->offset + devdata->port_align;
> +       reg_rst = spec_pupd_pin->offset + (devdata->port_align << 1);
>
>         if (isup)
>                 reg_pupd = reg_rst;
> @@ -293,12 +295,13 @@ static int mtk_pconf_set_pull_select(struct mtk_pinctrl *pctl,
>          * resistor bit, so we need this special handle.
>          */
>         if (pctl->devdata->spec_pull_set) {
> -               /* For special pins, bias-disable is set by R1R0,
> +               /* For special pins, bias-disable is set by R1R0

Nit: This seems unrelated, and doesn't read correctly either way.

ChenYu

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ