Re: [PATCH 3/5] spi: pxa2xx: use an enum for type
From: Lubomir Rintel
Date: Tue Oct 09 2018 - 12:43:52 EST
On Fri, 2018-09-21 at 22:34 +0200, Robert Jarzmik wrote:
> Lubomir Rintel <lkundrak@xxxxx> writes:
> > That seems to be the correct type.
> Okay, but what happens here when adev_id->driver_data is a value out
> of enum
> range ? Does the following assignment make sense ?
> > + type = (enum pxa_ssp_type)adev_id->driver_data;
No change in behavior. In standard C the enum type is compatible with
an integer type (char or larger), thus type would just hold a value
outside the rank of an enum.
But why would that happen? What we can get here is just the constants
from pxa2xx_spi_acpi_match, all of them of enum pxa_ssp_type type.
> As a side note, could you join for the next throw to the review :
> - Jarkko Nikula <jarkko.nikula@xxxxxxxxxxxxxxx>
> - Mika Westerberg <mika.westerberg@xxxxxxxxxxxxxxx>
> Even if they are Intel, I think they have worked a lot on this driver
> for Intel