* [PATCH] hw/net/can: Remove redundant status bit setting in can_sja1000
@ 2025-09-16 8:10 SillyZ
2025-09-16 14:09 ` Peter Maydell
2025-09-17 14:45 ` Michael Tokarev
0 siblings, 2 replies; 3+ messages in thread
From: SillyZ @ 2025-09-16 8:10 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial, SillyZ
In PeliCAN mode reception, the RBS (Receive Buffer Status) bit
is set twice at line 842 and 845 with identical operations:
s->status_pel |= 0x01;
s->status_pel |= (1 << 0);
Between these two operations, only interrupt_pel is modified and
status_pel bit 4 is cleared, neither affecting bit 0. The second
operation is redundant.
This cleanup aligns PeliCAN mode with BasicCAN mode, which correctly
sets this bit only once (line 883).
Signed-off-by: SillyZ <1357816113@qq.com>
---
hw/net/can/can_sja1000.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/hw/net/can/can_sja1000.c b/hw/net/can/can_sja1000.c
index 5b6ba9df6c..6b08e977a1 100644
--- a/hw/net/can/can_sja1000.c
+++ b/hw/net/can/can_sja1000.c
@@ -842,7 +842,6 @@ ssize_t can_sja_receive(CanBusClientState *client, const qemu_can_frame *frames,
s->status_pel |= 0x01; /* Set the Receive Buffer Status. DS-p23 */
s->interrupt_pel |= 0x01;
s->status_pel &= ~(1 << 4);
- s->status_pel |= (1 << 0);
can_sja_update_pel_irq(s);
} else { /* BasicCAN mode */
--
2.47.1.windows.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] hw/net/can: Remove redundant status bit setting in can_sja1000
2025-09-16 8:10 [PATCH] hw/net/can: Remove redundant status bit setting in can_sja1000 SillyZ
@ 2025-09-16 14:09 ` Peter Maydell
2025-09-17 14:45 ` Michael Tokarev
1 sibling, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2025-09-16 14:09 UTC (permalink / raw)
To: SillyZ; +Cc: qemu-devel, qemu-trivial
On Tue, 16 Sept 2025 at 14:50, SillyZ <1357816113@qq.com> wrote:
>
> In PeliCAN mode reception, the RBS (Receive Buffer Status) bit
> is set twice at line 842 and 845 with identical operations:
> s->status_pel |= 0x01;
> s->status_pel |= (1 << 0);
>
> Between these two operations, only interrupt_pel is modified and
> status_pel bit 4 is cleared, neither affecting bit 0. The second
> operation is redundant.
>
> This cleanup aligns PeliCAN mode with BasicCAN mode, which correctly
> sets this bit only once (line 883).
>
> Signed-off-by: SillyZ <1357816113@qq.com>
> ---
> hw/net/can/can_sja1000.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/hw/net/can/can_sja1000.c b/hw/net/can/can_sja1000.c
> index 5b6ba9df6c..6b08e977a1 100644
> --- a/hw/net/can/can_sja1000.c
> +++ b/hw/net/can/can_sja1000.c
> @@ -842,7 +842,6 @@ ssize_t can_sja_receive(CanBusClientState *client, const qemu_can_frame *frames,
> s->status_pel |= 0x01; /* Set the Receive Buffer Status. DS-p23 */
> s->interrupt_pel |= 0x01;
> s->status_pel &= ~(1 << 4);
> - s->status_pel |= (1 << 0);
> can_sja_update_pel_irq(s);
> } else { /* BasicCAN mode */
>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
thanks
-- PMM
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] hw/net/can: Remove redundant status bit setting in can_sja1000
2025-09-16 8:10 [PATCH] hw/net/can: Remove redundant status bit setting in can_sja1000 SillyZ
2025-09-16 14:09 ` Peter Maydell
@ 2025-09-17 14:45 ` Michael Tokarev
1 sibling, 0 replies; 3+ messages in thread
From: Michael Tokarev @ 2025-09-17 14:45 UTC (permalink / raw)
To: SillyZ, qemu-devel; +Cc: qemu-trivial
On 16.09.2025 11:10, SillyZ wrote:
> In PeliCAN mode reception, the RBS (Receive Buffer Status) bit
> is set twice at line 842 and 845 with identical operations:
> s->status_pel |= 0x01;
> s->status_pel |= (1 << 0);
>
> Between these two operations, only interrupt_pel is modified and
> status_pel bit 4 is cleared, neither affecting bit 0. The second
> operation is redundant.
>
> This cleanup aligns PeliCAN mode with BasicCAN mode, which correctly
> sets this bit only once (line 883).
>
> Signed-off-by: SillyZ <1357816113@qq.com>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
And applied to the trivial-patches tree.
Thanks,
/mjt
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-09-17 14:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-16 8:10 [PATCH] hw/net/can: Remove redundant status bit setting in can_sja1000 SillyZ
2025-09-16 14:09 ` Peter Maydell
2025-09-17 14:45 ` Michael Tokarev
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).