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] [day] [month] [year] [list]
Date:   Sat, 22 Oct 2022 09:55:08 +0800
From:   Yinbo Zhu <zhuyinbo@...ngson.cn>
To:     Linus Walleij <linus.walleij@...aro.org>
Cc:     Rob Herring <robh+dt@...nel.org>,
        Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
        zhuyinbo@...ngson.cn, linux-gpio@...r.kernel.org,
        devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
        zhanghongchen <zhanghongchen@...ngson.cn>
Subject: Re: [PATCH v1 1/2] pinctrl: pinctrl-loongson2: add pinctrl driver
 support



在 2022/10/21 下午5:45, Linus Walleij 写道:
> Hi Yinbo,
> 
> thanks for your patch!
> 
> On Fri, Oct 21, 2022 at 3:27 AM Yinbo Zhu <zhuyinbo@...ngson.cn> wrote:
> 
>> The loongson2 SoC has a few pins that can be used as GPIOs or take
>> multiple other functions. Add a driver for the pinmuxing.
>>
>> There is currently no support for GPIO pin pull-up and pull-down.
>>
>> Signed-off-by: zhanghongchen <zhanghongchen@...ngson.cn>
>> Signed-off-by: Yinbo Zhu <zhuyinbo@...ngson.cn>
> 
> (...)
> 
>> +static int loongson2_pmx_set_mux(struct pinctrl_dev *pcdev, unsigned int func_num,
>> +                             unsigned int group_num)
>> +{
>> +       struct loongson2_pinctrl *pctrl = pinctrl_dev_get_drvdata(pcdev);
>> +       unsigned long reg = (unsigned long)pctrl->reg_base +
>> +                               loongson2_pmx_groups[group_num].reg;
>> +       unsigned int mux_bit = loongson2_pmx_groups[group_num].bit;
>> +       unsigned int val;
>> +       unsigned long flags;
>> +
>> +       raw_spin_lock_irqsave(&pctrl->lock, flags);
>> +       val = readl((void *)reg);
>> +       if (func_num == 0)
>> +               val &= ~(1<<mux_bit);
>> +       else
>> +               val |= (1<<mux_bit);
>> +       writel(val, (void *)reg);
>> +       raw_spin_unlock_irqrestore(&pctrl->lock, flags);
> 
> Can you explain in the commit message or with a comment in the code
> why you have to use a raw spinlock for this?
> 
> We usually only use raw spinlocks for things like low level
> interrupt handlers...
> 
> My guess is that you can replace this with an ordinary spinlock.
I was refer other platform, eg. pinctrl-amd.c, if the ordinary spinlock 
was more appropriate I will use the ordinary spinlock.

TKs
Yinbo.
> 
> Yours,
> Linus Walleij
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ