lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120821090508.GC10347@arwen.pp.htv.fi>
Date:	Tue, 21 Aug 2012 12:05:09 +0300
From:	Felipe Balbi <balbi@...com>
To:	Shubhrajyoti D <shubhrajyoti@...com>
Cc:	spi-devel-general@...ts.sourceforge.net,
	linux-omap@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/3] spi: omap2-mcspi: Remove the macro MOD_REG_BIT

On Tue, Aug 21, 2012 at 11:47:43AM +0530, Shubhrajyoti D wrote:
> Remove the macro MOD_REG_BIT instead make the bit field modifications
> directly. This deletes a branch operation in cases where the the set
> is predecided.While at it optimise two sequential bit clear in one step.
               ^^
	       you need a space here, besides you can add the ack below

> Signed-off-by: Shubhrajyoti D <shubhrajyoti@...com>

Acked-by: Felipe Balbi <balbi@...com>

> ---
>  drivers/spi/spi-omap2-mcspi.c |   28 ++++++++++++++--------------
>  1 files changed, 14 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
> index dd887eb..5642111 100644
> --- a/drivers/spi/spi-omap2-mcspi.c
> +++ b/drivers/spi/spi-omap2-mcspi.c
> @@ -140,13 +140,6 @@ struct omap2_mcspi_cs {
>  	u32			chconf0;
>  };
>  
> -#define MOD_REG_BIT(val, mask, set) do { \
> -	if (set) \
> -		val |= mask; \
> -	else \
> -		val &= ~mask; \
> -} while (0)
> -
>  static inline void mcspi_write_reg(struct spi_master *master,
>  		int idx, u32 val)
>  {
> @@ -205,7 +198,11 @@ static void omap2_mcspi_set_dma_req(const struct spi_device *spi,
>  	else
>  		rw = OMAP2_MCSPI_CHCONF_DMAW;
>  
> -	MOD_REG_BIT(l, rw, enable);
> +	if (enable)
> +		l |= rw;
> +	else
> +		l &= ~rw;
> +
>  	mcspi_write_chconf0(spi, l);
>  }
>  
> @@ -224,7 +221,11 @@ static void omap2_mcspi_force_cs(struct spi_device *spi, int cs_active)
>  	u32 l;
>  
>  	l = mcspi_cached_chconf0(spi);
> -	MOD_REG_BIT(l, OMAP2_MCSPI_CHCONF_FORCE, cs_active);
> +	if (cs_active)
> +		l |= OMAP2_MCSPI_CHCONF_FORCE;
> +	else
> +		l &= ~OMAP2_MCSPI_CHCONF_FORCE;
> +
>  	mcspi_write_chconf0(spi, l);
>  }
>  
> @@ -239,9 +240,8 @@ static void omap2_mcspi_set_master_mode(struct spi_master *master)
>  	 * to single-channel master mode
>  	 */
>  	l = mcspi_read_reg(master, OMAP2_MCSPI_MODULCTRL);
> -	MOD_REG_BIT(l, OMAP2_MCSPI_MODULCTRL_STEST, 0);
> -	MOD_REG_BIT(l, OMAP2_MCSPI_MODULCTRL_MS, 0);
> -	MOD_REG_BIT(l, OMAP2_MCSPI_MODULCTRL_SINGLE, 1);
> +	l &= ~(OMAP2_MCSPI_MODULCTRL_STEST | OMAP2_MCSPI_MODULCTRL_MS);
> +	l |= OMAP2_MCSPI_MODULCTRL_SINGLE;
>  	mcspi_write_reg(master, OMAP2_MCSPI_MODULCTRL, l);
>  
>  	ctx->modulctrl = l;
> @@ -1276,9 +1276,9 @@ static int omap2_mcspi_resume(struct device *dev)
>  			 * We need to toggle CS state for OMAP take this
>  			 * change in account.
>  			 */
> -			MOD_REG_BIT(cs->chconf0, OMAP2_MCSPI_CHCONF_FORCE, 1);
> +			cs->chconf0 |= OMAP2_MCSPI_CHCONF_FORCE;
>  			__raw_writel(cs->chconf0, cs->base + OMAP2_MCSPI_CHCONF0);
> -			MOD_REG_BIT(cs->chconf0, OMAP2_MCSPI_CHCONF_FORCE, 0);
> +			cs->chconf0 &= ~OMAP2_MCSPI_CHCONF_FORCE;
>  			__raw_writel(cs->chconf0, cs->base + OMAP2_MCSPI_CHCONF0);
>  		}
>  	}
> -- 
> 1.7.5.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

-- 
balbi

Download attachment "signature.asc" of type "application/pgp-signature" (837 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ