public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: David Laight <david.laight.linux@gmail.com>
To: Markus Elfring <Markus.Elfring@web.de>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>,
	sparclinux@vger.kernel.org,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Andreas Larsson <andreas@gaisler.com>,
	Christoph Lameter <cl@linux.com>,
	"David S. Miller" <davem@davemloft.net>,
	Finn Thain <fthain@linux-m68k.org>, Tejun Heo <tj@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	kernel-janitors@vger.kernel.org,
	Miaoqian Lin <linmq006@gmail.com>
Subject: Re: [PATCH] sparc: time: Use pointer from memcpy() call for assignment in setup_sparc64_timer()
Date: Fri, 31 Oct 2025 09:51:32 +0000	[thread overview]
Message-ID: <20251031095132.3db72d29@pumpkin> (raw)
In-Reply-To: <33199802-d83d-48e8-9032-f1c4c61cfee7@web.de>

On Fri, 31 Oct 2025 09:46:25 +0100
Markus Elfring <Markus.Elfring@web.de> wrote:

> …>> +++ b/arch/sparc/kernel/time_64.c
> >> @@ -760,9 +760,7 @@ void setup_sparc64_timer(void)
> >>                              : /* no outputs */
> >>                              : "r" (pstate));
> >>
> >> -       sevt = this_cpu_ptr(&sparc64_events);
> >> -
> >> -       memcpy(sevt, &sparc64_clockevent, sizeof(*sevt));
> >> +       sevt = memcpy(this_cpu_ptr(&sparc64_events), &sparc64_clockevent, sizeof(*sevt));  
> > 
> > IMHO this makes the code harder to read:
> >   - Only 0.15% of the memcpy() calls in the kernel use the
> >     memcpy() chaining feature,  
> 
> I obviously propose to refactor this implementation detail.

Reduce it to 0% and the kernel memcpy() can be made 'void'. :-)
That will simplify the architecture specific implementations.

The same can be done for strcpy() and strcat() (etc).
Where the 'useful' return value would be the address of the '\0'.

	David



  reply	other threads:[~2025-10-31  9:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-31  7:46 [PATCH] sparc: time: Use pointer from memcpy() call for assignment in setup_sparc64_timer() Markus Elfring
2025-10-31  8:01 ` Geert Uytterhoeven
2025-10-31  8:46   ` Markus Elfring
2025-10-31  9:51     ` David Laight [this message]
2025-10-31 10:08     ` Geert Uytterhoeven
2025-10-31 11:27       ` Dan Carpenter

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=20251031095132.3db72d29@pumpkin \
    --to=david.laight.linux@gmail.com \
    --cc=Markus.Elfring@web.de \
    --cc=alexandre.belloni@bootlin.com \
    --cc=andreas@gaisler.com \
    --cc=cl@linux.com \
    --cc=davem@davemloft.net \
    --cc=fthain@linux-m68k.org \
    --cc=geert@linux-m68k.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linmq006@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sparclinux@vger.kernel.org \
    --cc=tj@kernel.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