[U-Boot] [PATCH v5 20/23] spi: mxs_spi: Use GENMASK

Marek Vasut marex at denx.de
Sat Oct 24 15:48:14 CEST 2015


On Saturday, October 24, 2015 at 03:42:43 PM, Jagan Teki wrote:
> On 24 October 2015 at 18:10, Marek Vasut <marex at denx.de> wrote:
> > On Saturday, October 24, 2015 at 05:39:07 AM, Jagan Teki wrote:
> >> Replace numeric mask hexcodes with GENMASK macro
> >> in mxs_spi
> >> 
> >> Cc: Marek Vasut <marex at denx.de>
> >> Signed-off-by: Jagan Teki <jteki at openedev.com>
> >> ---
> >> 
> >>  drivers/spi/mxs_spi.c | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >> 
> >> diff --git a/drivers/spi/mxs_spi.c b/drivers/spi/mxs_spi.c
> >> index 627644b..459c603 100644
> >> --- a/drivers/spi/mxs_spi.c
> >> +++ b/drivers/spi/mxs_spi.c
> >> @@ -23,7 +23,7 @@
> >> 
> >>  #define      MXS_SPI_MAX_TIMEOUT     1000000
> >>  #define      MXS_SPI_PORT_OFFSET     0x2000
> >> 
> >> -#define MXS_SSP_CHIPSELECT_MASK              0x00300000
> >> +#define MXS_SSP_CHIPSELECT_MASK              GENMASK(21, 20)
> >> 
> >>  #define MXS_SSP_CHIPSELECT_SHIFT     20
> > 
> > This is just making things unreadable, please keep it as is. NAK.
> 
> What's wrong with the GENMASK here is that something that you against
> with it? It don't look like unreadable.

If I open the datasheet, I can easily locate mask 0x0030_0000 and figure
out which bits I need to work with. With genmask ... not so much. It only
obfuscates the code.

Best regards,
Marek Vasut


More information about the U-Boot mailing list