[PATCH 3/5] powerpc/zImage: Check compatible at driver init
oohall at gmail.com
Tue Mar 20 23:56:44 AEDT 2018
On Tue, Mar 20, 2018 at 8:19 PM, Michael Ellerman <mpe at ellerman.id.au> wrote:
> 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?
I figured we would want to differentiate between a mis-matched driver
and any other error type. There's no existing definition of ENODEV and
friends in the wrapper so I just used positive 1 as a half-assed
workaround. I don't have particularly strong feelings about it so
adding an explicit ENODEV would make things a bit cleaner. I'll fix it
on the respin.
More information about the Linuxppc-dev