mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: "Jonathan Neuschäfer" <j.neuschaefer@gmx.net>,
	"Charles Keepax" <ckeepax@opensource.cirrus.com>
Cc: gregkh@linuxfoundation.org, broonie@kernel.org,
	alsa-devel@alsa-project.org, sdharia@codeaurora.org, bp@suse.de,
	poeschel@lemonage.de, treding@nvidia.com,
	andreas.noever@gmail.com, alan@linux.intel.com,
	mathieu.poirier@linaro.org, daniel@ffwll.ch, jkosina@suse.cz,
	sharon.dvir1@mail.huji.ac.il, joe@perches.com,
	davem@davemloft.net, james.hogan@imgtec.com,
	michael.opdenacker@free-electrons.com, robh+dt@kernel.org,
	pawel.moll@arm.com, mark.rutland@arm.com,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-msm@vger.kernel.org, vinod.koul@intel.com,
	arnd@arndb.de
Subject: Re: [PATCH v7 11/13] slimbus: qcom: Add Qualcomm Slimbus controller driver
Date: Fri, 24 Nov 2017 14:40:10 +0000	[thread overview]
Message-ID: <7200d3c4-79c8-b461-9883-182a1c8b4476@linaro.org> (raw)
In-Reply-To: <20171123164212.655yliz3tmlpsjje@latitude>

Thanks for your review,

On 23/11/17 16:42, Jonathan Neuschäfer wrote:
> Hello Srinivas and Charles,
> 
> On Thu, Nov 23, 2017 at 10:07:03AM +0000, Charles Keepax wrote:
>> On Wed, Nov 15, 2017 at 02:10:41PM +0000, srinivas.kandagatla@linaro.org wrote:
>>> From: Sagar Dharia <sdharia@codeaurora.org>
>>>
>>> This controller driver programs manager, interface, and framer
>>> devices for Qualcomm's slimbus HW block.
>>> Manager component currently implements logical address setting,
>>> and messaging interface.
>>> Interface device reports bus synchronization information, and framer
>>> device clocks the bus from the time it's woken up, until clock-pause
>>> is executed by the manager device.
>>>
>>> Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
>>> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
>>> ---
> [...]
>>> +static void qcom_slim_rxwq(struct work_struct *work)
>>> +{
>>> +	u8 buf[SLIM_MSGQ_BUF_LEN];
>>> +	u8 mc, mt, len;
>>> +	int i, ret;
>>> +	struct qcom_slim_ctrl *ctrl = container_of(work, struct qcom_slim_ctrl,
>>> +						 wd);
>>> +
>>> +	while ((slim_get_current_rxbuf(ctrl, buf)) != -ENODATA) {
>>> +		len = SLIM_HEADER_GET_RL(buf[0]);
>>> +		mt = SLIM_HEADER_GET_MT(buf[0]);
>>> +		mc = SLIM_HEADER_GET_MC(buf[1]);
>>> +		if (mt == SLIM_MSG_MT_CORE &&
>>> +			mc == SLIM_MSG_MC_REPORT_PRESENT) {
>>> +			u8 laddr;
>>> +			struct slim_eaddr ea;
>>> +			u8 e_addr[6];
>>> +
>>> +			for (i = 0; i < 6; i++)
>>> +				e_addr[i] = buf[7-i];
>>> +
>>> +			ea.manf_id = (u16)(e_addr[5] << 8) | e_addr[4];
>>> +			ea.prod_code = (u16)(e_addr[3] << 8) | e_addr[2];
>>> +			ea.dev_index = e_addr[1];
>>> +			ea.instance = e_addr[0];
>>
>> If we are just bitshifting this out of the bytes does it really
>> make it much more clear to reverse the byte order first? Feels
>> like you might as well shift it out of buf directly.
> 
> In any case, there is a predefined function to make this code a little
> nicer in <asm/byteorder.h>:
> 
> 	le16_to_cpu(x):  Converts the 16-bit little endian value x to
> 	                 CPU-endian
> 	le16_to_cpup(p): Converts the 16-bit little endian value pointed
> 	                 to by p to CPU-endian
> 
> If you use le16_to_cpup, you need to cast your pointer to __le16 *:
> 
> 	ea.manf_id = le16_to_cpup((__le16 *)&e_addr[4]);
> 
It Looks like I can make use of these apis here, I will give this a go 
to cleanup this part of the code.

thanks,
srini

  reply	other threads:[~2017-11-24 14:40 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-15 14:10 [PATCH v7 00/13] Introduce framework for SLIMbus device driver srinivas.kandagatla
2017-11-15 14:10 ` [PATCH v7 01/13] Documentation: Add SLIMbus summary srinivas.kandagatla
2017-11-15 14:10 ` [PATCH v7 02/13] dt-bindings: Add SLIMbus bindings srinivas.kandagatla
2017-11-16  5:15   ` Rob Herring
2017-11-23  7:41     ` Charles Keepax
2017-11-16 13:09   ` Vinod Koul
2017-11-16 13:40     ` Srinivas Kandagatla
2017-11-17  3:55       ` Vinod Koul
2017-11-15 14:10 ` [PATCH v7 03/13] slimbus: Add SLIMbus bus type srinivas.kandagatla
2017-11-16 12:25   ` Mark Brown
2017-11-16 13:18   ` [alsa-devel] " Vinod Koul
2017-11-16 13:40     ` Srinivas Kandagatla
2017-11-16 16:14       ` Vinod Koul
2017-11-16 16:13         ` Srinivas Kandagatla
2017-11-15 14:10 ` [PATCH v7 04/13] slimbus: core: Add slim controllers support srinivas.kandagatla
2017-11-16 16:42   ` Vinod Koul
2017-11-16 17:29     ` Srinivas Kandagatla
2017-11-17  4:42       ` Vinod Koul
2017-11-17  8:13         ` Greg KH
2017-11-20  6:47           ` Srinivas Kandagatla
2017-11-27  5:52             ` Vinod Koul
2017-11-15 14:10 ` [PATCH v7 05/13] slimbus: core: add support to device tree helper srinivas.kandagatla
2017-11-17  7:11   ` [alsa-devel] " Vinod Koul
2017-11-15 14:10 ` [PATCH v7 06/13] slimbus: Add messaging APIs to slimbus framework srinivas.kandagatla
2017-11-17  7:48   ` Vinod Koul
2017-11-20  6:47     ` Srinivas Kandagatla
2017-11-27  5:56       ` Vinod Koul
2017-11-28  7:18         ` Srinivas Kandagatla
2017-11-15 14:10 ` [PATCH v7 07/13] slimbus: Add support for 'clock-pause' feature srinivas.kandagatla
2017-11-23  7:28   ` Charles Keepax
2017-11-24 14:39     ` Srinivas Kandagatla
2017-11-15 14:10 ` [PATCH v7 08/13] regmap: add SLIMbus support srinivas.kandagatla
2017-11-23  7:49   ` Charles Keepax
2017-11-15 14:10 ` [PATCH v7 09/13] slimbus: core: add common defines required for controllers srinivas.kandagatla
2017-11-15 14:10 ` [PATCH v7 10/13] dt-bindings: Add qcom slimbus controller bindings srinivas.kandagatla
2017-11-16  5:19   ` Rob Herring
2017-11-16  9:42     ` Srinivas Kandagatla
2017-11-15 14:10 ` [PATCH v7 11/13] slimbus: qcom: Add Qualcomm Slimbus controller driver srinivas.kandagatla
2017-11-23 10:07   ` Charles Keepax
2017-11-23 16:42     ` Jonathan Neuschäfer
2017-11-24 14:40       ` Srinivas Kandagatla [this message]
2017-11-24 14:39     ` Srinivas Kandagatla
2017-11-15 14:10 ` [PATCH v7 12/13] slimbus: qcom: Add runtime-pm support using clock-pause srinivas.kandagatla
2017-11-23 10:17   ` Charles Keepax
2017-11-24 14:39     ` Srinivas Kandagatla
2017-11-15 14:10 ` [PATCH v7 13/13] MAINTAINERS: Add SLIMbus maintainer srinivas.kandagatla

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=7200d3c4-79c8-b461-9883-182a1c8b4476@linaro.org \
    --to=srinivas.kandagatla@linaro.org \
    --cc=alan@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=andreas.noever@gmail.com \
    --cc=arnd@arndb.de \
    --cc=bp@suse.de \
    --cc=broonie@kernel.org \
    --cc=ckeepax@opensource.cirrus.com \
    --cc=daniel@ffwll.ch \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=j.neuschaefer@gmx.net \
    --cc=james.hogan@imgtec.com \
    --cc=jkosina@suse.cz \
    --cc=joe@perches.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mathieu.poirier@linaro.org \
    --cc=michael.opdenacker@free-electrons.com \
    --cc=pawel.moll@arm.com \
    --cc=poeschel@lemonage.de \
    --cc=robh+dt@kernel.org \
    --cc=sdharia@codeaurora.org \
    --cc=sharon.dvir1@mail.huji.ac.il \
    --cc=treding@nvidia.com \
    --cc=vinod.koul@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

all inboxes | Powered by JetHome®