Re: [PATCH v3 1/2] gpio: dt-bindings: add parsing of loongson gpio offset

From: Yinbo Zhu
Date: Tue Aug 22 2023 - 23:37:54 EST




在 2023/8/15 下午4:59, Linus Walleij 写道:
On Mon, Aug 14, 2023 at 5:39 AM Yinbo Zhu <zhuyinbo@xxxxxxxxxxx> wrote:

Why do you want to put it into device-tree so badly? This is not the
first driver that would have of_match_data for different variants
where you can have a structure that would keep offsets for different
models. It's not like you will have hundreds of "compatible" chips
anyway, most likely just a few?

Using this ways that put offset property into device-tree that can be
compatible with future GPIO chips without the need to modify drivers,
such as more 2K chips in the future, but use of_match_data and data
field of_device_id, which every time a new SoC is released, the GPIO
driver needs to be modified once, which is not friendly to us.

The purpose of device tree is to describe the hardware and
to configure it for a target system.

The purpose of device tree is not to make driver writing easy
or convenient. It often does, but that is not the purpose.

These offsets are not relevant to the people that need to
author and maintain device trees to support and tailor their
system. They are only relevant to driver authors and SoC
manufacturers.

What about just writing these offsets into the driver and use
the compatible match to look them up.



okay, I got it, I had following your advice and send v4 to upstream,
please you help review it.

Thanks,
Yinbo