From nobody Fri Dec 19 03:42:04 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4A4AD18EFE6 for ; Mon, 29 Jul 2024 22:37:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722292629; cv=none; b=G7YgI4IoxChlneeltomD1tBSuhRldjBb7H3WwC0eTW3ygR3UiB9s64dYxkfZAm/Y4zSdcLrBrfbcuEIIIu4C3fQiuRjymJS1O80W8+T/+le5Kaqn/FXS6DSwkUBKh8cNdQvG5KQpiPZfP28+Q7wlJUPqbjfhle6AtyK6dhQVgBA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722292629; c=relaxed/simple; bh=kYEpslrw3qv91f7QU65Rqm8td8PbyA3ZDp2nZ1DY0Es=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Ut0XbAR1fO/1ffEAXJ/yiwEbwxIbnk/mf/XFVINFt2LxbMJNqkXSkQpc4IBpwGfyCOXf/LJX6O+9uHh9Uo5QMogelwqAsthj6nUqbMnAA37gezm8GouiXk1F5TJTzsdnA8wodUJNOd14z1BQEJA60vl10GpikdUPF4TN7QUc1EE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nnbAnMun; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="nnbAnMun" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C0C9EC32786; Mon, 29 Jul 2024 22:37:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722292629; bh=kYEpslrw3qv91f7QU65Rqm8td8PbyA3ZDp2nZ1DY0Es=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=nnbAnMunqog+UAW2lrJNZaTfBP1tOWpXRfTIgWEstN8hJzVXU/2Sa/tHy9RpKMnK6 GA+VRXR/rQeEzdn7cnGg04nEec6+VLH5DJ5mRC3NGrpcgMFOlGxgi5/eDQlOvQSZYy s2Tfqtdy7+RpGPsSgIxx5NLZzaSndiIMgg4SHBEwUg1C/++hqunxnbKlufew8Z7jij K1BK6ZO5o546qcKA58lPb9IPVyXpI1M3JniWe7P3epxKghPYGQUbh+04s9aUVvh4zI xUsLZkloLwz4CVlUgkJH2UoplRY9ZlIniQFc4aI829zddsfoWe2Uv2LKxsZ5AvO6ek ZKQa2u6x1boKg== From: "Rob Herring (Arm)" Date: Mon, 29 Jul 2024 16:36:43 -0600 Subject: [PATCH 1/2] cxl: Drop printing of DT properties Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240729-dt-cxl-cleanup-v1-1-a75eea80d231@kernel.org> References: <20240729-dt-cxl-cleanup-v1-0-a75eea80d231@kernel.org> In-Reply-To: <20240729-dt-cxl-cleanup-v1-0-a75eea80d231@kernel.org> To: Frederic Barrat , Andrew Donnellan , Arnd Bergmann , Greg Kroah-Hartman Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.15-dev There's little reason to dump DT property values when they can be read at any time from the DT in /proc/device-tree. If such a feature is needed, then it really should be implemented in the DT core such that any module/driver can use it. Signed-off-by: Rob Herring (Arm) Acked-by: Andrew Donnellan --- drivers/misc/cxl/of.c | 101 ++--------------------------------------------= ---- 1 file changed, 3 insertions(+), 98 deletions(-) diff --git a/drivers/misc/cxl/of.c b/drivers/misc/cxl/of.c index bcc005dff1c0..21ecce0f9403 100644 --- a/drivers/misc/cxl/of.c +++ b/drivers/misc/cxl/of.c @@ -19,8 +19,6 @@ static const __be32 *read_prop_string(const struct device= _node *np, const __be32 *prop; =20 prop =3D of_get_property(np, prop_name, NULL); - if (cxl_verbose && prop) - pr_info("%s: %s\n", prop_name, (char *) prop); return prop; } =20 @@ -32,8 +30,6 @@ static const __be32 *read_prop_dword(const struct device_= node *np, prop =3D of_get_property(np, prop_name, NULL); if (prop) *val =3D be32_to_cpu(prop[0]); - if (cxl_verbose && prop) - pr_info("%s: %#x (%u)\n", prop_name, *val, *val); return prop; } =20 @@ -45,8 +41,6 @@ static const __be64 *read_prop64_dword(const struct devic= e_node *np, prop =3D of_get_property(np, prop_name, NULL); if (prop) *val =3D be64_to_cpu(prop[0]); - if (cxl_verbose && prop) - pr_info("%s: %#llx (%llu)\n", prop_name, *val, *val); return prop; } =20 @@ -100,9 +94,6 @@ static int read_phys_addr(struct device_node *np, char *= prop_name, type, prop_name); return -EINVAL; } - if (cxl_verbose) - pr_info("%s: %#x %#llx (size %#llx)\n", - prop_name, type, addr, size); } } return 0; @@ -139,27 +130,13 @@ int cxl_of_read_afu_handle(struct cxl_afu *afu, struc= t device_node *afu_np) =20 int cxl_of_read_afu_properties(struct cxl_afu *afu, struct device_node *np) { - int i, len, rc; - char *p; + int i, rc; const __be32 *prop; u16 device_id, vendor_id; u32 val =3D 0, class_code; =20 /* Properties are read in the same order as listed in PAPR */ =20 - if (cxl_verbose) { - pr_info("Dump of the 'ibm,coherent-platform-function' node properties:\n= "); - - prop =3D of_get_property(np, "compatible", &len); - i =3D 0; - while (i < len) { - p =3D (char *) prop + i; - pr_info("compatible: %s\n", p); - i +=3D strlen(p) + 1; - } - read_prop_string(np, "name"); - } - rc =3D read_phys_addr(np, "reg", afu); if (rc) return rc; @@ -173,19 +150,10 @@ int cxl_of_read_afu_properties(struct cxl_afu *afu, s= truct device_node *np) else afu->psa =3D true; =20 - if (cxl_verbose) { - read_prop_string(np, "ibm,loc-code"); - read_prop_string(np, "device_type"); - } - read_prop_dword(np, "ibm,#processes", &afu->max_procs_virtualised); =20 - if (cxl_verbose) { - read_prop_dword(np, "ibm,scratchpad-size", &val); - read_prop_dword(np, "ibm,programmable", &val); - read_prop_string(np, "ibm,phandle"); + if (cxl_verbose) read_vpd(NULL, afu); - } =20 read_prop_dword(np, "ibm,max-ints-per-process", &afu->guest->max_ints); afu->irqs_max =3D afu->guest->max_ints; @@ -199,17 +167,9 @@ int cxl_of_read_afu_properties(struct cxl_afu *afu, st= ruct device_node *np) afu->pp_irqs--; } =20 - if (cxl_verbose) { - read_prop_dword(np, "ibm,max-ints", &val); - read_prop_dword(np, "ibm,vpd-size", &val); - } - read_prop64_dword(np, "ibm,error-buffer-size", &afu->eb_len); afu->eb_offset =3D 0; =20 - if (cxl_verbose) - read_prop_dword(np, "ibm,config-record-type", &val); - read_prop64_dword(np, "ibm,config-record-size", &afu->crs_len); afu->crs_offset =3D 0; =20 @@ -235,15 +195,6 @@ int cxl_of_read_afu_properties(struct cxl_afu *afu, st= ruct device_node *np) i, class_code); } } - - read_prop_dword(np, "ibm,function-number", &val); - read_prop_dword(np, "ibm,privileged-function", &val); - read_prop_dword(np, "vendor-id", &val); - read_prop_dword(np, "device-id", &val); - read_prop_dword(np, "revision-id", &val); - read_prop_dword(np, "class-code", &val); - read_prop_dword(np, "subsystem-vendor-id", &val); - read_prop_dword(np, "subsystem-id", &val); } /* * if "ibm,process-mmio" doesn't exist then per-process mmio is @@ -256,12 +207,6 @@ int cxl_of_read_afu_properties(struct cxl_afu *afu, st= ruct device_node *np) else afu->pp_psa =3D false; =20 - if (cxl_verbose) { - read_prop_dword(np, "ibm,supports-aur", &val); - read_prop_dword(np, "ibm,supports-csrp", &val); - read_prop_dword(np, "ibm,supports-prr", &val); - } - prop =3D read_prop_dword(np, "ibm,function-error-interrupt", &val); if (prop) afu->serr_hwirq =3D val; @@ -343,49 +288,15 @@ int cxl_of_read_adapter_handle(struct cxl *adapter, s= truct device_node *np) =20 int cxl_of_read_adapter_properties(struct cxl *adapter, struct device_node= *np) { - int rc, len, naddr, i; - char *p; + int rc; const __be32 *prop; u32 val =3D 0; =20 /* Properties are read in the same order as listed in PAPR */ =20 - naddr =3D of_n_addr_cells(np); - - if (cxl_verbose) { - pr_info("Dump of the 'ibm,coherent-platform-facility' node properties:\n= "); - - read_prop_dword(np, "#address-cells", &val); - read_prop_dword(np, "#size-cells", &val); - - prop =3D of_get_property(np, "compatible", &len); - i =3D 0; - while (i < len) { - p =3D (char *) prop + i; - pr_info("compatible: %s\n", p); - i +=3D strlen(p) + 1; - } - read_prop_string(np, "name"); - read_prop_string(np, "model"); - - prop =3D of_get_property(np, "reg", NULL); - if (prop) { - pr_info("reg: addr:%#llx size:%#x\n", - of_read_number(prop, naddr), - be32_to_cpu(prop[naddr])); - } - - read_prop_string(np, "ibm,loc-code"); - } - if ((rc =3D read_adapter_irq_config(adapter, np))) return rc; =20 - if (cxl_verbose) { - read_prop_string(np, "device_type"); - read_prop_string(np, "ibm,phandle"); - } - prop =3D read_prop_dword(np, "ibm,caia-version", &val); if (prop) { adapter->caia_major =3D (val & 0xFF00) >> 8; @@ -411,12 +322,6 @@ int cxl_of_read_adapter_properties(struct cxl *adapter= , struct device_node *np) if (prop) adapter->guest->device =3D val; =20 - if (cxl_verbose) { - read_prop_dword(np, "ibm,privileged-facility", &val); - read_prop_dword(np, "revision-id", &val); - read_prop_dword(np, "class-code", &val); - } - prop =3D read_prop_dword(np, "subsystem-vendor-id", &val); if (prop) adapter->guest->subsystem_vendor =3D val; --=20 2.43.0 From nobody Fri Dec 19 03:42:04 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9CE8A18FC67 for ; Mon, 29 Jul 2024 22:37:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722292630; cv=none; b=WXjKPhI2xvRi79+NpBhq5ZuiV5IVtdjElej8l0381Ekx8ZnC0RwXvR/SX2gNXV/lZVnb0kf4ApF4tyvmzrcbEAFAV+6JpwYuTWDy5Jew1IsTToHbiRHFTuGQFiCepBX32ROKHWERf8SbImK0QG0OS0AmRl5k1XWDplE9VfHdBjw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722292630; c=relaxed/simple; bh=IXtp7HqcDIQj4kFmNqFhPVCKm3qy+JfE9YB4r53YkJ4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=A5zfquSZhviOzpaWCtwTr4ZN0VqYrZmPWUsnswRRVpJi1E+o/8dd9VbjRT1m/0HkjH2q7KYILz3ukJRUnuA+Lc9usQP8u7HD7PMsNJCm6GehpqjyOcbsVIXEelDMMQGpZXgxDfVgJ17WU9LlDEqihVPp5uSIialf5pmcwFbmG2Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=cU7zxDBU; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="cU7zxDBU" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44892C4AF09; Mon, 29 Jul 2024 22:37:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722292630; bh=IXtp7HqcDIQj4kFmNqFhPVCKm3qy+JfE9YB4r53YkJ4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=cU7zxDBUMqoGRm5uAIND0DvLyAbYj3s1CxqRxkIgmWd9WozNrj1w619qDlxJW1/l9 Syfrwz9ScitiCZX5UsxNI10d7IHhE3ROojx/s7UBpwIEbAUDqLK+0pmo3PJm3pIk9X fp6QNboBN+HMltlLHpuKlfxiZgDRFMo0oC6uZOVbe84Difz8vJX85OYeoxBWFseL+c NyyEnYrMIgWzuHIi6CcnB1aSSjKlx1tlZBTC8yUjL1McD6kP1DTEVXiJFWgn5+KwIO ijVuF6n4wu6e/lDndEK+dGUhDyw9cvLChEDiWE+vuMYw61We14fHxC0X75AOExfRA/ 5aCEo0uHnEbGQ== From: "Rob Herring (Arm)" Date: Mon, 29 Jul 2024 16:36:44 -0600 Subject: [PATCH 2/2] cxl: Use of_property_ accessor functions Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240729-dt-cxl-cleanup-v1-2-a75eea80d231@kernel.org> References: <20240729-dt-cxl-cleanup-v1-0-a75eea80d231@kernel.org> In-Reply-To: <20240729-dt-cxl-cleanup-v1-0-a75eea80d231@kernel.org> To: Frederic Barrat , Andrew Donnellan , Arnd Bergmann , Greg Kroah-Hartman Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.15-dev The CXL driver has its own custom implementations of typed DT property accessors. Replace the custom property accessor functions with the common DT property functions. This clean-up is part of a larger effort to remove of_get_property() and other DT functions which leak pointers to DT node and property data. Signed-off-by: Rob Herring (Arm) Acked-by: Andrew Donnellan --- drivers/misc/cxl/of.c | 106 ++++++++++-----------------------------------= ---- drivers/misc/cxl/pci.c | 32 ++++++--------- 2 files changed, 33 insertions(+), 105 deletions(-) diff --git a/drivers/misc/cxl/of.c b/drivers/misc/cxl/of.c index 21ecce0f9403..03633cccd043 100644 --- a/drivers/misc/cxl/of.c +++ b/drivers/misc/cxl/of.c @@ -7,59 +7,12 @@ #include #include #include +#include #include #include =20 #include "cxl.h" =20 - -static const __be32 *read_prop_string(const struct device_node *np, - const char *prop_name) -{ - const __be32 *prop; - - prop =3D of_get_property(np, prop_name, NULL); - return prop; -} - -static const __be32 *read_prop_dword(const struct device_node *np, - const char *prop_name, u32 *val) -{ - const __be32 *prop; - - prop =3D of_get_property(np, prop_name, NULL); - if (prop) - *val =3D be32_to_cpu(prop[0]); - return prop; -} - -static const __be64 *read_prop64_dword(const struct device_node *np, - const char *prop_name, u64 *val) -{ - const __be64 *prop; - - prop =3D of_get_property(np, prop_name, NULL); - if (prop) - *val =3D be64_to_cpu(prop[0]); - return prop; -} - - -static int read_handle(struct device_node *np, u64 *handle) -{ - const __be32 *prop; - u64 size; - - /* Get address and size of the node */ - prop =3D of_get_address(np, 0, &size, NULL); - if (size) - return -EINVAL; - - /* Helper to read a big number; size is in cells (not bytes) */ - *handle =3D of_read_number(prop, of_n_addr_cells(np)); - return 0; -} - static int read_phys_addr(struct device_node *np, char *prop_name, struct cxl_afu *afu) { @@ -121,17 +74,12 @@ static int read_vpd(struct cxl *adapter, struct cxl_af= u *afu) =20 int cxl_of_read_afu_handle(struct cxl_afu *afu, struct device_node *afu_np) { - if (read_handle(afu_np, &afu->guest->handle)) - return -EINVAL; - pr_devel("AFU handle: 0x%.16llx\n", afu->guest->handle); - - return 0; + return of_property_read_reg(afu_np, 0, &afu->guest->handle, NULL); } =20 int cxl_of_read_afu_properties(struct cxl_afu *afu, struct device_node *np) { int i, rc; - const __be32 *prop; u16 device_id, vendor_id; u32 val =3D 0, class_code; =20 @@ -150,16 +98,15 @@ int cxl_of_read_afu_properties(struct cxl_afu *afu, st= ruct device_node *np) else afu->psa =3D true; =20 - read_prop_dword(np, "ibm,#processes", &afu->max_procs_virtualised); + of_property_read_u32(np, "ibm,#processes", &afu->max_procs_virtualised); =20 if (cxl_verbose) read_vpd(NULL, afu); =20 - read_prop_dword(np, "ibm,max-ints-per-process", &afu->guest->max_ints); + of_property_read_u32(np, "ibm,max-ints-per-process", &afu->guest->max_int= s); afu->irqs_max =3D afu->guest->max_ints; =20 - prop =3D read_prop_dword(np, "ibm,min-ints-per-process", &afu->pp_irqs); - if (prop) { + if (!of_property_read_u32(np, "ibm,min-ints-per-process", &afu->pp_irqs))= { /* One extra interrupt for the PSL interrupt is already * included. Remove it now to keep only AFU interrupts and * match the native case. @@ -167,13 +114,13 @@ int cxl_of_read_afu_properties(struct cxl_afu *afu, s= truct device_node *np) afu->pp_irqs--; } =20 - read_prop64_dword(np, "ibm,error-buffer-size", &afu->eb_len); + of_property_read_u64(np, "ibm,error-buffer-size", &afu->eb_len); afu->eb_offset =3D 0; =20 - read_prop64_dword(np, "ibm,config-record-size", &afu->crs_len); + of_property_read_u64(np, "ibm,config-record-size", &afu->crs_len); afu->crs_offset =3D 0; =20 - read_prop_dword(np, "ibm,#config-records", &afu->crs_num); + of_property_read_u32(np, "ibm,#config-records", &afu->crs_num); =20 if (cxl_verbose) { for (i =3D 0; i < afu->crs_num; i++) { @@ -201,14 +148,12 @@ int cxl_of_read_afu_properties(struct cxl_afu *afu, s= truct device_node *np) * not supported */ val =3D 0; - prop =3D read_prop_dword(np, "ibm,process-mmio", &val); - if (prop && val =3D=3D 1) + if (!of_property_read_u32(np, "ibm,process-mmio", &val) && val =3D=3D 1) afu->pp_psa =3D true; else afu->pp_psa =3D false; =20 - prop =3D read_prop_dword(np, "ibm,function-error-interrupt", &val); - if (prop) + if (!of_property_read_u32(np, "ibm,function-error-interrupt", &val)) afu->serr_hwirq =3D val; =20 pr_devel("AFU handle: %#llx\n", afu->guest->handle); @@ -279,17 +224,13 @@ static int read_adapter_irq_config(struct cxl *adapte= r, struct device_node *np) =20 int cxl_of_read_adapter_handle(struct cxl *adapter, struct device_node *np) { - if (read_handle(np, &adapter->guest->handle)) - return -EINVAL; - pr_devel("Adapter handle: 0x%.16llx\n", adapter->guest->handle); - - return 0; + return of_property_read_reg(np, 0, &adapter->guest->handle, NULL); } =20 int cxl_of_read_adapter_properties(struct cxl *adapter, struct device_node= *np) { int rc; - const __be32 *prop; + const char *p; u32 val =3D 0; =20 /* Properties are read in the same order as listed in PAPR */ @@ -297,37 +238,30 @@ int cxl_of_read_adapter_properties(struct cxl *adapte= r, struct device_node *np) if ((rc =3D read_adapter_irq_config(adapter, np))) return rc; =20 - prop =3D read_prop_dword(np, "ibm,caia-version", &val); - if (prop) { + if (!of_property_read_u32(np, "ibm,caia-version", &val)) { adapter->caia_major =3D (val & 0xFF00) >> 8; adapter->caia_minor =3D val & 0xFF; } =20 - prop =3D read_prop_dword(np, "ibm,psl-revision", &val); - if (prop) + if (!of_property_read_u32(np, "ibm,psl-revision", &val)) adapter->psl_rev =3D val; =20 - prop =3D read_prop_string(np, "status"); - if (prop) { - adapter->guest->status =3D kasprintf(GFP_KERNEL, "%s", (char *) prop); + if (!of_property_read_string(np, "status", &p)) { + adapter->guest->status =3D kasprintf(GFP_KERNEL, "%s", p); if (adapter->guest->status =3D=3D NULL) return -ENOMEM; } =20 - prop =3D read_prop_dword(np, "vendor-id", &val); - if (prop) + if (!of_property_read_u32(np, "vendor-id", &val)) adapter->guest->vendor =3D val; =20 - prop =3D read_prop_dword(np, "device-id", &val); - if (prop) + if (!of_property_read_u32(np, "device-id", &val)) adapter->guest->device =3D val; =20 - prop =3D read_prop_dword(np, "subsystem-vendor-id", &val); - if (prop) + if (!of_property_read_u32(np, "subsystem-vendor-id", &val)) adapter->guest->subsystem_vendor =3D val; =20 - prop =3D read_prop_dword(np, "subsystem-id", &val); - if (prop) + if (!of_property_read_u32(np, "subsystem-id", &val)) adapter->guest->subsystem =3D val; =20 if (cxl_verbose) diff --git a/drivers/misc/cxl/pci.c b/drivers/misc/cxl/pci.c index 4cf9e7c42a24..3d52f9b92d0d 100644 --- a/drivers/misc/cxl/pci.c +++ b/drivers/misc/cxl/pci.c @@ -363,17 +363,17 @@ int cxl_calc_capp_routing(struct pci_dev *dev, u64 *c= hipid, { int rc; struct device_node *np; - const __be32 *prop; + u32 id; =20 if (!(np =3D pnv_pci_get_phb_node(dev))) return -ENODEV; =20 - while (np && !(prop =3D of_get_property(np, "ibm,chip-id", NULL))) + while (np && of_property_read_u32(np, "ibm,chip-id", &id)) np =3D of_get_next_parent(np); if (!np) return -ENODEV; =20 - *chipid =3D be32_to_cpup(prop); + *chipid =3D id; =20 rc =3D get_phb_index(np, phb_index); if (rc) { @@ -398,32 +398,26 @@ static DEFINE_MUTEX(indications_mutex); static int get_phb_indications(struct pci_dev *dev, u64 *capiind, u64 *asn= ind, u64 *nbwind) { - static u64 nbw, asn, capi =3D 0; + static u32 val[3]; struct device_node *np; - const __be32 *prop; =20 mutex_lock(&indications_mutex); - if (!capi) { + if (!val[0]) { if (!(np =3D pnv_pci_get_phb_node(dev))) { mutex_unlock(&indications_mutex); return -ENODEV; } =20 - prop =3D of_get_property(np, "ibm,phb-indications", NULL); - if (!prop) { - nbw =3D 0x0300UL; /* legacy values */ - asn =3D 0x0400UL; - capi =3D 0x0200UL; - } else { - nbw =3D (u64)be32_to_cpu(prop[2]); - asn =3D (u64)be32_to_cpu(prop[1]); - capi =3D (u64)be32_to_cpu(prop[0]); + if (of_property_read_u32_array(np, "ibm,phb-indications", val, 3)) { + val[2] =3D 0x0300UL; /* legacy values */ + val[1] =3D 0x0400UL; + val[0] =3D 0x0200UL; } of_node_put(np); } - *capiind =3D capi; - *asnind =3D asn; - *nbwind =3D nbw; + *capiind =3D val[0]; + *asnind =3D val[1]; + *nbwind =3D val[2]; mutex_unlock(&indications_mutex); return 0; } @@ -605,7 +599,7 @@ static void cxl_setup_psl_timebase(struct cxl *adapter,= struct pci_dev *dev) =20 /* Do not fail when CAPP timebase sync is not supported by OPAL */ of_node_get(np); - if (! of_get_property(np, "ibm,capp-timebase-sync", NULL)) { + if (!of_property_present(np, "ibm,capp-timebase-sync")) { of_node_put(np); dev_info(&dev->dev, "PSL timebase inactive: OPAL support missing\n"); return; --=20 2.43.0