Messages in this thread | ![/](/images/icornerl.gif) | | Date | Thu, 9 May 2024 22:31:39 -0700 | From | Ira Weiny <> | Subject | Re: [PATCH 06/26] cxl/port: Add Dynamic Capacity mode support to endpoint decoders |
| |
Dan Williams wrote: > Ira Weiny wrote: > [..] > > > > + case CXL_DECODER_DC0 ... CXL_DECODER_DC7: > > > > + rc = dc_mode_to_region_index(mode); > > > > + if (rc < 0) > > > > + return rc; > > > > > > Can't fail, so you could not bother checking.. Seems very unlikely > > > that function will gain other error cases in the future. > > > > Sure, done. > > Can dc_mode_to_region_index() be dropped altogether? Is there any > scenario where dc_mode_to_region_index() is really handling an anonymous > @mode argument? I.e. just replace all dc_mode_to_region_index() with > "mode - CXL_DECODER_DC0"?
Once we open up DC partitions to support multiple regions, no.
How about we remove the check in dc_mode_to_region_index() but keep the function? That makes it clear that we are converting from an enum to int index?
Ira
| ![\](/images/icornerr.gif) |