]> www.infradead.org Git - users/jedix/linux-maple.git/commit
cxl/region: Drop goto pattern of construct_region()
authorLi Ming <ming.li@zohomail.com>
Fri, 21 Feb 2025 01:32:05 +0000 (09:32 +0800)
committerDave Jiang <dave.jiang@intel.com>
Fri, 14 Mar 2025 21:59:34 +0000 (14:59 -0700)
commit5ec67596e368cdddddd6770fc2dd2e577e82fbe8
tree267c5930e848216456b0796ec5539e51b286d2e9
parent9e7b7ab5af69aaa5cd027656529663407da61e6f
cxl/region: Drop goto pattern of construct_region()

Some operations need to be protected by the cxl_region_rwsem in
construct_region(). Currently, construct_region() uses down_write() and
up_write() for the cxl_region_rwsem locking, so there is a goto pattern
after down_write() invoked to release cxl_region_rwsem.

construct region() can be optimized to remove the goto pattern. The
changes are creating a new function called __construct_region() which
will include all checking and operations protected by the
cxl_region_rwsem, and using guard(rwsem_write) to replace down_write()
and up_write() in __construct_region().

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Alison Schofield <alison.schofield@intel.com>
Reviewed-by: Dan Williams <dan.j.williams@intel.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Acked-by: Davidlohr Bueso <dave@stgolabs.net>
Signed-off-by: Li Ming <ming.li@zohomail.com>
Link: https://patch.msgid.link/20250221013205.126419-1-ming.li@zohomail.com
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
drivers/cxl/core/region.c