linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND] mfd/macsmc: make SMC write buffers const
@ 2025-10-07 13:05 Atharva Tiwari
  2025-10-08 14:20 ` Sven Peter
  2025-10-09 12:26 ` Lee Jones
  0 siblings, 2 replies; 3+ messages in thread
From: Atharva Tiwari @ 2025-10-07 13:05 UTC (permalink / raw)
  Cc: Atharva Tiwari, Sven Peter, Janne Grunau, Neal Gompa, Lee Jones,
	asahi, linux-arm-kernel, linux-kernel

Mark the write buffer arguments in apple_smc_write(), apple_smc_rw(),
and apple_smc_write_atomic() as const. These functions do not modify
the data provided by the caller, so the parameters should be const
qualified.

Signed-off-by: Atharva Tiwari <atharvatiwarilinuxdev@gmail.com>
---
 drivers/mfd/macsmc.c       | 6 +++---
 include/linux/mfd/macsmc.h | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/mfd/macsmc.c b/drivers/mfd/macsmc.c
index 870c8b2028a8..0f8ed400b986 100644
--- a/drivers/mfd/macsmc.c
+++ b/drivers/mfd/macsmc.c
@@ -173,7 +173,7 @@ int apple_smc_read(struct apple_smc *smc, smc_key key, void *buf, size_t size)
 }
 EXPORT_SYMBOL(apple_smc_read);
 
-int apple_smc_write(struct apple_smc *smc, smc_key key, void *buf, size_t size)
+int apple_smc_write(struct apple_smc *smc, smc_key key, const void *buf, size_t size)
 {
 	guard(mutex)(&smc->mutex);
 
@@ -181,7 +181,7 @@ int apple_smc_write(struct apple_smc *smc, smc_key key, void *buf, size_t size)
 }
 EXPORT_SYMBOL(apple_smc_write);
 
-int apple_smc_rw(struct apple_smc *smc, smc_key key, void *wbuf, size_t wsize,
+int apple_smc_rw(struct apple_smc *smc, smc_key key, const void *wbuf, size_t wsize,
 		 void *rbuf, size_t rsize)
 {
 	guard(mutex)(&smc->mutex);
@@ -239,7 +239,7 @@ int apple_smc_enter_atomic(struct apple_smc *smc)
 }
 EXPORT_SYMBOL(apple_smc_enter_atomic);
 
-int apple_smc_write_atomic(struct apple_smc *smc, smc_key key, void *buf, size_t size)
+int apple_smc_write_atomic(struct apple_smc *smc, smc_key key, const void *buf, size_t size)
 {
 	guard(spinlock_irqsave)(&smc->lock);
 	u8 result;
diff --git a/include/linux/mfd/macsmc.h b/include/linux/mfd/macsmc.h
index 6b13f01a8592..3c5467854e28 100644
--- a/include/linux/mfd/macsmc.h
+++ b/include/linux/mfd/macsmc.h
@@ -149,7 +149,7 @@ int apple_smc_read(struct apple_smc *smc, smc_key key, void *buf, size_t size);
  *
  * Return: Zero on success, negative errno on error
  */
-int apple_smc_write(struct apple_smc *smc, smc_key key, void *buf, size_t size);
+int apple_smc_write(struct apple_smc *smc, smc_key key, const void *buf, size_t size);
 
 /**
  * apple_smc_enter_atomic - Enter atomic mode to be able to use apple_smc_write_atomic
@@ -176,7 +176,7 @@ int apple_smc_enter_atomic(struct apple_smc *smc);
  *
  * Return: Zero on success, negative errno on error
  */
-int apple_smc_write_atomic(struct apple_smc *smc, smc_key key, void *buf, size_t size);
+int apple_smc_write_atomic(struct apple_smc *smc, smc_key key, const void *buf, size_t size);
 
 /**
  * apple_smc_rw - Write and then read using the given SMC key
@@ -189,7 +189,7 @@ int apple_smc_write_atomic(struct apple_smc *smc, smc_key key, void *buf, size_t
  *
  * Return: Zero on success, negative errno on error
  */
-int apple_smc_rw(struct apple_smc *smc, smc_key key, void *wbuf, size_t wsize,
+int apple_smc_rw(struct apple_smc *smc, smc_key key, const void *wbuf, size_t wsize,
 		 void *rbuf, size_t rsize);
 
 /**
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH RESEND] mfd/macsmc: make SMC write buffers const
  2025-10-07 13:05 [PATCH RESEND] mfd/macsmc: make SMC write buffers const Atharva Tiwari
@ 2025-10-08 14:20 ` Sven Peter
  2025-10-09 12:26 ` Lee Jones
  1 sibling, 0 replies; 3+ messages in thread
From: Sven Peter @ 2025-10-08 14:20 UTC (permalink / raw)
  To: Atharva Tiwari
  Cc: Janne Grunau, Neal Gompa, Lee Jones, asahi, linux-arm-kernel,
	linux-kernel

On 07.10.25 15:05, Atharva Tiwari wrote:
> Mark the write buffer arguments in apple_smc_write(), apple_smc_rw(),
> and apple_smc_write_atomic() as const. These functions do not modify
> the data provided by the caller, so the parameters should be const
> qualified.
> 
> Signed-off-by: Atharva Tiwari <atharvatiwarilinuxdev@gmail.com>
> ---

Reviewed-by: Sven Peter <sven@kernel.org>


Thanks,


Sven




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH RESEND] mfd/macsmc: make SMC write buffers const
  2025-10-07 13:05 [PATCH RESEND] mfd/macsmc: make SMC write buffers const Atharva Tiwari
  2025-10-08 14:20 ` Sven Peter
@ 2025-10-09 12:26 ` Lee Jones
  1 sibling, 0 replies; 3+ messages in thread
From: Lee Jones @ 2025-10-09 12:26 UTC (permalink / raw)
  To: Atharva Tiwari
  Cc: Sven Peter, Janne Grunau, Neal Gompa, asahi, linux-arm-kernel,
	linux-kernel

On Tue, 07 Oct 2025, Atharva Tiwari wrote:

> Mark the write buffer arguments in apple_smc_write(), apple_smc_rw(),
> and apple_smc_write_atomic() as const. These functions do not modify
> the data provided by the caller, so the parameters should be const
> qualified.
> 
> Signed-off-by: Atharva Tiwari <atharvatiwarilinuxdev@gmail.com>
> ---
>  drivers/mfd/macsmc.c       | 6 +++---
>  include/linux/mfd/macsmc.h | 6 +++---
>  2 files changed, 6 insertions(+), 6 deletions(-)

Applied, thanks

-- 
Lee Jones [李琼斯]


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-10-09 12:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-07 13:05 [PATCH RESEND] mfd/macsmc: make SMC write buffers const Atharva Tiwari
2025-10-08 14:20 ` Sven Peter
2025-10-09 12:26 ` Lee Jones

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).