Re: [PATCH] spi: nuc900: Fix setting multiple bits settings in register

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

 



Hi Axel,

On Fri, Mar 21, 2014 at 6:24 AM, Axel Lin <axel.lin@xxxxxxxxxx> wrote:
> -       val = __raw_readl(hw->regs + USI_CNT);
> +       val = __raw_readl(hw->regs + USI_CNT) & ~TXNUM;
>
> -       if (!txnum)
> -               val &= ~TXNUM;
> -       else
> +       if (txnum)
>                 val |= txnum << 0x08;

I think it's easier to read if you keep the masking and setting together,
and remove the conditional, e.g.

        val = __raw_readl(hw->regs + USI_CNT);
        val = (val & ~TXNUM) | (txnum << 0x08);
        __raw_writel(val, hw->regs + USI_CNT);

Just my personal thoughts, too.

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




[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux