Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mfd: macsmc: Make SMC write buffers const

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>
Signed-off-by: Lee Jones <lee@kernel.org>

authored by

Atharva Tiwari and committed by
Lee Jones
d306cbbc dbecccac

+6 -6
+3 -3
drivers/mfd/macsmc.c
··· 173 173 } 174 174 EXPORT_SYMBOL(apple_smc_read); 175 175 176 - int apple_smc_write(struct apple_smc *smc, smc_key key, void *buf, size_t size) 176 + int apple_smc_write(struct apple_smc *smc, smc_key key, const void *buf, size_t size) 177 177 { 178 178 guard(mutex)(&smc->mutex); 179 179 ··· 181 181 } 182 182 EXPORT_SYMBOL(apple_smc_write); 183 183 184 - int apple_smc_rw(struct apple_smc *smc, smc_key key, void *wbuf, size_t wsize, 184 + int apple_smc_rw(struct apple_smc *smc, smc_key key, const void *wbuf, size_t wsize, 185 185 void *rbuf, size_t rsize) 186 186 { 187 187 guard(mutex)(&smc->mutex); ··· 239 239 } 240 240 EXPORT_SYMBOL(apple_smc_enter_atomic); 241 241 242 - int apple_smc_write_atomic(struct apple_smc *smc, smc_key key, void *buf, size_t size) 242 + int apple_smc_write_atomic(struct apple_smc *smc, smc_key key, const void *buf, size_t size) 243 243 { 244 244 guard(spinlock_irqsave)(&smc->lock); 245 245 u8 result;
+3 -3
include/linux/mfd/macsmc.h
··· 150 150 * 151 151 * Return: Zero on success, negative errno on error 152 152 */ 153 - int apple_smc_write(struct apple_smc *smc, smc_key key, void *buf, size_t size); 153 + int apple_smc_write(struct apple_smc *smc, smc_key key, const void *buf, size_t size); 154 154 155 155 /** 156 156 * apple_smc_enter_atomic - Enter atomic mode to be able to use apple_smc_write_atomic ··· 177 177 * 178 178 * Return: Zero on success, negative errno on error 179 179 */ 180 - int apple_smc_write_atomic(struct apple_smc *smc, smc_key key, void *buf, size_t size); 180 + int apple_smc_write_atomic(struct apple_smc *smc, smc_key key, const void *buf, size_t size); 181 181 182 182 /** 183 183 * apple_smc_rw - Write and then read using the given SMC key ··· 190 190 * 191 191 * Return: Zero on success, negative errno on error 192 192 */ 193 - int apple_smc_rw(struct apple_smc *smc, smc_key key, void *wbuf, size_t wsize, 193 + int apple_smc_rw(struct apple_smc *smc, smc_key key, const void *wbuf, size_t wsize, 194 194 void *rbuf, size_t rsize); 195 195 196 196 /**