[PATCH 02/13] powerpc/rtasd: use correct OF API for event scan rate
Andrew Donnellan
ajd at linux.ibm.com
Tue Nov 22 13:39:32 AEDT 2022
On Fri, 2022-11-18 at 09:07 -0600, Nathan Lynch wrote:
> rtas_token() should be used only for properties that are RTAS
> function
> tokens. "rtas-event-scan-rate" does not contain a function token, but
> it
> has the same size/format as token properties so reading it with
> rtas_token() happens to work.
>
> Convert to of_property_read_u32().
>
> Signed-off-by: Nathan Lynch <nathanl at linux.ibm.com>
Did a quick grep for the other OF device tree properties listed in R1-
7.2.6-3 of PAPR to see if we make the same mistake elsewhere, and the
only other one is rtas-error-log-max which I see you clean up later in
the series.
Reviewed-by: Andrew Donnellan <ajd at linux.ibm.com>
> ---
> arch/powerpc/kernel/rtasd.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/kernel/rtasd.c
> b/arch/powerpc/kernel/rtasd.c
> index 5270b450bbde..cc56ac6ba4b0 100644
> --- a/arch/powerpc/kernel/rtasd.c
> +++ b/arch/powerpc/kernel/rtasd.c
> @@ -9,6 +9,7 @@
> #include <linux/errno.h>
> #include <linux/sched.h>
> #include <linux/kernel.h>
> +#include <linux/of.h>
> #include <linux/poll.h>
> #include <linux/proc_fs.h>
> #include <linux/init.h>
> @@ -499,6 +500,8 @@ EXPORT_SYMBOL_GPL(rtas_cancel_event_scan);
>
> static int __init rtas_event_scan_init(void)
> {
> + int err;
> +
> if (!machine_is(pseries) && !machine_is(chrp))
> return 0;
>
> @@ -509,8 +512,8 @@ static int __init rtas_event_scan_init(void)
> return -ENODEV;
> }
>
> - rtas_event_scan_rate = rtas_token("rtas-event-scan-rate");
> - if (rtas_event_scan_rate == RTAS_UNKNOWN_SERVICE) {
> + err = of_property_read_u32(rtas.dev, "rtas-event-scan-rate",
> &rtas_event_scan_rate);
> + if (err) {
> printk(KERN_ERR "rtasd: no rtas-event-scan-rate on
> system\n");
> return -ENODEV;
> }
--
Andrew Donnellan OzLabs, ADL Canberra
ajd at linux.ibm.com IBM Australia Limited
More information about the Linuxppc-dev
mailing list