Re: [PATCH v4 2/8] kunit: drm/tests: move generic helpers

From: Matti Vaittinen
Date: Sun Mar 19 2023 - 02:36:30 EST


Hi Maxime & All

First of all - I am sorry. During the last minute rebase I accidentally dropped the header file from this series. Will fix that for v5. (Also the build bot pointed this mistake).

On 3/17/23 17:09, Maxime Ripard wrote:
Hi Matti,

On Fri, Mar 17, 2023 at 04:42:25PM +0200, Matti Vaittinen wrote:
The creation of a dummy device in order to test managed interfaces is a
generally useful test feature. The drm test helpers
test_kunit_helper_alloc_device() and test_kunit_helper_free_device()
are doing exactly this. It makes no sense that each and every component
which intends to be testing managed interfaces will create similar
helpers.

Move these functions to place where it is more obvious they can be used
also by other subsystems but drm.

Signed-off-by: Matti Vaittinen <mazziesaccount@xxxxxxxxx>

---

Please note that there's something similat ongoing in the CCF:
https://lore.kernel.org/all/20230302013822.1808711-1-sboyd@xxxxxxxxxx/

I do like the simplicity of these DRM-originated helpers so I think
they're worth. I do equally like the Stephen's idea of having the
"dummy platform device" related helpers under drivers/base and the
header being in include/kunit/platform_device.h which is similar to real
platform device under include/linux/platform_device.h - so, in the end
of the day I hope Stephen's changes as well as the changes this patch
introduces to end up in those files. This, however, will require some
co-operation to avoid conflicts.

I think you would have an easier time if you just copied and renamed
them into the kunit folder as an preparation series.

Yes. That would simplify the syncing between the trees. It slightly bugs me to add dublicate code in kernel-but the clean-up series for DRM users could be prepared at the same time. It would be even possible to just change the drm-helper to be a wrapper for the generic one - and leave the callers intact - although it leaves some seemingly unnecessary "onion code" there.

That way, you wouldn't have to coordinate DRM, CCF and IIO, you'd just
create new helpers that can be reused/converted to by everyone eventually

Yes. Thanks - I think I may go with this approach for the v5 :)

Yours,
-- Matti

--
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland

~~ When things go utterly wrong vim users can always type :help! ~~