qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [FOR 0.12 PATCH v2 0/3] Replace device names containing whitespace
@ 2009-12-09 16:07 Markus Armbruster
  2009-12-09 16:07 ` [Qemu-devel] [FOR 0.12 PATCH v2 1/3] qdev: Rename USBDevice member devname to product_desc Markus Armbruster
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Markus Armbruster @ 2009-12-09 16:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: kraxel

Device names with whitespace require quoting in the shell and in the
monitor.  Some of the offenders are also overly long.  Some have a
more convenient alias, some don't.

The place for verbose device names is DeviceInfo member desc.  The
name should be short & sweet.

This patch gets rid of the spaces.  It normalizes names it touches to
lower case with '-' separators.  This seems to be the most common
style.  If you want me to normalize all device names, I can do that.

On naming style: we have 187 device names.  41 of them use upper
case. 40 use '-' as separator, 39 use '_', 19 use ',', and 30 use
space.  10 of them use two different separators simultaneously.

I checked every use of DeviceInfo members name and alias to find places
that use it for purposes other than naming qdevs.  They are:

* Some NIC initialization functions pass the qdev name to
  qemu_new_nic() parameter model.  It ends up in VLANClientState
  member model.  I believe changing that from long description to
  short name is an improvement.  None of the devices using
  qemu_new_nic() that way get their names changed here.

* usb_qdev_init() copies the qdev name to USBDevice devname.  Gets
  overwritten for usb-host devices, but not for the others.  This is
  what Gerd pointed out.  I fixed it just like Gerd recommended.

Markus Armbruster (3):
  qdev: Rename USBDevice member devname to product_desc
  qdev: Separate USB product description from qdev name
  qdev: Replace device names containing whitespace

 hw/bt-hid.c      |    4 ++--
 hw/cirrus_vga.c  |    5 +++--
 hw/grackle_pci.c |    4 ++--
 hw/ide/cmd646.c  |    4 ++--
 hw/ide/piix.c    |    8 ++++----
 hw/unin_pci.c    |   30 +++++++++++++++---------------
 hw/usb-bt.c      |    5 +++--
 hw/usb-bus.c     |   13 +++++++------
 hw/usb-hid.c     |   14 +++++++-------
 hw/usb-hub.c     |    3 ++-
 hw/usb-msd.c     |    6 +++---
 hw/usb-net.c     |    5 +++--
 hw/usb-ohci.c    |    5 ++---
 hw/usb-serial.c  |   12 ++++++------
 hw/usb-uhci.c    |    8 ++++----
 hw/usb-wacom.c   |    5 +++--
 hw/usb.h         |    4 +++-
 hw/vmware_vga.c  |    4 ++--
 usb-bsd.c        |    9 +++++----
 usb-linux.c      |   10 +++++-----
 20 files changed, 83 insertions(+), 75 deletions(-)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Qemu-devel] [FOR 0.12 PATCH v2 1/3] qdev: Rename USBDevice member devname to product_desc
  2009-12-09 16:07 [Qemu-devel] [FOR 0.12 PATCH v2 0/3] Replace device names containing whitespace Markus Armbruster
@ 2009-12-09 16:07 ` Markus Armbruster
  2009-12-09 16:07 ` [Qemu-devel] [FOR 0.12 PATCH v2 2/3] qdev: Separate USB product description from qdev name Markus Armbruster
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Markus Armbruster @ 2009-12-09 16:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: kraxel

It's not a device name, it's the USB product description string.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 hw/bt-hid.c  |    2 +-
 hw/usb-bus.c |   11 ++++++-----
 hw/usb-hid.c |    2 +-
 hw/usb.h     |    2 +-
 usb-bsd.c    |    4 ++--
 usb-linux.c  |    4 ++--
 6 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/hw/bt-hid.c b/hw/bt-hid.c
index 020176e..4a04bbd 100644
--- a/hw/bt-hid.c
+++ b/hw/bt-hid.c
@@ -552,7 +552,7 @@ static struct bt_device_s *bt_hid_init(struct bt_scatternet_s *net,
                     BT_HID_MTU, bt_hid_new_interrupt_ch);
 
     s->usbdev = dev;
-    s->btdev.device.lmp_name = s->usbdev->devname;
+    s->btdev.device.lmp_name = s->usbdev->product_desc;
     usb_hid_datain_cb(s->usbdev, s, bt_hid_datain);
 
     s->btdev.device.handle_destroy = bt_hid_destroy;
diff --git a/hw/usb-bus.c b/hw/usb-bus.c
index 99d185e..ba1b6e3 100644
--- a/hw/usb-bus.c
+++ b/hw/usb-bus.c
@@ -43,7 +43,7 @@ static int usb_qdev_init(DeviceState *qdev, DeviceInfo *base)
     USBDeviceInfo *info = DO_UPCAST(USBDeviceInfo, qdev, base);
     int rc;
 
-    pstrcpy(dev->devname, sizeof(dev->devname), qdev->info->name);
+    pstrcpy(dev->product_desc, sizeof(dev->product_desc), qdev->info->name);
     dev->info = info;
     dev->auto_attach = 1;
     rc = dev->info->init(dev);
@@ -131,7 +131,7 @@ static void do_attach(USBDevice *dev)
 
     if (dev->attached) {
         fprintf(stderr, "Warning: tried to attach usb device %s twice\n",
-                dev->devname);
+                dev->product_desc);
         return;
     }
     dev->attached++;
@@ -166,7 +166,7 @@ int usb_device_detach(USBDevice *dev)
 
     if (!dev->attached) {
         fprintf(stderr, "Warning: tried to detach unattached usb device %s\n",
-                dev->devname);
+                dev->product_desc);
         return -1;
     }
     dev->attached--;
@@ -228,7 +228,7 @@ static void usb_bus_dev_print(Monitor *mon, DeviceState *qdev, int indent)
 
     monitor_printf(mon, "%*saddr %d.%d, speed %s, name %s%s\n",
                    indent, "", bus->busnr, dev->addr,
-                   usb_speed(dev->speed), dev->devname,
+                   usb_speed(dev->speed), dev->product_desc,
                    dev->attached ? ", attached" : "");
 }
 
@@ -249,7 +249,8 @@ void usb_info(Monitor *mon)
             if (!dev)
                 continue;
             monitor_printf(mon, "  Device %d.%d, Speed %s Mb/s, Product %s\n",
-                           bus->busnr, dev->addr, usb_speed(dev->speed), dev->devname);
+                           bus->busnr, dev->addr, usb_speed(dev->speed),
+                           dev->product_desc);
         }
     }
 }
diff --git a/hw/usb-hid.c b/hw/usb-hid.c
index f4a2a48..6621f72 100644
--- a/hw/usb-hid.c
+++ b/hw/usb-hid.c
@@ -701,7 +701,7 @@ static int usb_hid_handle_control(USBDevice *dev, int request, int value,
                 break;
             case 2:
                 /* product description */
-                ret = set_usb_string(data, s->dev.devname);
+                ret = set_usb_string(data, s->dev.product_desc);
                 break;
             case 3:
                 /* vendor description */
diff --git a/hw/usb.h b/hw/usb.h
index 351c466..39aba99 100644
--- a/hw/usb.h
+++ b/hw/usb.h
@@ -132,7 +132,7 @@ struct USBDevice {
 
     int speed;
     uint8_t addr;
-    char devname[32];
+    char product_desc[32];
     int auto_attach;
     int attached;
 
diff --git a/usb-bsd.c b/usb-bsd.c
index a66364f..a9987d1 100644
--- a/usb-bsd.c
+++ b/usb-bsd.c
@@ -370,10 +370,10 @@ USBDevice *usb_host_device_open(const char *devname)
             dev->dev.speed = USB_SPEED_FULL - 1;
 
         if (strncmp(dev_info.udi_product, "product", 7) != 0)
-            pstrcpy(dev->dev.devname, sizeof(dev->dev.devname),
+            pstrcpy(dev->dev.product_desc, sizeof(dev->dev.product_desc),
                     dev_info.udi_product);
         else
-            snprintf(dev->dev.devname, sizeof(dev->dev.devname),
+            snprintf(dev->dev.product_desc, sizeof(dev->dev.product_desc),
                      "host:%s", devname);
 
         pstrcpy(dev->devpath, sizeof(dev->devpath), "/dev/");
diff --git a/usb-linux.c b/usb-linux.c
index 285ac22..67735d3 100644
--- a/usb-linux.c
+++ b/usb-linux.c
@@ -933,10 +933,10 @@ static int usb_host_open(USBHostDevice *dev, int bus_num,
         dev->dev.speed = USB_SPEED_HIGH;
 
     if (!prod_name || prod_name[0] == '\0')
-        snprintf(dev->dev.devname, sizeof(dev->dev.devname),
+        snprintf(dev->dev.product_desc, sizeof(dev->dev.product_desc),
                  "host:%d.%d", bus_num, addr);
     else
-        pstrcpy(dev->dev.devname, sizeof(dev->dev.devname),
+        pstrcpy(dev->dev.product_desc, sizeof(dev->dev.product_desc),
                 prod_name);
 
     /* USB devio uses 'write' flag to check for async completions */
-- 
1.6.2.5

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Qemu-devel] [FOR 0.12 PATCH v2 2/3] qdev: Separate USB product description from qdev name
  2009-12-09 16:07 [Qemu-devel] [FOR 0.12 PATCH v2 0/3] Replace device names containing whitespace Markus Armbruster
  2009-12-09 16:07 ` [Qemu-devel] [FOR 0.12 PATCH v2 1/3] qdev: Rename USBDevice member devname to product_desc Markus Armbruster
@ 2009-12-09 16:07 ` Markus Armbruster
  2009-12-09 16:07 ` [Qemu-devel] [FOR 0.12 PATCH v2 3/3] qdev: Replace device names containing whitespace Markus Armbruster
  2009-12-09 16:35 ` [Qemu-devel] [FOR 0.12 PATCH v2 0/3] " Gerd Hoffmann
  3 siblings, 0 replies; 5+ messages in thread
From: Markus Armbruster @ 2009-12-09 16:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: kraxel

Using the qdev name for the product description makes for inconvenient
qdev names.

Put the product description in new USBDeviceInfo member product_desc.
Make usb_qdev_init() use it.  No user or guest visible change, since
the value is still the same.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 hw/usb-bt.c     |    1 +
 hw/usb-bus.c    |    2 +-
 hw/usb-hid.c    |    3 +++
 hw/usb-hub.c    |    1 +
 hw/usb-msd.c    |    1 +
 hw/usb-net.c    |    1 +
 hw/usb-serial.c |    2 ++
 hw/usb-wacom.c  |    1 +
 hw/usb.h        |    2 ++
 usb-bsd.c       |    1 +
 usb-linux.c     |    1 +
 11 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/hw/usb-bt.c b/hw/usb-bt.c
index 18d7a98..07da133 100644
--- a/hw/usb-bt.c
+++ b/hw/usb-bt.c
@@ -645,6 +645,7 @@ USBDevice *usb_bt_init(HCIInfo *hci)
 }
 
 static struct USBDeviceInfo bt_info = {
+    .product_desc   = "QEMU BT dongle",
     .qdev.name      = "QEMU BT dongle",
     .qdev.size      = sizeof(struct USBBtState),
     .init           = usb_bt_initfn,
diff --git a/hw/usb-bus.c b/hw/usb-bus.c
index ba1b6e3..8bbc80d 100644
--- a/hw/usb-bus.c
+++ b/hw/usb-bus.c
@@ -43,7 +43,7 @@ static int usb_qdev_init(DeviceState *qdev, DeviceInfo *base)
     USBDeviceInfo *info = DO_UPCAST(USBDeviceInfo, qdev, base);
     int rc;
 
-    pstrcpy(dev->product_desc, sizeof(dev->product_desc), qdev->info->name);
+    pstrcpy(dev->product_desc, sizeof(dev->product_desc), info->product_desc);
     dev->info = info;
     dev->auto_attach = 1;
     rc = dev->info->init(dev);
diff --git a/hw/usb-hid.c b/hw/usb-hid.c
index 6621f72..33de302 100644
--- a/hw/usb-hid.c
+++ b/hw/usb-hid.c
@@ -880,6 +880,7 @@ void usb_hid_datain_cb(USBDevice *dev, void *opaque, void (*datain)(void *))
 
 static struct USBDeviceInfo hid_info[] = {
     {
+        .product_desc   = "QEMU USB Tablet",
         .qdev.name      = "QEMU USB Tablet",
         .qdev.alias     = "usb-tablet",
         .usbdevice_name = "tablet",
@@ -891,6 +892,7 @@ static struct USBDeviceInfo hid_info[] = {
         .handle_data    = usb_hid_handle_data,
         .handle_destroy = usb_hid_handle_destroy,
     },{
+        .product_desc   = "QEMU USB Mouse",
         .qdev.name      = "QEMU USB Mouse",
         .qdev.alias     = "usb-mouse",
         .usbdevice_name = "mouse",
@@ -902,6 +904,7 @@ static struct USBDeviceInfo hid_info[] = {
         .handle_data    = usb_hid_handle_data,
         .handle_destroy = usb_hid_handle_destroy,
     },{
+        .product_desc   = "QEMU USB Keyboard",
         .qdev.name      = "QEMU USB Keyboard",
         .qdev.alias     = "usb-kbd",
         .usbdevice_name = "keyboard",
diff --git a/hw/usb-hub.c b/hw/usb-hub.c
index e5a0938..32f2ab8 100644
--- a/hw/usb-hub.c
+++ b/hw/usb-hub.c
@@ -544,6 +544,7 @@ static int usb_hub_initfn(USBDevice *dev)
 }
 
 static struct USBDeviceInfo hub_info = {
+    .product_desc   = "QEMU USB Hub",
     .qdev.name      = "QEMU USB Hub",
     .qdev.size      = sizeof(USBHubState),
     .init           = usb_hub_initfn,
diff --git a/hw/usb-msd.c b/hw/usb-msd.c
index bb39b62..b9f6588 100644
--- a/hw/usb-msd.c
+++ b/hw/usb-msd.c
@@ -600,6 +600,7 @@ static USBDevice *usb_msd_init(const char *filename)
 }
 
 static struct USBDeviceInfo msd_info = {
+    .product_desc   = "QEMU USB MSD",
     .qdev.name      = "QEMU USB MSD",
     .qdev.alias     = "usb-storage",
     .qdev.size      = sizeof(MSDState),
diff --git a/hw/usb-net.c b/hw/usb-net.c
index 2556e05..3dd05e3 100644
--- a/hw/usb-net.c
+++ b/hw/usb-net.c
@@ -1487,6 +1487,7 @@ USBDevice *usb_net_init(NICInfo *nd)
 }
 
 static struct USBDeviceInfo net_info = {
+    .product_desc   = "QEMU USB Network Interface",
     .qdev.name      = "QEMU USB Network Interface",
     .qdev.size      = sizeof(USBNetState),
     .init           = usb_net_initfn,
diff --git a/hw/usb-serial.c b/hw/usb-serial.c
index 223d4c3..14e410e 100644
--- a/hw/usb-serial.c
+++ b/hw/usb-serial.c
@@ -605,6 +605,7 @@ static USBDevice *usb_braille_init(const char *unused)
 }
 
 static struct USBDeviceInfo serial_info = {
+    .product_desc   = "QEMU USB Serial",
     .qdev.name      = "QEMU USB Serial",
     .qdev.alias     = "usb-serial",
     .qdev.size      = sizeof(USBSerialState),
@@ -625,6 +626,7 @@ static struct USBDeviceInfo serial_info = {
 };
 
 static struct USBDeviceInfo braille_info = {
+    .product_desc   = "QEMU USB Braille",
     .qdev.name      = "QEMU USB Braille",
     .qdev.alias     = "usb-braille",
     .qdev.size      = sizeof(USBSerialState),
diff --git a/hw/usb-wacom.c b/hw/usb-wacom.c
index ef61376..b10864f 100644
--- a/hw/usb-wacom.c
+++ b/hw/usb-wacom.c
@@ -409,6 +409,7 @@ static int usb_wacom_initfn(USBDevice *dev)
 }
 
 static struct USBDeviceInfo wacom_info = {
+    .product_desc   = "QEMU PenPartner Tablet",
     .qdev.name      = "QEMU PenPartner Tablet",
     .qdev.alias     = "wacom-tablet",
     .usbdevice_name = "wacom-tablet",
diff --git a/hw/usb.h b/hw/usb.h
index 39aba99..0684588 100644
--- a/hw/usb.h
+++ b/hw/usb.h
@@ -185,6 +185,8 @@ struct USBDeviceInfo {
      */
     int (*handle_data)(USBDevice *dev, USBPacket *p);
 
+    const char *product_desc;
+
     /* handle legacy -usbdevice command line options */
     const char *usbdevice_name;
     USBDevice *(*usbdevice_init)(const char *params);
diff --git a/usb-bsd.c b/usb-bsd.c
index a9987d1..e72d123 100644
--- a/usb-bsd.c
+++ b/usb-bsd.c
@@ -393,6 +393,7 @@ fail:
 }
 
 static struct USBDeviceInfo usb_host_dev_info = {
+    .product_desc   = "USB Host Device",
     .qdev.name      = "USB Host Device",
     .qdev.size      = sizeof(USBHostDevice),
     .init           = usb_host_initfn,
diff --git a/usb-linux.c b/usb-linux.c
index 67735d3..0004e96 100644
--- a/usb-linux.c
+++ b/usb-linux.c
@@ -979,6 +979,7 @@ static int usb_host_initfn(USBDevice *dev)
 }
 
 static struct USBDeviceInfo usb_host_dev_info = {
+    .product_desc   = "USB Host Device",
     .qdev.name      = "USB Host Device",
     .qdev.alias     = "usb-host",
     .qdev.size      = sizeof(USBHostDevice),
-- 
1.6.2.5

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Qemu-devel] [FOR 0.12 PATCH v2 3/3] qdev: Replace device names containing whitespace
  2009-12-09 16:07 [Qemu-devel] [FOR 0.12 PATCH v2 0/3] Replace device names containing whitespace Markus Armbruster
  2009-12-09 16:07 ` [Qemu-devel] [FOR 0.12 PATCH v2 1/3] qdev: Rename USBDevice member devname to product_desc Markus Armbruster
  2009-12-09 16:07 ` [Qemu-devel] [FOR 0.12 PATCH v2 2/3] qdev: Separate USB product description from qdev name Markus Armbruster
@ 2009-12-09 16:07 ` Markus Armbruster
  2009-12-09 16:35 ` [Qemu-devel] [FOR 0.12 PATCH v2 0/3] " Gerd Hoffmann
  3 siblings, 0 replies; 5+ messages in thread
From: Markus Armbruster @ 2009-12-09 16:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: kraxel

Device names with whitespace require quoting in the shell and in the
monitor.  Some of the offenders are also overly long.  Some have a
more convenient alias, some don't.

The place for verbose device names is DeviceInfo member desc.  The
name should be short & sweet.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 hw/bt-hid.c      |    2 +-
 hw/cirrus_vga.c  |    5 +++--
 hw/grackle_pci.c |    4 ++--
 hw/ide/cmd646.c  |    4 ++--
 hw/ide/piix.c    |    8 ++++----
 hw/unin_pci.c    |   30 +++++++++++++++---------------
 hw/usb-bt.c      |    4 ++--
 hw/usb-bus.c     |    2 +-
 hw/usb-hid.c     |    9 +++------
 hw/usb-hub.c     |    2 +-
 hw/usb-msd.c     |    5 ++---
 hw/usb-net.c     |    4 ++--
 hw/usb-ohci.c    |    5 ++---
 hw/usb-serial.c  |   10 ++++------
 hw/usb-uhci.c    |    8 ++++----
 hw/usb-wacom.c   |    4 ++--
 hw/vmware_vga.c  |    4 ++--
 usb-bsd.c        |    4 ++--
 usb-linux.c      |    5 ++---
 19 files changed, 56 insertions(+), 63 deletions(-)

diff --git a/hw/bt-hid.c b/hw/bt-hid.c
index 4a04bbd..abdfd35 100644
--- a/hw/bt-hid.c
+++ b/hw/bt-hid.c
@@ -566,6 +566,6 @@ static struct bt_device_s *bt_hid_init(struct bt_scatternet_s *net,
 
 struct bt_device_s *bt_keyboard_init(struct bt_scatternet_s *net)
 {
-    USBDevice *dev = usb_create_simple(NULL /* FIXME */, "QEMU USB Keyboard");
+    USBDevice *dev = usb_create_simple(NULL /* FIXME */, "usb-kbd");
     return bt_hid_init(net, dev, class_keyboard);
 }
diff --git a/hw/cirrus_vga.c b/hw/cirrus_vga.c
index 2d1dd4e..24af81c 100644
--- a/hw/cirrus_vga.c
+++ b/hw/cirrus_vga.c
@@ -3217,11 +3217,12 @@ static int pci_cirrus_vga_initfn(PCIDevice *dev)
 
 void pci_cirrus_vga_init(PCIBus *bus)
 {
-    pci_create_simple(bus, -1, "Cirrus VGA");
+    pci_create_simple(bus, -1, "cirrus-vga");
 }
 
 static PCIDeviceInfo cirrus_vga_info = {
-    .qdev.name    = "Cirrus VGA",
+    .qdev.name    = "cirrus-vga",
+    .qdev.desc    = "Cirrus CLGD 54xx VGA",
     .qdev.size    = sizeof(PCICirrusVGAState),
     .qdev.vmsd    = &vmstate_pci_cirrus_vga,
     .init         = pci_cirrus_vga_initfn,
diff --git a/hw/grackle_pci.c b/hw/grackle_pci.c
index 089d1fb..ee4fed5 100644
--- a/hw/grackle_pci.c
+++ b/hw/grackle_pci.c
@@ -178,7 +178,7 @@ static PCIDeviceInfo grackle_pci_host_info = {
 };
 
 static PCIDeviceInfo dec_21154_pci_host_info = {
-    .qdev.name = "DEC 21154",
+    .qdev.name = "dec-21154",
     .qdev.size = sizeof(PCIDevice),
     .init      = dec_21154_pci_host_init,
 };
@@ -188,7 +188,7 @@ static void grackle_register_devices(void)
     sysbus_register_dev("grackle", sizeof(GrackleState),
                         pci_grackle_init_device);
     pci_qdev_register(&grackle_pci_host_info);
-    sysbus_register_dev("DEC 21154", sizeof(GrackleState),
+    sysbus_register_dev("dec-21154", sizeof(GrackleState),
                         pci_dec_21154_init_device);
     pci_qdev_register(&dec_21154_pci_host_info);
 }
diff --git a/hw/ide/cmd646.c b/hw/ide/cmd646.c
index 3b7c606..e1e626e 100644
--- a/hw/ide/cmd646.c
+++ b/hw/ide/cmd646.c
@@ -245,7 +245,7 @@ void pci_cmd646_ide_init(PCIBus *bus, DriveInfo **hd_table,
 {
     PCIDevice *dev;
 
-    dev = pci_create(bus, -1, "CMD646 IDE");
+    dev = pci_create(bus, -1, "cmd646-ide");
     qdev_prop_set_uint32(&dev->qdev, "secondary", secondary_ide_enabled);
     qdev_init_nofail(&dev->qdev);
 
@@ -254,7 +254,7 @@ void pci_cmd646_ide_init(PCIBus *bus, DriveInfo **hd_table,
 
 static PCIDeviceInfo cmd646_ide_info[] = {
     {
-        .qdev.name    = "CMD646 IDE",
+        .qdev.name    = "cmd646-ide",
         .qdev.size    = sizeof(PCIIDEState),
         .init         = pci_cmd646_ide_initfn,
         .qdev.props   = (Property[]) {
diff --git a/hw/ide/piix.c b/hw/ide/piix.c
index ec93f29..de36480 100644
--- a/hw/ide/piix.c
+++ b/hw/ide/piix.c
@@ -161,7 +161,7 @@ void pci_piix3_ide_init(PCIBus *bus, DriveInfo **hd_table, int devfn)
 {
     PCIDevice *dev;
 
-    dev = pci_create_simple(bus, devfn, "PIIX3 IDE");
+    dev = pci_create_simple(bus, devfn, "piix3-ide");
     pci_ide_create_devs(dev, hd_table);
 }
 
@@ -171,18 +171,18 @@ void pci_piix4_ide_init(PCIBus *bus, DriveInfo **hd_table, int devfn)
 {
     PCIDevice *dev;
 
-    dev = pci_create_simple(bus, devfn, "PIIX4 IDE");
+    dev = pci_create_simple(bus, devfn, "piix4-ide");
     pci_ide_create_devs(dev, hd_table);
 }
 
 static PCIDeviceInfo piix_ide_info[] = {
     {
-        .qdev.name    = "PIIX3 IDE",
+        .qdev.name    = "piix3-ide",
         .qdev.size    = sizeof(PCIIDEState),
         .qdev.no_user = 1,
         .init         = pci_piix3_ide_initfn,
     },{
-        .qdev.name    = "PIIX4 IDE",
+        .qdev.name    = "piix4-ide",
         .qdev.size    = sizeof(PCIIDEState),
         .qdev.no_user = 1,
         .init         = pci_piix4_ide_initfn,
diff --git a/hw/unin_pci.c b/hw/unin_pci.c
index 5b3f118..f07c966 100644
--- a/hw/unin_pci.c
+++ b/hw/unin_pci.c
@@ -148,7 +148,7 @@ PCIBus *pci_pmac_init(qemu_irq *pic)
 
     /* Use values found on a real PowerMac */
     /* Uninorth main bus */
-    dev = qdev_create(NULL, "Uni-north main");
+    dev = qdev_create(NULL, "uni-north-main");
     qdev_init_nofail(dev);
     s = sysbus_from_qdev(dev);
     d = FROM_SYSBUS(UNINState, s);
@@ -157,7 +157,7 @@ PCIBus *pci_pmac_init(qemu_irq *pic)
                                          pic, 11 << 3, 4);
 
 #if 0
-    pci_create_simple(d->host_state.bus, 11 << 3, "Uni-north main");
+    pci_create_simple(d->host_state.bus, 11 << 3, "uni-north-main");
 #endif
 
     sysbus_mmio_map(s, 0, 0xf2800000);
@@ -166,12 +166,12 @@ PCIBus *pci_pmac_init(qemu_irq *pic)
     /* DEC 21154 bridge */
 #if 0
     /* XXX: not activated as PPC BIOS doesn't handle multiple buses properly */
-    pci_create_simple(d->host_state.bus, 12 << 3, "DEC 21154");
+    pci_create_simple(d->host_state.bus, 12 << 3, "dec-21154");
 #endif
 
     /* Uninorth AGP bus */
-    pci_create_simple(d->host_state.bus, 11 << 3, "Uni-north AGP");
-    dev = qdev_create(NULL, "Uni-north AGP");
+    pci_create_simple(d->host_state.bus, 11 << 3, "uni-north-AGP");
+    dev = qdev_create(NULL, "uni-north-AGP");
     qdev_init_nofail(dev);
     s = sysbus_from_qdev(dev);
     sysbus_mmio_map(s, 0, 0xf0800000);
@@ -180,8 +180,8 @@ PCIBus *pci_pmac_init(qemu_irq *pic)
     /* Uninorth internal bus */
 #if 0
     /* XXX: not needed for now */
-    pci_create_simple(d->host_state.bus, 14 << 3, "Uni-north internal");
-    dev = qdev_create(NULL, "Uni-north internal");
+    pci_create_simple(d->host_state.bus, 14 << 3, "uni-north-internal");
+    dev = qdev_create(NULL, "uni-north-internal");
     qdev_init_nofail(dev);
     s = sysbus_from_qdev(dev);
     sysbus_mmio_map(s, 0, 0xf4800000);
@@ -260,41 +260,41 @@ static int unin_internal_pci_host_init(PCIDevice *d)
 }
 
 static PCIDeviceInfo unin_main_pci_host_info = {
-    .qdev.name = "Uni-north main",
+    .qdev.name = "uni-north-main",
     .qdev.size = sizeof(PCIDevice),
     .init      = unin_main_pci_host_init,
 };
 
 static PCIDeviceInfo dec_21154_pci_host_info = {
-    .qdev.name = "DEC 21154",
+    .qdev.name = "dec-21154",
     .qdev.size = sizeof(PCIDevice),
     .init      = dec_21154_pci_host_init,
 };
 
 static PCIDeviceInfo unin_agp_pci_host_info = {
-    .qdev.name = "Uni-north AGP",
+    .qdev.name = "uni-north-AGP",
     .qdev.size = sizeof(PCIDevice),
     .init      = unin_agp_pci_host_init,
 };
 
 static PCIDeviceInfo unin_internal_pci_host_info = {
-    .qdev.name = "Uni-north internal",
+    .qdev.name = "uni-north-internal",
     .qdev.size = sizeof(PCIDevice),
     .init      = unin_internal_pci_host_init,
 };
 
 static void unin_register_devices(void)
 {
-    sysbus_register_dev("Uni-north main", sizeof(UNINState),
+    sysbus_register_dev("uni-north-main", sizeof(UNINState),
                         pci_unin_main_init_device);
     pci_qdev_register(&unin_main_pci_host_info);
-    sysbus_register_dev("DEC 21154", sizeof(UNINState),
+    sysbus_register_dev("dec-21154", sizeof(UNINState),
                         pci_dec_21154_init_device);
     pci_qdev_register(&dec_21154_pci_host_info);
-    sysbus_register_dev("Uni-north AGP", sizeof(UNINState),
+    sysbus_register_dev("uni-north-AGP", sizeof(UNINState),
                         pci_unin_agp_init_device);
     pci_qdev_register(&unin_agp_pci_host_info);
-    sysbus_register_dev("Uni-north internal", sizeof(UNINState),
+    sysbus_register_dev("uni-north-internal", sizeof(UNINState),
                         pci_unin_internal_init_device);
     pci_qdev_register(&unin_internal_pci_host_info);
 }
diff --git a/hw/usb-bt.c b/hw/usb-bt.c
index 07da133..56d1a6c 100644
--- a/hw/usb-bt.c
+++ b/hw/usb-bt.c
@@ -630,7 +630,7 @@ USBDevice *usb_bt_init(HCIInfo *hci)
 
     if (!hci)
         return NULL;
-    dev = usb_create_simple(NULL /* FIXME */, "QEMU BT dongle");
+    dev = usb_create_simple(NULL /* FIXME */, "usb-bt-dongle");
     s = DO_UPCAST(struct USBBtState, dev, dev);
     s->dev.opaque = s;
 
@@ -646,7 +646,7 @@ USBDevice *usb_bt_init(HCIInfo *hci)
 
 static struct USBDeviceInfo bt_info = {
     .product_desc   = "QEMU BT dongle",
-    .qdev.name      = "QEMU BT dongle",
+    .qdev.name      = "usb-bt-dongle",
     .qdev.size      = sizeof(struct USBBtState),
     .init           = usb_bt_initfn,
     .handle_packet  = usb_generic_handle_packet,
diff --git a/hw/usb-bus.c b/hw/usb-bus.c
index 8bbc80d..54027df 100644
--- a/hw/usb-bus.c
+++ b/hw/usb-bus.c
@@ -153,7 +153,7 @@ int usb_device_attach(USBDevice *dev)
 
     if (bus->nfree == 1) {
         /* Create a new hub and chain it on.  */
-        hub = usb_create_simple(bus, "QEMU USB Hub");
+        hub = usb_create_simple(bus, "usb-hub");
     }
     do_attach(dev);
     return 0;
diff --git a/hw/usb-hid.c b/hw/usb-hid.c
index 33de302..6abb629 100644
--- a/hw/usb-hid.c
+++ b/hw/usb-hid.c
@@ -881,8 +881,7 @@ void usb_hid_datain_cb(USBDevice *dev, void *opaque, void (*datain)(void *))
 static struct USBDeviceInfo hid_info[] = {
     {
         .product_desc   = "QEMU USB Tablet",
-        .qdev.name      = "QEMU USB Tablet",
-        .qdev.alias     = "usb-tablet",
+        .qdev.name      = "usb-tablet",
         .usbdevice_name = "tablet",
         .qdev.size      = sizeof(USBHIDState),
         .init           = usb_tablet_initfn,
@@ -893,8 +892,7 @@ static struct USBDeviceInfo hid_info[] = {
         .handle_destroy = usb_hid_handle_destroy,
     },{
         .product_desc   = "QEMU USB Mouse",
-        .qdev.name      = "QEMU USB Mouse",
-        .qdev.alias     = "usb-mouse",
+        .qdev.name      = "usb-mouse",
         .usbdevice_name = "mouse",
         .qdev.size      = sizeof(USBHIDState),
         .init           = usb_mouse_initfn,
@@ -905,8 +903,7 @@ static struct USBDeviceInfo hid_info[] = {
         .handle_destroy = usb_hid_handle_destroy,
     },{
         .product_desc   = "QEMU USB Keyboard",
-        .qdev.name      = "QEMU USB Keyboard",
-        .qdev.alias     = "usb-kbd",
+        .qdev.name      = "usb-kbd",
         .usbdevice_name = "keyboard",
         .qdev.size      = sizeof(USBHIDState),
         .init           = usb_keyboard_initfn,
diff --git a/hw/usb-hub.c b/hw/usb-hub.c
index 32f2ab8..acf7f60 100644
--- a/hw/usb-hub.c
+++ b/hw/usb-hub.c
@@ -545,7 +545,7 @@ static int usb_hub_initfn(USBDevice *dev)
 
 static struct USBDeviceInfo hub_info = {
     .product_desc   = "QEMU USB Hub",
-    .qdev.name      = "QEMU USB Hub",
+    .qdev.name      = "usb-hub",
     .qdev.size      = sizeof(USBHubState),
     .init           = usb_hub_initfn,
     .handle_packet  = usb_hub_handle_packet,
diff --git a/hw/usb-msd.c b/hw/usb-msd.c
index b9f6588..1fb62ad 100644
--- a/hw/usb-msd.c
+++ b/hw/usb-msd.c
@@ -591,7 +591,7 @@ static USBDevice *usb_msd_init(const char *filename)
     }
 
     /* create guest device */
-    dev = usb_create(NULL /* FIXME */, "QEMU USB MSD");
+    dev = usb_create(NULL /* FIXME */, "usb-storage");
     qdev_prop_set_drive(&dev->qdev, "drive", dinfo);
     if (qdev_init(&dev->qdev) < 0)
         return NULL;
@@ -601,8 +601,7 @@ static USBDevice *usb_msd_init(const char *filename)
 
 static struct USBDeviceInfo msd_info = {
     .product_desc   = "QEMU USB MSD",
-    .qdev.name      = "QEMU USB MSD",
-    .qdev.alias     = "usb-storage",
+    .qdev.name      = "usb-storage",
     .qdev.size      = sizeof(MSDState),
     .init           = usb_msd_initfn,
     .handle_packet  = usb_generic_handle_packet,
diff --git a/hw/usb-net.c b/hw/usb-net.c
index 3dd05e3..122a0d8 100644
--- a/hw/usb-net.c
+++ b/hw/usb-net.c
@@ -1463,7 +1463,7 @@ USBDevice *usb_net_init(NICInfo *nd)
     USBDevice *dev;
     USBNetState *s;
 
-    dev = usb_create_simple(NULL /* FIXME */, "QEMU USB Network Interface");
+    dev = usb_create_simple(NULL /* FIXME */, "usb-net");
     s = DO_UPCAST(USBNetState, dev, dev);
 
     memcpy(s->conf.macaddr.a, nd->macaddr, sizeof(nd->macaddr));
@@ -1488,7 +1488,7 @@ USBDevice *usb_net_init(NICInfo *nd)
 
 static struct USBDeviceInfo net_info = {
     .product_desc   = "QEMU USB Network Interface",
-    .qdev.name      = "QEMU USB Network Interface",
+    .qdev.name      = "usb-net",
     .qdev.size      = sizeof(USBNetState),
     .init           = usb_net_initfn,
     .handle_packet  = usb_generic_handle_packet,
diff --git a/hw/usb-ohci.c b/hw/usb-ohci.c
index 7ab3a98..a8a014c 100644
--- a/hw/usb-ohci.c
+++ b/hw/usb-ohci.c
@@ -1736,7 +1736,7 @@ static int usb_ohci_initfn_pci(struct PCIDevice *dev)
 
 void usb_ohci_init_pci(struct PCIBus *bus, int devfn)
 {
-    pci_create_simple(bus, devfn, "OHCI USB PCI");
+    pci_create_simple(bus, devfn, "pci-ohci");
 }
 
 void usb_ohci_init_pxa(target_phys_addr_t base, int num_ports, int devfn,
@@ -1762,8 +1762,7 @@ void usb_ohci_init_sm501(uint32_t mmio_base, uint32_t localmem_base,
 }
 
 static PCIDeviceInfo ohci_info = {
-    .qdev.name    = "OHCI USB PCI",
-    .qdev.alias   = "pci-ohci",
+    .qdev.name    = "pci-ohci",
     .qdev.desc    = "Apple USB Controller",
     .qdev.size    = sizeof(OHCIPCIState),
     .init         = usb_ohci_initfn_pci,
diff --git a/hw/usb-serial.c b/hw/usb-serial.c
index 14e410e..2775cf0 100644
--- a/hw/usb-serial.c
+++ b/hw/usb-serial.c
@@ -577,7 +577,7 @@ static USBDevice *usb_serial_init(const char *filename)
     if (!cdrv)
         return NULL;
 
-    dev = usb_create(NULL /* FIXME */, "QEMU USB Serial");
+    dev = usb_create(NULL /* FIXME */, "usb-serial");
     qdev_prop_set_chr(&dev->qdev, "chardev", cdrv);
     if (vendorid)
         qdev_prop_set_uint16(&dev->qdev, "vendorid", vendorid);
@@ -597,7 +597,7 @@ static USBDevice *usb_braille_init(const char *unused)
     if (!cdrv)
         return NULL;
 
-    dev = usb_create(NULL /* FIXME */, "QEMU USB Braille");
+    dev = usb_create(NULL /* FIXME */, "usb-braille");
     qdev_prop_set_chr(&dev->qdev, "chardev", cdrv);
     qdev_init(&dev->qdev);
 
@@ -606,8 +606,7 @@ static USBDevice *usb_braille_init(const char *unused)
 
 static struct USBDeviceInfo serial_info = {
     .product_desc   = "QEMU USB Serial",
-    .qdev.name      = "QEMU USB Serial",
-    .qdev.alias     = "usb-serial",
+    .qdev.name      = "usb-serial",
     .qdev.size      = sizeof(USBSerialState),
     .init           = usb_serial_initfn,
     .handle_packet  = usb_generic_handle_packet,
@@ -627,8 +626,7 @@ static struct USBDeviceInfo serial_info = {
 
 static struct USBDeviceInfo braille_info = {
     .product_desc   = "QEMU USB Braille",
-    .qdev.name      = "QEMU USB Braille",
-    .qdev.alias     = "usb-braille",
+    .qdev.name      = "usb-braille",
     .qdev.size      = sizeof(USBSerialState),
     .init           = usb_serial_initfn,
     .handle_packet  = usb_generic_handle_packet,
diff --git a/hw/usb-uhci.c b/hw/usb-uhci.c
index ba26a4e..dc52737 100644
--- a/hw/usb-uhci.c
+++ b/hw/usb-uhci.c
@@ -1111,12 +1111,12 @@ static int usb_uhci_piix4_initfn(PCIDevice *dev)
 
 static PCIDeviceInfo uhci_info[] = {
     {
-        .qdev.name    = "PIIX3 USB-UHCI",
+        .qdev.name    = "piix3-usb-uhci",
         .qdev.size    = sizeof(UHCIState),
         .qdev.vmsd    = &vmstate_uhci,
         .init         = usb_uhci_piix3_initfn,
     },{
-        .qdev.name    = "PIIX4 USB-UHCI",
+        .qdev.name    = "piix4-usb-uhci",
         .qdev.size    = sizeof(UHCIState),
         .qdev.vmsd    = &vmstate_uhci,
         .init         = usb_uhci_piix4_initfn,
@@ -1133,10 +1133,10 @@ device_init(uhci_register);
 
 void usb_uhci_piix3_init(PCIBus *bus, int devfn)
 {
-    pci_create_simple(bus, devfn, "PIIX3 USB-UHCI");
+    pci_create_simple(bus, devfn, "piix3-usb-uhci");
 }
 
 void usb_uhci_piix4_init(PCIBus *bus, int devfn)
 {
-    pci_create_simple(bus, devfn, "PIIX4 USB-UHCI");
+    pci_create_simple(bus, devfn, "piix4-usb-uhci");
 }
diff --git a/hw/usb-wacom.c b/hw/usb-wacom.c
index b10864f..fe052eb 100644
--- a/hw/usb-wacom.c
+++ b/hw/usb-wacom.c
@@ -410,8 +410,8 @@ static int usb_wacom_initfn(USBDevice *dev)
 
 static struct USBDeviceInfo wacom_info = {
     .product_desc   = "QEMU PenPartner Tablet",
-    .qdev.name      = "QEMU PenPartner Tablet",
-    .qdev.alias     = "wacom-tablet",
+    .qdev.name      = "usb-wacom-tablet",
+    .qdev.desc      = "QEMU PenPartner Tablet",
     .usbdevice_name = "wacom-tablet",
     .qdev.size      = sizeof(USBWacomState),
     .init           = usb_wacom_initfn,
diff --git a/hw/vmware_vga.c b/hw/vmware_vga.c
index 240731a..33d4692 100644
--- a/hw/vmware_vga.c
+++ b/hw/vmware_vga.c
@@ -1194,11 +1194,11 @@ static int pci_vmsvga_initfn(PCIDevice *dev)
 
 void pci_vmsvga_init(PCIBus *bus)
 {
-    pci_create_simple(bus, -1, "QEMUware SVGA");
+    pci_create_simple(bus, -1, "vmware-svga");
 }
 
 static PCIDeviceInfo vmsvga_info = {
-    .qdev.name    = "QEMUware SVGA",
+    .qdev.name    = "vmware-svga",
     .qdev.size    = sizeof(struct pci_vmsvga_state_s),
     .qdev.vmsd    = &vmstate_vmware_vga,
     .init         = pci_vmsvga_initfn,
diff --git a/usb-bsd.c b/usb-bsd.c
index e72d123..48567a3 100644
--- a/usb-bsd.c
+++ b/usb-bsd.c
@@ -361,7 +361,7 @@ USBDevice *usb_host_device_open(const char *devname)
             goto fail;
         }
 
-        d = usb_create(NULL /* FIXME */, "USB Host Device");
+        d = usb_create(NULL /* FIXME */, "usb-host");
         dev = DO_UPCAST(USBHostDevice, dev, d);
 
         if (dev_info.udi_speed == 1)
@@ -394,7 +394,7 @@ fail:
 
 static struct USBDeviceInfo usb_host_dev_info = {
     .product_desc   = "USB Host Device",
-    .qdev.name      = "USB Host Device",
+    .qdev.name      = "usb-host",
     .qdev.size      = sizeof(USBHostDevice),
     .init           = usb_host_initfn,
     .handle_packet  = usb_generic_handle_packet,
diff --git a/usb-linux.c b/usb-linux.c
index 0004e96..105ce88 100644
--- a/usb-linux.c
+++ b/usb-linux.c
@@ -980,8 +980,7 @@ static int usb_host_initfn(USBDevice *dev)
 
 static struct USBDeviceInfo usb_host_dev_info = {
     .product_desc   = "USB Host Device",
-    .qdev.name      = "USB Host Device",
-    .qdev.alias     = "usb-host",
+    .qdev.name      = "usb-host",
     .qdev.size      = sizeof(USBHostDevice),
     .init           = usb_host_initfn,
     .handle_packet  = usb_host_handle_packet,
@@ -1011,7 +1010,7 @@ USBDevice *usb_host_device_open(const char *devname)
     USBHostDevice *s;
     char *p;
 
-    dev = usb_create(NULL /* FIXME */, "USB Host Device");
+    dev = usb_create(NULL /* FIXME */, "usb-host");
     s = DO_UPCAST(USBHostDevice, dev, dev);
 
     if (strstr(devname, "auto:")) {
-- 
1.6.2.5

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [FOR 0.12 PATCH v2 0/3] Replace device names containing whitespace
  2009-12-09 16:07 [Qemu-devel] [FOR 0.12 PATCH v2 0/3] Replace device names containing whitespace Markus Armbruster
                   ` (2 preceding siblings ...)
  2009-12-09 16:07 ` [Qemu-devel] [FOR 0.12 PATCH v2 3/3] qdev: Replace device names containing whitespace Markus Armbruster
@ 2009-12-09 16:35 ` Gerd Hoffmann
  3 siblings, 0 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2009-12-09 16:35 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: qemu-devel

   Hi,

> * usb_qdev_init() copies the qdev name to USBDevice devname.  Gets
>    overwritten for usb-host devices, but not for the others.  This is
>    what Gerd pointed out.  I fixed it just like Gerd recommended.

Looks good now.  Ack to the whole series.

cheers,
   Gerd

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-12-09 16:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-09 16:07 [Qemu-devel] [FOR 0.12 PATCH v2 0/3] Replace device names containing whitespace Markus Armbruster
2009-12-09 16:07 ` [Qemu-devel] [FOR 0.12 PATCH v2 1/3] qdev: Rename USBDevice member devname to product_desc Markus Armbruster
2009-12-09 16:07 ` [Qemu-devel] [FOR 0.12 PATCH v2 2/3] qdev: Separate USB product description from qdev name Markus Armbruster
2009-12-09 16:07 ` [Qemu-devel] [FOR 0.12 PATCH v2 3/3] qdev: Replace device names containing whitespace Markus Armbruster
2009-12-09 16:35 ` [Qemu-devel] [FOR 0.12 PATCH v2 0/3] " Gerd Hoffmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).