Hi Shaopeng, On 09/09/2025 08:11, Shaopeng Tan (Fujitsu) wrote: >> From: Shanker Donthineni <sdonthineni@xxxxxxxxxx> >> >> The device-tree binding has two examples for MSC associated with memory >> controllers. Add the support to discover the component_id from the device-tree >> and create 'memory' RIS. >> diff --git a/drivers/resctrl/mpam_devices.c b/drivers/resctrl/mpam_devices.c >> index a0d9a699a6e7..71a1fb1a9c75 100644 >> --- a/drivers/resctrl/mpam_devices.c >> +++ b/drivers/resctrl/mpam_devices.c >> @@ -62,41 +62,63 @@ static int mpam_dt_parse_resource(struct mpam_msc >> *msc, struct device_node *np, >> u32 ris_idx) >> { >> int err = 0; >> - u32 level = 0; >> - unsigned long cache_id; >> - struct device_node *cache; >> + u32 class_id = 0, component_id = 0; >> + struct device_node *cache = NULL, *memory = NULL; >> + enum mpam_class_types type = MPAM_CLASS_UNKNOWN; >> >> do { >> + /* What kind of MSC is this? */ >> if (of_device_is_compatible(np, "arm,mpam-cache")) { >> cache = of_parse_phandle(np, "arm,mpam-device", >> 0); >> if (!cache) { >> pr_err("Failed to read phandle\n"); >> break; >> } >> + type = MPAM_CLASS_CACHE; >> } else if (of_device_is_compatible(np->parent, "cache")) { >> cache = of_node_get(np->parent); >> + type = MPAM_CLASS_CACHE; >> + } else if (of_device_is_compatible(np, "arm,mpam-memory")) >> { >> + memory = of_parse_phandle(np, "arm,mpam-device", >> 0); >> + if (!memory) { >> + pr_err("Failed to read phandle\n"); >> + break; >> + } >> + type = MPAM_CLASS_MEMORY; >> + } else if (of_device_is_compatible(np, >> "arm,mpam-memory-controller-msc")) { >> + memory = of_node_get(np->parent); >> + type = MPAM_CLASS_MEMORY; >> } else { >> - /* For now, only caches are supported */ >> - cache = NULL; >> + /* >> + * For now, only caches and memory controllers are >> + * supported. >> + */ >> break; >> } > There is no need "{}" here. Sure, but its more than one line, and all the previous parts of this else-if tree have them. Keeping this here make it much easier to read. Thanks, James