From: Shubhrajyoti <shubhrajyoti@ti.com>
To: balbi@ti.com
Cc: spi-devel-general@lists.sourceforge.net,
linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] spi: omap2-mcspi: Remove the macro MOD_REG_BIT
Date: Wed, 22 Aug 2012 11:22:41 +0530 [thread overview]
Message-ID: <503473A9.4060805@ti.com> (raw)
In-Reply-To: <20120821090508.GC10347@arwen.pp.htv.fi>
Hi Felipe,
Thanks for the review
On Tuesday 21 August 2012 02:35 PM, Felipe Balbi wrote:
> 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
Will fix that and resend.
>> Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
> Acked-by: Felipe Balbi <balbi@ti.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@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>> Please read the FAQ at http://www.tux.org/lkml/
next prev parent reply other threads:[~2012-08-22 5:52 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-21 6:17 [PATCH 0/3] spi: omap2-mcspi: spi cleanups Shubhrajyoti D
2012-08-21 6:17 ` Shubhrajyoti D
2012-08-21 6:17 ` Shubhrajyoti D
[not found] ` <1345529864-7937-1-git-send-email-shubhrajyoti-l0cyMroinI0@public.gmane.org>
2012-08-21 6:17 ` [PATCH 1/3] spi: omap2-mcspi: Call pm_runtime_* functions directly Shubhrajyoti D
2012-08-21 6:17 ` Shubhrajyoti D
2012-08-21 6:17 ` Shubhrajyoti D
2012-08-21 9:04 ` Felipe Balbi
2012-08-21 6:17 ` [PATCH 2/3] spi: omap2-mcspi: Remove the macro MOD_REG_BIT Shubhrajyoti D
2012-08-21 6:17 ` Shubhrajyoti D
2012-08-21 6:17 ` Shubhrajyoti D
2012-08-21 9:05 ` Felipe Balbi
2012-08-22 5:52 ` Shubhrajyoti [this message]
2012-08-21 6:17 ` [PATCH 3/3] spi: omap2-mcspi: At remove dont use the runtime_autosuspend calls Shubhrajyoti D
2012-08-21 6:17 ` Shubhrajyoti D
2012-08-21 6:17 ` Shubhrajyoti D
2012-08-21 9:06 ` Felipe Balbi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=503473A9.4060805@ti.com \
--to=shubhrajyoti@ti.com \
--cc=balbi@ti.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=spi-devel-general@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.