Re: [PATCH 05/26] cxl/core: Simplify cxl_dpa_set_mode()
From: Ira Weiny
Date: Fri Apr 05 2024 - 15:22:16 EST
Dave Jiang wrote:
>
>
> On 3/24/24 4:18 PM, Ira Weiny wrote:
> > cxl_dpa_set_mode() checks the mode for validity two times, once outside
> > of the DPA RW semaphore and again within. The function is not in a
> > critical path. Prior to Dynamic Capacity the extra check was not much
> > of an issue. The addition of DC modes increases the complexity of
> > the check.
> >
> > Simplify the mode check before adding the more complex DC modes.
>
> I would augment this by saying simplify "by using scope-based resource menagement".
However, using the guard cleanup is not really the simplification here. It is
more about checking the mode a single time.
That said I will change this to:
Simplify the mode check and convert to use of a cleanup guard.
Ira