linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: dikshita@codeaurora.org
To: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: linux-media@vger.kernel.org, stanimir.varbanov@linaro.org,
	linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	vgarodia@codeaurora.org
Subject: Re: [PATCH v2] media: venus : hfi: add venus image info into smem
Date: Wed, 07 Apr 2021 11:20:16 +0530	[thread overview]
Message-ID: <dc7d3ac8948b16f8d003828b9c4e17e7@codeaurora.org> (raw)
In-Reply-To: <YGKiExvhfdAhTw9/@builder.lan>

Hi Bjorn,

Thanks for your review comments.
I have addressed all in the latest patch v3.
couldn't think of a shorter name for variables without losing the
readability so kept as it is.

Thanks,
Dikshita

On 2021-03-30 09:29, Bjorn Andersson wrote:
> On Fri 26 Mar 01:33 CDT 2021, Dikshita Agarwal wrote:
> 
>> Fill fw version info into smem to be printed as part of
>> soc info.
>> 
>> Signed-off-by: Dikshita Agarwal <dikshita@codeaurora.org>
>> 
>> Changes since v1:
>>  adressed comments from stephen.
>>  removed unwanted code.
>> ---
>>  drivers/media/platform/qcom/venus/hfi_msgs.c | 21 
>> +++++++++++++++++++--
>>  1 file changed, 19 insertions(+), 2 deletions(-)
>> 
>> diff --git a/drivers/media/platform/qcom/venus/hfi_msgs.c 
>> b/drivers/media/platform/qcom/venus/hfi_msgs.c
>> index 06a1908..6b6d33c9 100644
>> --- a/drivers/media/platform/qcom/venus/hfi_msgs.c
>> +++ b/drivers/media/platform/qcom/venus/hfi_msgs.c
>> @@ -6,6 +6,7 @@
>>  #include <linux/hash.h>
>>  #include <linux/list.h>
>>  #include <linux/slab.h>
>> +#include <linux/soc/qcom/smem.h>
>>  #include <media/videobuf2-v4l2.h>
>> 
>>  #include "core.h"
>> @@ -14,6 +15,10 @@
>>  #include "hfi_msgs.h"
>>  #include "hfi_parser.h"
>> 
>> +#define SMEM_IMG_VER_TBL 469
>> +#define VER_STR_SZ	128
>> +#define SMEM_IMG_INDEX_VENUS 14 * 128
> 
> 14 is the index, 128 is the element size, so this is now an "offset".
> 
>> +
>>  static void event_seq_changed(struct venus_core *core, struct 
>> venus_inst *inst,
>>  			      struct hfi_msg_event_notify_pkt *pkt)
>>  {
>> @@ -239,15 +244,27 @@ static void
>>  sys_get_prop_image_version(struct device *dev,
>>  			   struct hfi_msg_sys_property_info_pkt *pkt)
>>  {
>> +	size_t smem_blk_sz = 0;
> 
> You shouldn't need to initialize smem_blk_sz if you check the return
> value of qcom_smem_get() first.
> 
>> +	u8 *smem_tbl_ptr;
>> +	u8 *img_ver;
>>  	int req_bytes;
>> 
>>  	req_bytes = pkt->hdr.size - sizeof(*pkt);
>> 
>> -	if (req_bytes < 128 || !pkt->data[1] || pkt->num_properties > 1)
>> +	if (req_bytes < VER_STR_SZ || !pkt->data[1] || pkt->num_properties > 
>> 1)
>>  		/* bad packet */
>>  		return;
>> 
>> -	dev_dbg(dev, VDBGL "F/W version: %s\n", (u8 *)&pkt->data[1]);
>> +	img_ver = (u8 *)&pkt->data[1];
>> +
>> +	dev_dbg(dev, VDBGL "F/W version: %s\n", img_ver);
>> +
>> +	smem_tbl_ptr = qcom_smem_get(QCOM_SMEM_HOST_ANY,
>> +				       SMEM_IMG_VER_TBL, &smem_blk_sz);
> 
> 80 chars is just a guideline and this looks prettier if you avoid the
> line wrap. That said, if you pick shorter names for smem_tbl_ptr and
> smem_blk_sz you probably even have to worry.
> 
>> +	if ((SMEM_IMG_INDEX_VENUS + VER_STR_SZ) <= smem_blk_sz &&
>> +	    smem_tbl_ptr)
> 
> In English you're trying to determine: "did qcom_smem_get() return a
> valid pointer and is the item's size at least as big as we need".
> 
> So just write that in C:
> 
> 	if (smem_tbl_ptr && smem_blk_sz >= SMEM_IMG_INDEX_VENUS + VER_STR_SZ)
> 
>> +		memcpy(smem_tbl_ptr + SMEM_IMG_INDEX_VENUS,
>> +		       img_ver, VER_STR_SZ);
> 
> Again, please avoid the line wrap...
> 
> Regards,
> Bjorn
> 
>>  }
>> 
>>  static void hfi_sys_property_info(struct venus_core *core,
>> --
>> 2.7.4
>> 

      reply	other threads:[~2021-04-07  5:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-26  6:33 [PATCH v2] media: venus : hfi: add venus image info into smem Dikshita Agarwal
2021-03-26 13:17 ` kernel test robot
2021-03-26 18:53 ` kernel test robot
2021-03-30  3:59 ` Bjorn Andersson
2021-04-07  5:50   ` dikshita [this message]

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=dc7d3ac8948b16f8d003828b9c4e17e7@codeaurora.org \
    --to=dikshita@codeaurora.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=stanimir.varbanov@linaro.org \
    --cc=vgarodia@codeaurora.org \
    /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;
as well as URLs for NNTP newsgroup(s).