[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <768426b7-7192-8902-1d93-189a7fd64214@loongson.cn>
Date: Fri, 11 Aug 2023 11:50:30 +0800
From: Yinbo Zhu <zhuyinbo@...ngson.cn>
To: Linus Walleij <linus.walleij@...aro.org>
Cc: Bartosz Golaszewski <brgl@...ev.pl>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Conor Dooley <conor+dt@...nel.org>, linux-gpio@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
Jianmin Lv <lvjianmin@...ngson.cn>, wanghongliang@...ngson.cn,
loongson-kernel@...ts.loongnix.cn, zhuyinbo@...ngson.cn
Subject: Re: [PATCH v3 2/2] gpio: loongson: add firmware offset parse support
在 2023/8/10 下午4:27, Linus Walleij 写道:
> Hi Yinbo,
>
> thanks for your patch!
>
> On Mon, Aug 7, 2023 at 9:41 AM Yinbo Zhu <zhuyinbo@...ngson.cn> wrote:
>
>> Loongson GPIO controllers come in multiple variants that are compatible
>> except for certain register offset values. Add support for device
>> properties allowing to specify them in ACPI or DT.
>>
>> Signed-off-by: Yinbo Zhu <zhuyinbo@...ngson.cn>
>
> (...)
>> @@ -26,6 +26,7 @@ struct loongson_gpio_chip_data {
>> unsigned int conf_offset;
>> unsigned int out_offset;
>> unsigned int in_offset;
>> + unsigned int inten_offset;
>
> Consider just changing all of these from unsigned int to u32.
okay, I got it.
>
> (...)
>> + if (device_property_read_u32(dev, "loongson,gpio-conf-offset", (u32 *)&d->conf_offset)
>> + || device_property_read_u32(dev, "loongson,gpio-in-offset", (u32 *)&d->in_offset)
>> + || device_property_read_u32(dev, "loongson,gpio-out-offset", (u32 *)&d->out_offset)
>> + || device_property_read_u32(dev, "loongson,gpio-ctrl-mode", (u32 *)&d->mode))
>
> Because then you can get rid of this annoying forest of cast.
Change offset to u32 and here still need use a (u32 *) cast, because the
chip_data is const type so &chip_data->offset will be (const u32 *) type
and need a (u32 *) cast.
>
> I'm fine with doing this change in this patch without a need for a separate
> refactoring, as it's just a contained driver and clearly just about typing.
okay, I got it.
Thanks,
Yinbo.
Powered by blists - more mailing lists