All of lore.kernel.org
 help / color / mirror / Atom feed
From: "lihuisong (C)" <lihuisong@huawei.com>
To: Arnd Bergmann <arnd@arndb.de>, Arnd Bergmann <arnd@kernel.org>
Cc: <linux-kernel@vger.kernel.org>, <soc@kernel.org>,
	<linux-arm-kernel@lists.infradead.org>, <liuyonglong@huawei.com>,
	<xuwei5@hisilicon.com>, <lihuisong@huawei.com>
Subject: Re: [PATCH] soc: kunpeng_hccs: fix some sparse warnings about incorrect type
Date: Fri, 18 Aug 2023 09:38:36 +0800	[thread overview]
Message-ID: <584734f7-3eb7-961f-10a2-3707cf03819c@huawei.com> (raw)
In-Reply-To: <4f72b1d7-00b4-4318-b3c3-50d11e4a233c@app.fastmail.com>


在 2023/8/17 19:54, Arnd Bergmann 写道:
> On Thu, Aug 17, 2023, at 03:37, lihuisong (C) wrote:
>> 在 2023/8/16 21:17, Arnd Bergmann 写道:
>>> On Tue, Aug 15, 2023, at 14:52, Huisong Li wrote:
>>>> @@ -199,8 +200,8 @@ static int hccs_pcc_cmd_send(struct hccs_dev *hdev, u8 cmd,
>>>>    			     struct hccs_desc *desc)
>>>>    {
>>>>    	struct hccs_mbox_client_info *cl_info = &hdev->cl_info;
>>>> -	struct acpi_pcct_shared_memory *comm_base = cl_info->pcc_comm_addr;
>>>> -	void *comm_space = (void *)(comm_base + 1);
>>>> +	void __iomem *comm_space = (u8 *)cl_info->pcc_comm_addr +
>>>> +					sizeof(struct acpi_pcct_shared_memory);
>>>>    	struct hccs_fw_inner_head *fw_inner_head;
>>>>    	struct acpi_pcct_shared_memory tmp = {0};
>>>>    	u16 comm_space_size;
>>> The cast still looks wrong, while both comm_space and ->pcc_comm_addr
>>> are __iomem pointers, casting to a non-__iomem u8 pointer should
>>> still produce that warning. I'd suggest casting to (u8 __iomem *)
>>> or (void __iomem *), I assume you still need a cast here to get
>>> the correct address.
>> Thanks Arnd.
>>
>> You are right. So I modify it by dropping (u8 *) here in patch v2.
>> Please take a look at this again.
> Right, if pcc_comm_addr is already a u8 __iomem* or void*, that
> works, I though the cast was needed since it points to a larger
> object, which would throw off the calculation.
This pcc_comm_addr is already defined "void __iomem *" type in patch v2.
So that works well, right?

/Huisong
>
>> If it is ok for you, can you apply this patch to soc/soc.git?
> Yes, of course.
>
>         Arnd
> .

WARNING: multiple messages have this Message-ID (diff)
From: "lihuisong (C)" <lihuisong@huawei.com>
To: Arnd Bergmann <arnd@arndb.de>, Arnd Bergmann <arnd@kernel.org>
Cc: <linux-kernel@vger.kernel.org>, <soc@kernel.org>,
	<linux-arm-kernel@lists.infradead.org>, <liuyonglong@huawei.com>,
	<xuwei5@hisilicon.com>, <lihuisong@huawei.com>
Subject: Re: [PATCH] soc: kunpeng_hccs: fix some sparse warnings about incorrect type
Date: Fri, 18 Aug 2023 09:38:36 +0800	[thread overview]
Message-ID: <584734f7-3eb7-961f-10a2-3707cf03819c@huawei.com> (raw)
In-Reply-To: <4f72b1d7-00b4-4318-b3c3-50d11e4a233c@app.fastmail.com>


在 2023/8/17 19:54, Arnd Bergmann 写道:
> On Thu, Aug 17, 2023, at 03:37, lihuisong (C) wrote:
>> 在 2023/8/16 21:17, Arnd Bergmann 写道:
>>> On Tue, Aug 15, 2023, at 14:52, Huisong Li wrote:
>>>> @@ -199,8 +200,8 @@ static int hccs_pcc_cmd_send(struct hccs_dev *hdev, u8 cmd,
>>>>    			     struct hccs_desc *desc)
>>>>    {
>>>>    	struct hccs_mbox_client_info *cl_info = &hdev->cl_info;
>>>> -	struct acpi_pcct_shared_memory *comm_base = cl_info->pcc_comm_addr;
>>>> -	void *comm_space = (void *)(comm_base + 1);
>>>> +	void __iomem *comm_space = (u8 *)cl_info->pcc_comm_addr +
>>>> +					sizeof(struct acpi_pcct_shared_memory);
>>>>    	struct hccs_fw_inner_head *fw_inner_head;
>>>>    	struct acpi_pcct_shared_memory tmp = {0};
>>>>    	u16 comm_space_size;
>>> The cast still looks wrong, while both comm_space and ->pcc_comm_addr
>>> are __iomem pointers, casting to a non-__iomem u8 pointer should
>>> still produce that warning. I'd suggest casting to (u8 __iomem *)
>>> or (void __iomem *), I assume you still need a cast here to get
>>> the correct address.
>> Thanks Arnd.
>>
>> You are right. So I modify it by dropping (u8 *) here in patch v2.
>> Please take a look at this again.
> Right, if pcc_comm_addr is already a u8 __iomem* or void*, that
> works, I though the cast was needed since it points to a larger
> object, which would throw off the calculation.
This pcc_comm_addr is already defined "void __iomem *" type in patch v2.
So that works well, right?

/Huisong
>
>> If it is ok for you, can you apply this patch to soc/soc.git?
> Yes, of course.
>
>         Arnd
> .

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2023-08-18  1:39 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-15 12:52 [PATCH] soc: kunpeng_hccs: fix some sparse warnings about incorrect type Huisong Li
2023-08-15 12:52 ` Huisong Li
2023-08-16  5:35 ` kernel test robot
2023-08-16  7:37 ` [PATCH v2] " Huisong Li
2023-08-16  7:37   ` Huisong Li
2023-08-22  2:31   ` patchwork-bot+linux-soc
2023-08-16 13:17 ` [PATCH] " Arnd Bergmann
2023-08-16 13:17   ` Arnd Bergmann
2023-08-17  1:37   ` lihuisong (C)
2023-08-17  1:37     ` lihuisong (C)
2023-08-17 11:54     ` Arnd Bergmann
2023-08-17 11:54       ` Arnd Bergmann
2023-08-18  1:38       ` lihuisong (C) [this message]
2023-08-18  1:38         ` lihuisong (C)
2023-08-18  1:57         ` Arnd Bergmann
2023-08-18  1:57           ` Arnd Bergmann

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=584734f7-3eb7-961f-10a2-3707cf03819c@huawei.com \
    --to=lihuisong@huawei.com \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liuyonglong@huawei.com \
    --cc=soc@kernel.org \
    --cc=xuwei5@hisilicon.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 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.