Skip to contentSkip to conversation

x86/vrtc: Use a real type for rtc_ioport_write()

PATCH In review Andrew Cooper 2 participants 3 messages Jul 28

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/vrtc: Use a real type for rtc_ioport_write()

---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Teddy Astie <[email protected]>

---
 xen/arch/x86/hvm/rtc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
xen/arch/x86/hvm/rtc.c +1 -2
index 65b3b79f1edb..9895dd570c65 100644
@@ -469,9 +469,8 @@ static void cf_check rtc_alarm_cb(void *opaque)
     spin_unlock(&s->lock);
 }
 
-static int rtc_ioport_write(void *opaque, uint32_t addr, uint32_t data)
+static int rtc_ioport_write(RTCState *s, uint32_t addr, uint32_t data)
 {
-    RTCState *s = opaque;
     struct domain *d = vrtc_domain(s);
     uint32_t orig;
 

base-commit: 75f920bd47a4f59eaaa4596aa3f4e12a447d26d2

Signature · 1 line
2.39.5
Reviewed-by on v1 1/1
#1 lore raw
Quoted 1 line · Andrew Cooper

xen/arch/x86/hvm/rtc.c static void cf_check rtc_alarm_cb(void *opaque) · line 475

Quoted 12 lines
xen/arch/x86/hvm/rtc.c +1 -2
@@ -469,9 +469,8 @@ static void cf_check rtc_alarm_cb(void *opaque)
     spin_unlock(&s->lock);
 }
 
-static int rtc_ioport_write(void *opaque, uint32_t addr, uint32_t data)
+static int rtc_ioport_write(RTCState *s, uint32_t addr, uint32_t data)
 {
-    RTCState *s = opaque;
     struct domain *d = vrtc_domain(s);
     uint32_t orig;

It's entirely unclear why it was ever done like this. Even in 3.2 it could already have been done the type-correct way.

Jan

#2 lore raw
Quoted 3 lines · Jan Beulich
Quoted 1 line · Andrew Cooper

Thanks.

Quoted 7 lines
Quoted 7 lines
xen/arch/x86/hvm/rtc.c +0 -0
@@ -469,9 +469,8 @@ static void cf_check rtc_alarm_cb(void *opaque)
     spin_unlock(&s->lock);
 }
 
Quoted 8 lines

xen/arch/x86/hvm/rtc.c static void cf_check rtc_alarm_cb(void *opaque) · line 475

Quoted 6 lines
xen/arch/x86/hvm/rtc.c +1 -2
-static int rtc_ioport_write(void *opaque, uint32_t addr, uint32_t data)
+static int rtc_ioport_write(RTCState *s, uint32_t addr, uint32_t data)
 {
-    RTCState *s = opaque;
     struct domain *d = vrtc_domain(s);
     uint32_t orig;

It's entirely unclear why it was ever done like this. Even in 3.2 it could already have been done the type-correct way.

There are a whole bunch of callbacks which use this pattern.  They must continue to use void * for the function types to work.

I wonder if at any point in the past rtc_ioport_write() was used directly as a pointee, but I haven't gone looking.

~Andrew