usb/uhci: Disallow user creating a vt82c686-uhci-pci device
PATCH 1/1 usb/uhci: Disallow user creating a vt82c686-uhci-pci device
Because this device only works as part of VIA superio chips set user creatable to false. Since the class init method is common for UHCI variants introduce a flag in UHCIInfo for this.
Signed-off-by BALATON Zoltan <[email protected]>
---
This should come before the other patches changing to use via_isa_set_irq
hw/usb/hcd-uhci.c | 3 +++ hw/usb/hcd-uhci.h | 1 + hw/usb/vt82c686-uhci-pci.c | 2 ++ 3 files changed, 6 insertions(+)
hw/usb/hcd-uhci.c +3 -0
@@ -1284,6 +1284,9 @@ void uhci_data_class_init(ObjectClass *klass, void *data) }else {device_class_set_props (dc, uhci_properties_standalone); } +if (info->notuser) { + dc->user_creatable = false; + } u->info = *info; }
hw/usb/hcd-uhci.h +1 -0
@@ -85,6 +85,7 @@ typedef struct UHCIInfo {uint8_t irq_pin;void (*realize)(PCIDevice *dev,Error **errp);bool unplug; +bool notuser;/* disallow user_creatable */ } UHCIInfo;void uhci_data_class_init (ObjectClass *klass,void *data);
hw/usb/vt82c686-uhci-pci.c +2 -0
@@ -37,6 +37,8 @@ static UHCIInfo uhci_info[] = { .irq_pin = 3, .realize = usb_uhci_vt82c686b_realize, .unplug = true, + /* Reason: only works as USB function of VT82xx superio chips */ + .notuser = true, } };
Signature · 1 line
2.21.4
Quoted 5 lines · BALATON Zoltan
Because this device only works as part of VIA superio chips set user creatable to false. Since the class init method is common for UHCI variants introduce a flag in UHCIInfo for this.
Signed-off-by BALATON Zoltan <[email protected]>
Reviewed-by Gerd Hoffmann <[email protected]>