Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

dax/hmem: Factor HMEM registration into __hmem_register_device()

Separate the CXL overlap check from the HMEM registration path and keep
the platform-device setup in a dedicated __hmem_register_device().

This makes hmem_register_device() the policy entry point for deciding
whether a range should be deferred to CXL, while __hmem_register_device()
handles the HMEM registration flow.

No functional changes.

Signed-off-by: Smita Koralahalli <Smita.KoralahalliChannabasappa@amd.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Link: https://patch.msgid.link/20260322195343.206900-3-Smita.KoralahalliChannabasappa@amd.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>

authored by

Smita Koralahalli and committed by
Dave Jiang
116be1e1 14f2e2eb

+15 -9
+15 -9
drivers/dax/hmem/hmem.c
··· 58 58 platform_device_unregister(pdev); 59 59 } 60 60 61 - static int hmem_register_device(struct device *host, int target_nid, 62 - const struct resource *res) 61 + static int __hmem_register_device(struct device *host, int target_nid, 62 + const struct resource *res) 63 63 { 64 64 struct platform_device *pdev; 65 65 struct memregion_info info; 66 66 long id; 67 67 int rc; 68 - 69 - if (IS_ENABLED(CONFIG_CXL_REGION) && 70 - region_intersects(res->start, resource_size(res), IORESOURCE_MEM, 71 - IORES_DESC_CXL) != REGION_DISJOINT) { 72 - dev_dbg(host, "deferring range to CXL: %pr\n", res); 73 - return 0; 74 - } 75 68 76 69 rc = region_intersects_soft_reserve(res->start, resource_size(res)); 77 70 if (rc != REGION_INTERSECTS) ··· 114 121 out_put: 115 122 platform_device_put(pdev); 116 123 return rc; 124 + } 125 + 126 + static int hmem_register_device(struct device *host, int target_nid, 127 + const struct resource *res) 128 + { 129 + if (IS_ENABLED(CONFIG_CXL_REGION) && 130 + region_intersects(res->start, resource_size(res), IORESOURCE_MEM, 131 + IORES_DESC_CXL) != REGION_DISJOINT) { 132 + dev_dbg(host, "deferring range to CXL: %pr\n", res); 133 + return 0; 134 + } 135 + 136 + return __hmem_register_device(host, target_nid, res); 117 137 } 118 138 119 139 static int dax_hmem_platform_probe(struct platform_device *pdev)