git: c57c02ebf7bc - main - smr: Load to accept pointers to const pointers

From: Olivier Certner <olce_at_FreeBSD.org>
Date: Mon, 20 Jan 2025 15:50:46 UTC
The branch main has been updated by olce:

URL: https://cgit.FreeBSD.org/src/commit/?id=c57c02ebf7bcc9b02a0dc11711e8d8a6960ad34b

commit c57c02ebf7bcc9b02a0dc11711e8d8a6960ad34b
Author:     Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2025-01-20 14:38:42 +0000
Commit:     Olivier Certner <olce@FreeBSD.org>
CommitDate: 2025-01-20 15:49:52 +0000

    smr: Load to accept pointers to const pointers
    
    Pointers passed to the smr_entered_load() and smr_serialized_load()
    macros are in the end used as arguments to atomic_load_*ptr(), so
    convert them to the now acceptable 'const uintptr_t *' ones (instead of
    'uintptr_tr *'), making these macros accept pointers to constant
    pointers.
    
    Reviewed by:    kib
    MFC after:      4 days
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D48497
---
 sys/sys/smr_types.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/sys/sys/smr_types.h b/sys/sys/smr_types.h
index 9da4a73c568c..0257236f7314 100644
--- a/sys/sys/smr_types.h
+++ b/sys/sys/smr_types.h
@@ -60,7 +60,8 @@ struct {								\
  */
 #define	smr_entered_load(p, smr) ({					\
 	SMR_ASSERT(SMR_ENTERED((smr)), "smr_entered_load");		\
-	(__typeof((p)->__ptr))atomic_load_acq_ptr((uintptr_t *)&(p)->__ptr); \
+	(__typeof((p)->__ptr))atomic_load_acq_ptr(			\
+	    (const uintptr_t *)&(p)->__ptr);				\
 })
 
 /*
@@ -70,7 +71,8 @@ struct {								\
  */
 #define	smr_serialized_load(p, ex) ({					\
 	SMR_ASSERT(ex, "smr_serialized_load");				\
-	(__typeof((p)->__ptr))atomic_load_ptr(&(p)->__ptr);		\
+	(__typeof((p)->__ptr))atomic_load_ptr(				\
+	    (const uintptr_t *)&(p)->__ptr);				\
 })
 
 /*