[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 9/9] hw/usb/u2f-passthru: Use QOM type-safe cast conversion macro
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 9/9] hw/usb/u2f-passthru: Use QOM type-safe cast conversion macros |
Date: |
Mon, 20 Feb 2023 16:05:15 +0100 |
Use the QOM cast macros to avoid accessing internal fields.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/usb/u2f-passthru.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/hw/usb/u2f-passthru.c b/hw/usb/u2f-passthru.c
index fc93429c9c..b99c0b622f 100644
--- a/hw/usb/u2f-passthru.c
+++ b/hw/usb/u2f-passthru.c
@@ -299,7 +299,7 @@ static void u2f_passthru_recv_from_host(U2FPassthruState
*key,
if (transaction->resp_size >= transaction->resp_bcnt) {
u2f_transaction_close(key, cid);
}
- u2f_send_to_guest(&key->base, packet);
+ u2f_send_to_guest(U2F_KEY(key), packet);
}
static void u2f_passthru_read(void *opaque)
@@ -316,9 +316,10 @@ static void u2f_passthru_read(void *opaque)
ret = read(key->hidraw_fd, packet, sizeof(packet));
if (ret < 0) {
+ USBDevice *udev = USB_DEVICE(key);
/* Detach */
- if (base->dev.attached) {
- usb_device_detach(&base->dev);
+ if (udev->attached) {
+ usb_device_detach(udev);
u2f_passthru_reset(key);
}
return;
--
2.38.1
- [PATCH 4/9] hw/usb/hcd-uhci: Declare QOM macros using OBJECT_DECLARE_TYPE(), (continued)
- [PATCH 4/9] hw/usb/hcd-uhci: Declare QOM macros using OBJECT_DECLARE_TYPE(), Philippe Mathieu-Daudé, 2023/02/20
- [PATCH 5/9] hw/usb/hcd-uhci: Replace container_of() by UHCI_GET_CLASS() QOM macro, Philippe Mathieu-Daudé, 2023/02/20
- [PATCH 6/9] hw/usb/hcd-xhci-nec: Declare QOM macros for NEC_XHCI, Philippe Mathieu-Daudé, 2023/02/20
- [PATCH 7/9] hw/usb/hcd-xhci-nec: Replace container_of() by NEC_XHCI() QOM cast macro, Philippe Mathieu-Daudé, 2023/02/20
- [PATCH 8/9] hw/usb/u2f: Declare QOM macros using OBJECT_DECLARE_TYPE(), Philippe Mathieu-Daudé, 2023/02/20
- [PATCH 9/9] hw/usb/u2f-passthru: Use QOM type-safe cast conversion macros,
Philippe Mathieu-Daudé <=