* [PATCH 0/2] remove useless type cast @ 2024-07-22 9:17 Yao Xingtao via 2024-07-22 9:17 ` [PATCH 1/2] mips/loongson3_virt: " Yao Xingtao via 2024-07-22 9:17 ` [PATCH 2/2] nvme/ctrl: " Yao Xingtao via 0 siblings, 2 replies; 8+ messages in thread From: Yao Xingtao via @ 2024-07-22 9:17 UTC (permalink / raw) To: qemu-devel; +Cc: Yao Xingtao Currently the pattern in scripts/coccinelle/typecast.cocci is used to remove the useless type cast. Use the following command to find out the use cases and remove the useless type case: $ spatch --macro-file scripts/cocci-macro-file.h \ --sp-file ./scripts/coccinelle/typecast.cocci \ --keep-comments --in-place --use-gitgrep --dir . Yao Xingtao (2): mips/loongson3_virt: remove useless type cast nvme/ctrl: remove useless type cast hw/mips/loongson3_virt.c | 4 ++-- hw/nvme/ctrl.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) -- 2.41.0 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/2] mips/loongson3_virt: remove useless type cast 2024-07-22 9:17 [PATCH 0/2] remove useless type cast Yao Xingtao via @ 2024-07-22 9:17 ` Yao Xingtao via 2024-07-22 11:47 ` Peter Maydell ` (2 more replies) 2024-07-22 9:17 ` [PATCH 2/2] nvme/ctrl: " Yao Xingtao via 1 sibling, 3 replies; 8+ messages in thread From: Yao Xingtao via @ 2024-07-22 9:17 UTC (permalink / raw) To: qemu-devel, Huacai Chen, Jiaxun Yang, Philippe Mathieu-Daudé Cc: Yao Xingtao The type of kernel_entry, kernel_low and kernel_high is uint64_t, cast the pointer of this type to uint64_t* is useless. Signed-off-by: Yao Xingtao <yaoxt.fnst@fujitsu.com> --- hw/mips/loongson3_virt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/mips/loongson3_virt.c b/hw/mips/loongson3_virt.c index 4ad36f0c5b64..408e3d7054cd 100644 --- a/hw/mips/loongson3_virt.c +++ b/hw/mips/loongson3_virt.c @@ -355,8 +355,8 @@ static uint64_t load_kernel(CPUMIPSState *env) kernel_size = load_elf(loaderparams.kernel_filename, NULL, cpu_mips_kseg0_to_phys, NULL, - (uint64_t *)&kernel_entry, - (uint64_t *)&kernel_low, (uint64_t *)&kernel_high, + &kernel_entry, + &kernel_low, &kernel_high, NULL, 0, EM_MIPS, 1, 0); if (kernel_size < 0) { error_report("could not load kernel '%s': %s", -- 2.41.0 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] mips/loongson3_virt: remove useless type cast 2024-07-22 9:17 ` [PATCH 1/2] mips/loongson3_virt: " Yao Xingtao via @ 2024-07-22 11:47 ` Peter Maydell 2024-07-22 12:10 ` Philippe Mathieu-Daudé 2024-07-22 21:16 ` Philippe Mathieu-Daudé 2 siblings, 0 replies; 8+ messages in thread From: Peter Maydell @ 2024-07-22 11:47 UTC (permalink / raw) To: Yao Xingtao Cc: qemu-devel, Huacai Chen, Jiaxun Yang, Philippe Mathieu-Daudé On Mon, 22 Jul 2024 at 10:19, Yao Xingtao via <qemu-devel@nongnu.org> wrote: > > The type of kernel_entry, kernel_low and kernel_high is uint64_t, cast > the pointer of this type to uint64_t* is useless. > > Signed-off-by: Yao Xingtao <yaoxt.fnst@fujitsu.com> > --- > hw/mips/loongson3_virt.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/hw/mips/loongson3_virt.c b/hw/mips/loongson3_virt.c > index 4ad36f0c5b64..408e3d7054cd 100644 > --- a/hw/mips/loongson3_virt.c > +++ b/hw/mips/loongson3_virt.c > @@ -355,8 +355,8 @@ static uint64_t load_kernel(CPUMIPSState *env) > > kernel_size = load_elf(loaderparams.kernel_filename, NULL, > cpu_mips_kseg0_to_phys, NULL, > - (uint64_t *)&kernel_entry, > - (uint64_t *)&kernel_low, (uint64_t *)&kernel_high, > + &kernel_entry, > + &kernel_low, &kernel_high, > NULL, 0, EM_MIPS, 1, 0); > if (kernel_size < 0) { > error_report("could not load kernel '%s': %s", > -- Reviewed-by: Peter Maydell <peter.maydell@linaro.org> thanks -- PMM ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] mips/loongson3_virt: remove useless type cast 2024-07-22 9:17 ` [PATCH 1/2] mips/loongson3_virt: " Yao Xingtao via 2024-07-22 11:47 ` Peter Maydell @ 2024-07-22 12:10 ` Philippe Mathieu-Daudé 2024-07-22 21:16 ` Philippe Mathieu-Daudé 2 siblings, 0 replies; 8+ messages in thread From: Philippe Mathieu-Daudé @ 2024-07-22 12:10 UTC (permalink / raw) To: Yao Xingtao, qemu-devel, Huacai Chen, Jiaxun Yang On 22/7/24 11:17, Yao Xingtao wrote: > The type of kernel_entry, kernel_low and kernel_high is uint64_t, cast > the pointer of this type to uint64_t* is useless. > > Signed-off-by: Yao Xingtao <yaoxt.fnst@fujitsu.com> > --- > hw/mips/loongson3_virt.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> and queued, thanks! ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] mips/loongson3_virt: remove useless type cast 2024-07-22 9:17 ` [PATCH 1/2] mips/loongson3_virt: " Yao Xingtao via 2024-07-22 11:47 ` Peter Maydell 2024-07-22 12:10 ` Philippe Mathieu-Daudé @ 2024-07-22 21:16 ` Philippe Mathieu-Daudé 2 siblings, 0 replies; 8+ messages in thread From: Philippe Mathieu-Daudé @ 2024-07-22 21:16 UTC (permalink / raw) To: Yao Xingtao, qemu-devel, Huacai Chen, Jiaxun Yang On 22/7/24 11:17, Yao Xingtao wrote: > The type of kernel_entry, kernel_low and kernel_high is uint64_t, cast > the pointer of this type to uint64_t* is useless. > > Signed-off-by: Yao Xingtao <yaoxt.fnst@fujitsu.com> > --- > hw/mips/loongson3_virt.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) Patch queued, thanks. ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/2] nvme/ctrl: remove useless type cast 2024-07-22 9:17 [PATCH 0/2] remove useless type cast Yao Xingtao via 2024-07-22 9:17 ` [PATCH 1/2] mips/loongson3_virt: " Yao Xingtao via @ 2024-07-22 9:17 ` Yao Xingtao via 2024-07-22 11:48 ` Peter Maydell 2024-07-22 11:52 ` Klaus Jensen 1 sibling, 2 replies; 8+ messages in thread From: Yao Xingtao via @ 2024-07-22 9:17 UTC (permalink / raw) To: qemu-devel, Keith Busch, Klaus Jensen, Jesper Devantier Cc: Yao Xingtao, qemu-block The type of req->cmd is NvmeCmd, cast the pointer of this type to NvmeCmd* is useless. Signed-off-by: Yao Xingtao <yaoxt.fnst@fujitsu.com> --- hw/nvme/ctrl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index 5b1b0cabcfc3..221818f551cd 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -4167,7 +4167,7 @@ static bool nvme_zone_matches_filter(uint32_t zafs, NvmeZone *zl) static uint16_t nvme_zone_mgmt_recv(NvmeCtrl *n, NvmeRequest *req) { - NvmeCmd *cmd = (NvmeCmd *)&req->cmd; + NvmeCmd *cmd = &req->cmd; NvmeNamespace *ns = req->ns; /* cdw12 is zero-based number of dwords to return. Convert to bytes */ uint32_t data_size = (le32_to_cpu(cmd->cdw12) + 1) << 2; -- 2.41.0 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] nvme/ctrl: remove useless type cast 2024-07-22 9:17 ` [PATCH 2/2] nvme/ctrl: " Yao Xingtao via @ 2024-07-22 11:48 ` Peter Maydell 2024-07-22 11:52 ` Klaus Jensen 1 sibling, 0 replies; 8+ messages in thread From: Peter Maydell @ 2024-07-22 11:48 UTC (permalink / raw) To: Yao Xingtao Cc: qemu-devel, Keith Busch, Klaus Jensen, Jesper Devantier, qemu-block On Mon, 22 Jul 2024 at 10:19, Yao Xingtao via <qemu-devel@nongnu.org> wrote: > > The type of req->cmd is NvmeCmd, cast the pointer of this type to > NvmeCmd* is useless. > > Signed-off-by: Yao Xingtao <yaoxt.fnst@fujitsu.com> > --- > hw/nvme/ctrl.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c > index 5b1b0cabcfc3..221818f551cd 100644 > --- a/hw/nvme/ctrl.c > +++ b/hw/nvme/ctrl.c > @@ -4167,7 +4167,7 @@ static bool nvme_zone_matches_filter(uint32_t zafs, NvmeZone *zl) > > static uint16_t nvme_zone_mgmt_recv(NvmeCtrl *n, NvmeRequest *req) > { > - NvmeCmd *cmd = (NvmeCmd *)&req->cmd; > + NvmeCmd *cmd = &req->cmd; > NvmeNamespace *ns = req->ns; > /* cdw12 is zero-based number of dwords to return. Convert to bytes */ > uint32_t data_size = (le32_to_cpu(cmd->cdw12) + 1) << 2; > -- > 2.41.0 Reviewed-by: Peter Maydell <peter.maydell@linaro.org> thanks -- PMM ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] nvme/ctrl: remove useless type cast 2024-07-22 9:17 ` [PATCH 2/2] nvme/ctrl: " Yao Xingtao via 2024-07-22 11:48 ` Peter Maydell @ 2024-07-22 11:52 ` Klaus Jensen 1 sibling, 0 replies; 8+ messages in thread From: Klaus Jensen @ 2024-07-22 11:52 UTC (permalink / raw) To: Yao Xingtao; +Cc: qemu-devel, Keith Busch, Jesper Devantier, qemu-block [-- Attachment #1: Type: text/plain, Size: 953 bytes --] On Jul 22 05:17, Yao Xingtao wrote: > The type of req->cmd is NvmeCmd, cast the pointer of this type to > NvmeCmd* is useless. > > Signed-off-by: Yao Xingtao <yaoxt.fnst@fujitsu.com> > --- > hw/nvme/ctrl.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c > index 5b1b0cabcfc3..221818f551cd 100644 > --- a/hw/nvme/ctrl.c > +++ b/hw/nvme/ctrl.c > @@ -4167,7 +4167,7 @@ static bool nvme_zone_matches_filter(uint32_t zafs, NvmeZone *zl) > > static uint16_t nvme_zone_mgmt_recv(NvmeCtrl *n, NvmeRequest *req) > { > - NvmeCmd *cmd = (NvmeCmd *)&req->cmd; > + NvmeCmd *cmd = &req->cmd; > NvmeNamespace *ns = req->ns; > /* cdw12 is zero-based number of dwords to return. Convert to bytes */ > uint32_t data_size = (le32_to_cpu(cmd->cdw12) + 1) << 2; > -- > 2.41.0 > Thanks! Queued on nvme-next! Reviewed-by: Klaus Jensen <k.jensen@samsung.com> [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 488 bytes --] ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2024-07-22 21:16 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-07-22 9:17 [PATCH 0/2] remove useless type cast Yao Xingtao via 2024-07-22 9:17 ` [PATCH 1/2] mips/loongson3_virt: " Yao Xingtao via 2024-07-22 11:47 ` Peter Maydell 2024-07-22 12:10 ` Philippe Mathieu-Daudé 2024-07-22 21:16 ` Philippe Mathieu-Daudé 2024-07-22 9:17 ` [PATCH 2/2] nvme/ctrl: " Yao Xingtao via 2024-07-22 11:48 ` Peter Maydell 2024-07-22 11:52 ` Klaus Jensen
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).