[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <d0640075-289a-e5ac-132a-c4fb8e151ad2@loongson.cn>
Date: Fri, 24 Feb 2023 10:15:50 +0800
From: suijingfeng <suijingfeng@...ngson.cn>
To: Thomas Zimmermann <tzimmermann@...e.de>,
suijingfeng <15330273260@....cn>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>
Cc: dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
Li Yi <liyi@...ngson.cn>
Subject: Re: [PATCH v4] drm: add kms driver for loongson display controller
On 2023/2/23 22:07, Thomas Zimmermann wrote:
>
> It's the same story all over: you rather want to remove all these
> lookup helpers and do a single test before you create the modesetting
> pipeline:
>
> if (chip == LS7A2000 && index == 0)
> lscd_create_output_ls7a2000_0();
> else if (chip == LS7A2000 && index == 1)
> lscd_create_output_ls7a2000_1();
> else if (chip == LS7A1000 && index == 0)
> lscd_create_output_ls7a1000_0();
> else if (chip == LS7A1000 && index == 1)
> lscd_create_output_ls7a1000_1();
> else if (...)
> ...
>
> There you create the data structures for each pair of chip and index.
> If you have functions that can be used by multiple pairs, sharing
> those is fine. You might end up with duplicated code, but the overall
> design is sound.
>
> Your current design will become unmaintainable pretty soon. We already
> have several of such drivers.
Yes, your are right.
I'm fear of the duplicated code in the past.
I did not put my attention to the maintainable of the software.
a quick skim through radeon, I find that there also seems have
"duplicated" code, this is a design.
I didn't get it before, now I get it.
Powered by blists - more mailing lists