* [PATCH] powerpc/cell: Code cleanup for spufs_mfc_flush
@ 2024-01-25 10:08 Kunwu Chan
2024-01-25 10:41 ` Christophe Leroy
0 siblings, 1 reply; 3+ messages in thread
From: Kunwu Chan @ 2024-01-25 10:08 UTC (permalink / raw)
To: jk, arnd, mpe, npiggin, christophe.leroy, aneesh.kumar, naveen.n.rao
Cc: linuxppc-dev, linux-kernel, Kunwu Chan
This part was commented from commit a33a7d7309d7
("[PATCH] spufs: implement mfc access for PPE-side DMA")
in about 18 years before.
If there are no plans to enable this part code in the future,
we can remove this dead code.
Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
---
arch/powerpc/platforms/cell/spufs/file.c | 12 ------------
1 file changed, 12 deletions(-)
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
index 02a8158c469d..d5e1af483601 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -1705,19 +1705,7 @@ static int spufs_mfc_flush(struct file *file, fl_owner_t id)
ret = spu_acquire(ctx);
if (ret)
goto out;
-#if 0
-/* this currently hangs */
- ret = spufs_wait(ctx->mfc_wq,
- ctx->ops->set_mfc_query(ctx, ctx->tagwait, 2));
- if (ret)
- goto out;
- ret = spufs_wait(ctx->mfc_wq,
- ctx->ops->read_mfc_tagstatus(ctx) == ctx->tagwait);
- if (ret)
- goto out;
-#else
ret = 0;
-#endif
spu_release(ctx);
out:
return ret;
--
2.39.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] powerpc/cell: Code cleanup for spufs_mfc_flush
2024-01-25 10:08 [PATCH] powerpc/cell: Code cleanup for spufs_mfc_flush Kunwu Chan
@ 2024-01-25 10:41 ` Christophe Leroy
2024-01-26 1:58 ` Kunwu Chan
0 siblings, 1 reply; 3+ messages in thread
From: Christophe Leroy @ 2024-01-25 10:41 UTC (permalink / raw)
To: Kunwu Chan, jk, arnd, mpe, npiggin, aneesh.kumar, naveen.n.rao
Cc: linuxppc-dev, linux-kernel
Le 25/01/2024 à 11:08, Kunwu Chan a écrit :
> This part was commented from commit a33a7d7309d7
> ("[PATCH] spufs: implement mfc access for PPE-side DMA")
> in about 18 years before.
>
> If there are no plans to enable this part code in the future,
> we can remove this dead code.
>
> Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
> ---
> arch/powerpc/platforms/cell/spufs/file.c | 12 ------------
> 1 file changed, 12 deletions(-)
>
> diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
> index 02a8158c469d..d5e1af483601 100644
> --- a/arch/powerpc/platforms/cell/spufs/file.c
> +++ b/arch/powerpc/platforms/cell/spufs/file.c
> @@ -1705,19 +1705,7 @@ static int spufs_mfc_flush(struct file *file, fl_owner_t id)
> ret = spu_acquire(ctx);
> if (ret)
> goto out;
> -#if 0
> -/* this currently hangs */
> - ret = spufs_wait(ctx->mfc_wq,
> - ctx->ops->set_mfc_query(ctx, ctx->tagwait, 2));
> - if (ret)
> - goto out;
> - ret = spufs_wait(ctx->mfc_wq,
> - ctx->ops->read_mfc_tagstatus(ctx) == ctx->tagwait);
> - if (ret)
> - goto out;
> -#else
> ret = 0;
If you arrived here, it means ret is already 0, otherwise you would have
jumped to label out:, so you can also remove that ret = 0 setting.
And while you are at it, there is no point in a goto to just a return,
just return instead of the goto, and then you can return 0 directly,
something like:
ret = spu_acquire(ctx);
if (ret)
return ret;
spu_release(ctx);
return 0;
That would be a better cleanup.
> -#endif
> spu_release(ctx);
> out:
> return ret;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] powerpc/cell: Code cleanup for spufs_mfc_flush
2024-01-25 10:41 ` Christophe Leroy
@ 2024-01-26 1:58 ` Kunwu Chan
0 siblings, 0 replies; 3+ messages in thread
From: Kunwu Chan @ 2024-01-26 1:58 UTC (permalink / raw)
To: Christophe Leroy, jk, arnd, mpe, npiggin, aneesh.kumar, naveen.n.rao
Cc: linuxppc-dev, linux-kernel
On 2024/1/25 18:41, Christophe Leroy wrote:
>
>
> Le 25/01/2024 à 11:08, Kunwu Chan a écrit :
>> This part was commented from commit a33a7d7309d7
>> ("[PATCH] spufs: implement mfc access for PPE-side DMA")
>> in about 18 years before.
>>
>> If there are no plans to enable this part code in the future,
>> we can remove this dead code.
>>
>> Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
>> ---
>> arch/powerpc/platforms/cell/spufs/file.c | 12 ------------
>> 1 file changed, 12 deletions(-)
>>
>> diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
>> index 02a8158c469d..d5e1af483601 100644
>> --- a/arch/powerpc/platforms/cell/spufs/file.c
>> +++ b/arch/powerpc/platforms/cell/spufs/file.c
>> @@ -1705,19 +1705,7 @@ static int spufs_mfc_flush(struct file *file, fl_owner_t id)
>> ret = spu_acquire(ctx);
>> if (ret)
>> goto out;
>> -#if 0
>> -/* this currently hangs */
>> - ret = spufs_wait(ctx->mfc_wq,
>> - ctx->ops->set_mfc_query(ctx, ctx->tagwait, 2));
>> - if (ret)
>> - goto out;
>> - ret = spufs_wait(ctx->mfc_wq,
>> - ctx->ops->read_mfc_tagstatus(ctx) == ctx->tagwait);
>> - if (ret)
>> - goto out;
>> -#else
>> ret = 0;
>
Thanks for your reply.
> If you arrived here, it means ret is already 0, otherwise you would have
> jumped to label out:, so you can also remove that ret = 0 setting.
>
I'm patronizing the removal of useless code, it's my bad.
> And while you are at it, there is no point in a goto to just a return,
> just return instead of the goto, and then you can return 0 directly,
> something like:
>
> ret = spu_acquire(ctx);
> if (ret)
> return ret;
>
> spu_release(ctx);
>
> return 0;
>
>
> That would be a better cleanup.
Thanks for your suggestions,i'll update in v2 and add a 'Suggested-by:'.
>
>> -#endif
>> spu_release(ctx);
>> out:
>> return ret;
--
Thanks,
Kunwu
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-01-26 1:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-25 10:08 [PATCH] powerpc/cell: Code cleanup for spufs_mfc_flush Kunwu Chan
2024-01-25 10:41 ` Christophe Leroy
2024-01-26 1:58 ` Kunwu Chan
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).