[PATCH 3/5] powerpc/zImage: Check compatible at driver init

Michael Ellerman mpe at ellerman.id.au
Tue Mar 20 20:19:13 AEDT 2018


Oliver O'Halloran <oohall at gmail.com> writes:
> diff --git a/arch/powerpc/boot/mpc52xx-psc.c b/arch/powerpc/boot/mpc52xx-psc.c
> index c2c08633ee35..75470936e661 100644
> --- a/arch/powerpc/boot/mpc52xx-psc.c
> +++ b/arch/powerpc/boot/mpc52xx-psc.c
> @@ -52,6 +52,9 @@ static unsigned char psc_getc(void)
>  
>  int mpc5200_psc_console_init(void *devp, struct serial_console_data *scdp)
>  {
> +	if (!dt_is_compatible(devp, "fsl,mpc5200-psc-uart"))
> +		return 1;

Returning 1 raises the question of whether this is a bool-style function
that returns 1 on success and 0 on failure - or a UNIX style function
that returns 0 for sucesss and 1 on failure.

Can we return ENODEV, or just -1 instead to make it clearer?

cheers


More information about the Linuxppc-dev mailing list