Hi Laurent,
On Tue, Dec 31, 2013 at 12:47 AM, Laurent Pinchart
<[email protected]> wrote:
> On Tuesday 24 December 2013 12:40:44 Geert Uytterhoeven wrote:
>> +static void rspi_write_data(const struct rspi_data *rspi, u16 data)
>> +{
>> + if (rspi->data_width == 8)
>> + rspi_write8(rspi, data, RSPI_SPDR);
>> + else if (rspi->data_width == 16)
>> + rspi_write16(rspi, data, RSPI_SPDR);
>
> As the driver only handles 8-bits and 16-bits data, replacing the else if with
> an else should be more efficient.
Sure, will add a comment "/* 16 bit only */", though.
>> +static int rspi_parse_platform_data(struct rspi_data *rspi,
>> + const struct rspi_plat_data *rspi_pd)
>> +{
>> + if (rspi_pd && rspi_pd->data_width) {
>> + rspi->data_width = rspi_pd->data_width;
>> + switch (rspi_pd->data_width) {
>> + case 8:
>> + rspi->spdcr = SPDCR_SPLBYTE;
>> + break;
>> + case 16:
>> + rspi->spdcr = SPDCR_SPLWORD;
>> + break;
>> + default:
>> + return -1;
>
> Shouldn't you return a defined error code (-EINVAL maybe) ?
Sure.
Thanks for your comments!
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html