Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Vinod Koul <vkoul@kernel.org>
To: alsa-devel@alsa-project.org
Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
	Sanyog Kale <sanyog.r.kale@intel.com>,
	Bard Liao <yung-chuan.liao@linux.intel.com>,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
	Vinod Koul <vkoul@kernel.org>
Subject: [PATCH v2 2/9] soundwire: bus: use FIELD_GET()
Date: Thu,  3 Sep 2020 17:14:57 +0530	[thread overview]
Message-ID: <20200903114504.1202143-3-vkoul@kernel.org> (raw)
In-Reply-To: <20200903114504.1202143-1-vkoul@kernel.org>

use FIELD_GET() in bus code to extract field values instead of open
coding masks and shift operations.

Signed-off-by: Vinod Koul <vkoul@kernel.org>
---
 drivers/soundwire/bus.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c
index e6e0fb9a81b4..d808f0256ba0 100644
--- a/drivers/soundwire/bus.c
+++ b/drivers/soundwire/bus.c
@@ -347,8 +347,8 @@ int sdw_fill_msg(struct sdw_msg *msg, struct sdw_slave *slave,
 		return -EINVAL;
 	}
 
-	msg->addr_page1 = (addr >> SDW_REG_SHIFT(SDW_SCP_ADDRPAGE1_MASK));
-	msg->addr_page2 = (addr >> SDW_REG_SHIFT(SDW_SCP_ADDRPAGE2_MASK));
+	msg->addr_page1 = FIELD_GET(SDW_SCP_ADDRPAGE1_MASK, addr);
+	msg->addr_page2 = FIELD_GET(SDW_SCP_ADDRPAGE2_MASK, addr);
 	msg->addr |= BIT(15);
 	msg->page = true;
 
@@ -1420,7 +1420,7 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave)
 		port = buf & SDW_SCP_INT1_PORT0_3;
 
 		/* To get port number corresponding to bits, shift it */
-		port = port >> SDW_REG_SHIFT(SDW_SCP_INT1_PORT0_3);
+		port = FIELD_GET(SDW_SCP_INT1_PORT0_3, port);
 		for_each_set_bit(bit, &port, 8) {
 			sdw_handle_port_interrupt(slave, bit,
 						  &port_status[bit]);
-- 
2.26.2


  parent reply	other threads:[~2020-09-03 11:48 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-03 11:44 [PATCH v2 0/9] soundwire: use FIELD_{GET|PREP} in subsystem Vinod Koul
2020-09-03 11:44 ` [PATCH v2 1/9] soundwire: define and use addr bit masks Vinod Koul
2020-09-03 11:44 ` Vinod Koul [this message]
2020-09-03 11:44 ` [PATCH v2 3/9] soundwire: slave: use SDW_DISCO_LINK_ID() Vinod Koul
2020-09-03 11:44 ` [PATCH v2 4/9] soundwire: stream: use FIELD_{GET|PREP} Vinod Koul
2020-09-03 11:45 ` [PATCH v2 5/9] soundwire: qcom : " Vinod Koul
2020-09-03 11:45 ` [PATCH v2 6/9] soundwire: cadence: " Vinod Koul
2020-09-03 11:45 ` [PATCH v2 7/9] soundwire: intel: " Vinod Koul
2020-09-03 11:45 ` [PATCH v2 8/9] soundwire: intel_init: " Vinod Koul
2020-09-03 11:45 ` [PATCH v2 9/9] soundwire: remove SDW_REG_SHIFT() Vinod Koul
2020-09-04  7:46 ` [PATCH v2 0/9] soundwire: use FIELD_{GET|PREP} in subsystem Bard liao
2020-09-04  9:18   ` Vinod Koul

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=20200903114504.1202143-3-vkoul@kernel.org \
    --to=vkoul@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=sanyog.r.kale@intel.com \
    --cc=srinivas.kandagatla@linaro.org \
    --cc=yung-chuan.liao@linux.intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox