static DEVICE_ATTR_RO(host_version);
 static DEVICE_ATTR_RO(host_features);
 
+static struct attribute *vbg_pci_attrs[] = {
+       &dev_attr_host_version.attr,
+       &dev_attr_host_features.attr,
+       NULL,
+};
+ATTRIBUTE_GROUPS(vbg_pci);
+
 /**
  * Does the PCI detection and init of the device.
  *
        }
 
        pci_set_drvdata(pci, gdev);
-       device_create_file(dev, &dev_attr_host_version);
-       device_create_file(dev, &dev_attr_host_features);
 
        vbg_info("vboxguest: misc device minor %d, IRQ %d, I/O port %x, MMIO at %pap (size %pap)\n",
                 gdev->misc_device.minor, pci->irq, gdev->io_port,
        mutex_unlock(&vbg_gdev_mutex);
 
        free_irq(pci->irq, gdev);
-       device_remove_file(gdev->dev, &dev_attr_host_features);
-       device_remove_file(gdev->dev, &dev_attr_host_version);
        misc_deregister(&gdev->misc_device_user);
        misc_deregister(&gdev->misc_device);
        vbg_core_exit(gdev);
 
 static struct pci_driver vbg_pci_driver = {
        .name           = DEVICE_NAME,
+       .dev_groups     = vbg_pci_groups,
        .id_table       = vbg_pci_ids,
        .probe          = vbg_pci_probe,
        .remove         = vbg_pci_remove,