Re: [PATCH v4 1/2] cxl/region: Find free cxl decoder by device_for_each_child()

From: Dan Williams
Date: Mon Sep 09 2024 - 20:45:27 EST


Ira Weiny wrote:
[..]
> > This still feels more complex that I think it should be. Why not just
> > modify the needed device information after the device is found? What
> > exactly is being changed in the match_free_decoder that needs to keep
> > "state"? This feels odd.
>
> Agreed it is odd.
>
> How about adding?

I would prefer just dropping usage of device_find_ or device_for_each_
with storing an array decoders in the port directly. The port already
has arrays for dports , endpoints, and regions. Using the "device" APIs
to iterate children was a bit lazy, and if the id is used as the array
key then a direct lookup makes some cases simpler.