Re: [PATCH v2] mmc: tmio: enable odd number size access

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Morimoto-san,

On Wed, Sep 10, 2014 at 3:29 AM, Kuninori Morimoto
<kuninori.morimoto.gx@xxxxxxxxx> wrote:
> +       if (is_read) {
> +               extra = sd_ctrl_read16(host, CTL_SD_DATA_PORT);
> +
> +               *buf8 = (u8)(extra & 0xff);
> +       } else {
> +               extra = (u16)(*buf8);
> +
> +               sd_ctrl_write16(host, CTL_SD_DATA_PORT, extra);

The casts to "u8" resp. "u16" are not needed.

You can even avoid introducing the "extra" variable:

if (is_read)
        *buf8 = sd_ctrl_read16(host, CTL_SD_DATA_PORT) & 0xff;
else
        sd_ctrl_write16(host, CTL_SD_DATA_PORT, *buf8);

Technically, the "& 0xff" is also not needed, but I'd keep it for clarity.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

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-mmc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux