aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/xen/xen-pciback/pci_stub.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/xen/xen-pciback/pci_stub.c')
-rw-r--r--drivers/xen/xen-pciback/pci_stub.c35
1 files changed, 15 insertions, 20 deletions
diff --git a/drivers/xen/xen-pciback/pci_stub.c b/drivers/xen/xen-pciback/pci_stub.c
index aec214ac0a14..8f06e1ed028c 100644
--- a/drivers/xen/xen-pciback/pci_stub.c
+++ b/drivers/xen/xen-pciback/pci_stub.c
@@ -21,8 +21,6 @@
21#include "conf_space.h" 21#include "conf_space.h"
22#include "conf_space_quirks.h" 22#include "conf_space_quirks.h"
23 23
24#define DRV_NAME "xen-pciback"
25
26static char *pci_devs_to_hide; 24static char *pci_devs_to_hide;
27wait_queue_head_t xen_pcibk_aer_wait_queue; 25wait_queue_head_t xen_pcibk_aer_wait_queue;
28/*Add sem for sync AER handling and xen_pcibk remove/reconfigue ops, 26/*Add sem for sync AER handling and xen_pcibk remove/reconfigue ops,
@@ -222,6 +220,8 @@ void pcistub_put_pci_dev(struct pci_dev *dev)
222 } 220 }
223 221
224 spin_unlock_irqrestore(&pcistub_devices_lock, flags); 222 spin_unlock_irqrestore(&pcistub_devices_lock, flags);
223 if (WARN_ON(!found_psdev))
224 return;
225 225
226 /*hold this lock for avoiding breaking link between 226 /*hold this lock for avoiding breaking link between
227 * pcistub and xen_pcibk when AER is in processing 227 * pcistub and xen_pcibk when AER is in processing
@@ -514,12 +514,9 @@ static void kill_domain_by_device(struct pcistub_device *psdev)
514 int err; 514 int err;
515 char nodename[PCI_NODENAME_MAX]; 515 char nodename[PCI_NODENAME_MAX];
516 516
517 if (!psdev) 517 BUG_ON(!psdev);
518 dev_err(&psdev->dev->dev,
519 "device is NULL when do AER recovery/kill_domain\n");
520 snprintf(nodename, PCI_NODENAME_MAX, "/local/domain/0/backend/pci/%d/0", 518 snprintf(nodename, PCI_NODENAME_MAX, "/local/domain/0/backend/pci/%d/0",
521 psdev->pdev->xdev->otherend_id); 519 psdev->pdev->xdev->otherend_id);
522 nodename[strlen(nodename)] = '\0';
523 520
524again: 521again:
525 err = xenbus_transaction_start(&xbt); 522 err = xenbus_transaction_start(&xbt);
@@ -605,7 +602,7 @@ static pci_ers_result_t common_process(struct pcistub_device *psdev,
605 if (test_bit(_XEN_PCIF_active, 602 if (test_bit(_XEN_PCIF_active,
606 (unsigned long *)&psdev->pdev->sh_info->flags)) { 603 (unsigned long *)&psdev->pdev->sh_info->flags)) {
607 dev_dbg(&psdev->dev->dev, 604 dev_dbg(&psdev->dev->dev,
608 "schedule pci_conf service in xen_pcibk\n"); 605 "schedule pci_conf service in " DRV_NAME "\n");
609 xen_pcibk_test_and_schedule_op(psdev->pdev); 606 xen_pcibk_test_and_schedule_op(psdev->pdev);
610 } 607 }
611 608
@@ -995,8 +992,7 @@ out:
995 err = count; 992 err = count;
996 return err; 993 return err;
997} 994}
998 995static DRIVER_ATTR(new_slot, S_IWUSR, NULL, pcistub_slot_add);
999DRIVER_ATTR(new_slot, S_IWUSR, NULL, pcistub_slot_add);
1000 996
1001static ssize_t pcistub_slot_remove(struct device_driver *drv, const char *buf, 997static ssize_t pcistub_slot_remove(struct device_driver *drv, const char *buf,
1002 size_t count) 998 size_t count)
@@ -1015,8 +1011,7 @@ out:
1015 err = count; 1011 err = count;
1016 return err; 1012 return err;
1017} 1013}
1018 1014static DRIVER_ATTR(remove_slot, S_IWUSR, NULL, pcistub_slot_remove);
1019DRIVER_ATTR(remove_slot, S_IWUSR, NULL, pcistub_slot_remove);
1020 1015
1021static ssize_t pcistub_slot_show(struct device_driver *drv, char *buf) 1016static ssize_t pcistub_slot_show(struct device_driver *drv, char *buf)
1022{ 1017{
@@ -1039,8 +1034,7 @@ static ssize_t pcistub_slot_show(struct device_driver *drv, char *buf)
1039 1034
1040 return count; 1035 return count;
1041} 1036}
1042 1037static DRIVER_ATTR(slots, S_IRUSR, pcistub_slot_show, NULL);
1043DRIVER_ATTR(slots, S_IRUSR, pcistub_slot_show, NULL);
1044 1038
1045static ssize_t pcistub_irq_handler_show(struct device_driver *drv, char *buf) 1039static ssize_t pcistub_irq_handler_show(struct device_driver *drv, char *buf)
1046{ 1040{
@@ -1069,8 +1063,7 @@ static ssize_t pcistub_irq_handler_show(struct device_driver *drv, char *buf)
1069 spin_unlock_irqrestore(&pcistub_devices_lock, flags); 1063 spin_unlock_irqrestore(&pcistub_devices_lock, flags);
1070 return count; 1064 return count;
1071} 1065}
1072 1066static DRIVER_ATTR(irq_handlers, S_IRUSR, pcistub_irq_handler_show, NULL);
1073DRIVER_ATTR(irq_handlers, S_IRUSR, pcistub_irq_handler_show, NULL);
1074 1067
1075static ssize_t pcistub_irq_handler_switch(struct device_driver *drv, 1068static ssize_t pcistub_irq_handler_switch(struct device_driver *drv,
1076 const char *buf, 1069 const char *buf,
@@ -1106,7 +1099,8 @@ out:
1106 err = count; 1099 err = count;
1107 return err; 1100 return err;
1108} 1101}
1109DRIVER_ATTR(irq_handler_state, S_IWUSR, NULL, pcistub_irq_handler_switch); 1102static DRIVER_ATTR(irq_handler_state, S_IWUSR, NULL,
1103 pcistub_irq_handler_switch);
1110 1104
1111static ssize_t pcistub_quirk_add(struct device_driver *drv, const char *buf, 1105static ssize_t pcistub_quirk_add(struct device_driver *drv, const char *buf,
1112 size_t count) 1106 size_t count)
@@ -1170,8 +1164,8 @@ out:
1170 1164
1171 return count; 1165 return count;
1172} 1166}
1173 1167static DRIVER_ATTR(quirks, S_IRUSR | S_IWUSR, pcistub_quirk_show,
1174DRIVER_ATTR(quirks, S_IRUSR | S_IWUSR, pcistub_quirk_show, pcistub_quirk_add); 1168 pcistub_quirk_add);
1175 1169
1176static ssize_t permissive_add(struct device_driver *drv, const char *buf, 1170static ssize_t permissive_add(struct device_driver *drv, const char *buf,
1177 size_t count) 1171 size_t count)
@@ -1236,8 +1230,8 @@ static ssize_t permissive_show(struct device_driver *drv, char *buf)
1236 spin_unlock_irqrestore(&pcistub_devices_lock, flags); 1230 spin_unlock_irqrestore(&pcistub_devices_lock, flags);
1237 return count; 1231 return count;
1238} 1232}
1239 1233static DRIVER_ATTR(permissive, S_IRUSR | S_IWUSR, permissive_show,
1240DRIVER_ATTR(permissive, S_IRUSR | S_IWUSR, permissive_show, permissive_add); 1234 permissive_add);
1241 1235
1242static void pcistub_exit(void) 1236static void pcistub_exit(void)
1243{ 1237{
@@ -1374,3 +1368,4 @@ module_init(xen_pcibk_init);
1374module_exit(xen_pcibk_cleanup); 1368module_exit(xen_pcibk_cleanup);
1375 1369
1376MODULE_LICENSE("Dual BSD/GPL"); 1370MODULE_LICENSE("Dual BSD/GPL");
1371MODULE_ALIAS("xen-backend:pci");