Skip to contentSkip to conversation

PCI: consolidate interface for adding devices

PATCH New Jan Beulich 1 participant 1 message Jul 19, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI: consolidate interface for adding devices

The functionality of pci_add_device_ext() can be easily folded into pci_add_device(), and eliminates the need to change two functions for future adjustments.

xen/arch/ia64/xen/hypercall.c +6 -6
@@ -665,8 +665,8 @@ long do_physdev_op(int cmd, XEN_GUEST_HA
         if ( copy_from_guest(&manage_pci, arg, 1) != 0 )
             break;
 
-        ret = pci_add_device(manage_pci.bus, manage_pci.devfn);
-            break;
+        ret = pci_add_device(manage_pci.bus, manage_pci.devfn, NULL);
+        break;
     }
 
     case PHYSDEVOP_manage_pci_remove: {
@@ -698,10 +698,10 @@ long do_physdev_op(int cmd, XEN_GUEST_HA
         pdev_info.is_virtfn = manage_pci_ext.is_virtfn;
         pdev_info.physfn.bus = manage_pci_ext.physfn.bus;
         pdev_info.physfn.devfn = manage_pci_ext.physfn.devfn;
-        ret = pci_add_device_ext(manage_pci_ext.bus,
-                                 manage_pci_ext.devfn,
-                                 &pdev_info);
-            break;
+        ret = pci_add_device(manage_pci_ext.bus,
+                             manage_pci_ext.devfn,
+                             &pdev_info);
+        break;
     }
 
     default:
xen/arch/x86/physdev.c +4 -4
@@ -483,7 +483,7 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_H
         if ( copy_from_guest(&manage_pci, arg, 1) != 0 )
             break;
 
-        ret = pci_add_device(manage_pci.bus, manage_pci.devfn);
+        ret = pci_add_device(manage_pci.bus, manage_pci.devfn, NULL);
         break;
     }
 
@@ -520,9 +520,9 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_H
         pdev_info.is_virtfn = manage_pci_ext.is_virtfn;
         pdev_info.physfn.bus = manage_pci_ext.physfn.bus;
         pdev_info.physfn.devfn = manage_pci_ext.physfn.devfn;
-        ret = pci_add_device_ext(manage_pci_ext.bus,
-                                 manage_pci_ext.devfn,
-                                 &pdev_info);
+        ret = pci_add_device(manage_pci_ext.bus,
+                             manage_pci_ext.devfn,
+                             &pdev_info);
         break;
     }
 
xen/drivers/passthrough/pci.c +16 -48

91 lines not on this page · raw message

xen/include/xen/pci.h +1 -2
@@ -86,9 +86,8 @@ struct pci_dev *pci_lock_pdev(int bus, i
 struct pci_dev *pci_lock_domain_pdev(struct domain *d, int bus, int devfn);
 
 void pci_release_devices(struct domain *d);
-int pci_add_device(u8 bus, u8 devfn);
+int pci_add_device(u8 bus, u8 devfn, const struct pci_dev_info *);
 int pci_remove_device(u8 bus, u8 devfn);
-int pci_add_device_ext(u8 bus, u8 devfn, struct pci_dev_info *info);
 struct pci_dev *pci_get_pdev(int bus, int devfn);
 struct pci_dev *pci_get_pdev_by_domain(struct domain *d, int bus, int devfn);
 

The functionality of pci_add_device_ext() can be easily folded into pci_add_device(), and eliminates the need to change two functions for future adjustments.

xen/arch/ia64/xen/hypercall.c +6 -6
@@ -665,8 +665,8 @@ long do_physdev_op(int cmd, XEN_GUEST_HA
         if ( copy_from_guest(&manage_pci, arg, 1) != 0 )
             break;
 
-        ret = pci_add_device(manage_pci.bus, manage_pci.devfn);
-            break;
+        ret = pci_add_device(manage_pci.bus, manage_pci.devfn, NULL);
+        break;
     }
 
     case PHYSDEVOP_manage_pci_remove: {
@@ -698,10 +698,10 @@ long do_physdev_op(int cmd, XEN_GUEST_HA
         pdev_info.is_virtfn = manage_pci_ext.is_virtfn;
         pdev_info.physfn.bus = manage_pci_ext.physfn.bus;
         pdev_info.physfn.devfn = manage_pci_ext.physfn.devfn;
-        ret = pci_add_device_ext(manage_pci_ext.bus,
-                                 manage_pci_ext.devfn,
-                                 &pdev_info);
-            break;
+        ret = pci_add_device(manage_pci_ext.bus,
+                             manage_pci_ext.devfn,
+                             &pdev_info);
+        break;
     }
 
     default:
xen/arch/x86/physdev.c +4 -4
@@ -483,7 +483,7 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_H
         if ( copy_from_guest(&manage_pci, arg, 1) != 0 )
             break;
 
-        ret = pci_add_device(manage_pci.bus, manage_pci.devfn);
+        ret = pci_add_device(manage_pci.bus, manage_pci.devfn, NULL);
         break;
     }
 
@@ -520,9 +520,9 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_H
         pdev_info.is_virtfn = manage_pci_ext.is_virtfn;
         pdev_info.physfn.bus = manage_pci_ext.physfn.bus;
         pdev_info.physfn.devfn = manage_pci_ext.physfn.devfn;
-        ret = pci_add_device_ext(manage_pci_ext.bus,
-                                 manage_pci_ext.devfn,
-                                 &pdev_info);
+        ret = pci_add_device(manage_pci_ext.bus,
+                             manage_pci_ext.devfn,
+                             &pdev_info);
         break;
     }
 
xen/drivers/passthrough/pci.c +16 -48

91 lines not on this page · raw message

xen/include/xen/pci.h +1 -2
@@ -86,9 +86,8 @@ struct pci_dev *pci_lock_pdev(int bus, i
 struct pci_dev *pci_lock_domain_pdev(struct domain *d, int bus, int devfn);
 
 void pci_release_devices(struct domain *d);
-int pci_add_device(u8 bus, u8 devfn);
+int pci_add_device(u8 bus, u8 devfn, const struct pci_dev_info *);
 int pci_remove_device(u8 bus, u8 devfn);
-int pci_add_device_ext(u8 bus, u8 devfn, struct pci_dev_info *info);
 struct pci_dev *pci_get_pdev(int bus, int devfn);
 struct pci_dev *pci_get_pdev_by_domain(struct domain *d, int bus, int devfn);
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel