|
@@ -58,8 +58,12 @@ static int pci_perf_show(struct seq_file *m, void *v)
|
|
|
|
|
|
if (!zdev)
|
|
|
return 0;
|
|
|
- if (!zdev->fmb)
|
|
|
+
|
|
|
+ mutex_lock(&zdev->lock);
|
|
|
+ if (!zdev->fmb) {
|
|
|
+ mutex_unlock(&zdev->lock);
|
|
|
return seq_printf(m, "FMB statistics disabled\n");
|
|
|
+ }
|
|
|
|
|
|
/* header */
|
|
|
seq_printf(m, "FMB @ %p\n", zdev->fmb);
|
|
@@ -78,6 +82,7 @@ static int pci_perf_show(struct seq_file *m, void *v)
|
|
|
pci_perf_names[i], *(stat + i));
|
|
|
|
|
|
pci_sw_counter_show(m);
|
|
|
+ mutex_unlock(&zdev->lock);
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -95,19 +100,17 @@ static ssize_t pci_perf_seq_write(struct file *file, const char __user *ubuf,
|
|
|
if (rc)
|
|
|
return rc;
|
|
|
|
|
|
+ mutex_lock(&zdev->lock);
|
|
|
switch (val) {
|
|
|
case 0:
|
|
|
rc = zpci_fmb_disable_device(zdev);
|
|
|
- if (rc)
|
|
|
- return rc;
|
|
|
break;
|
|
|
case 1:
|
|
|
rc = zpci_fmb_enable_device(zdev);
|
|
|
- if (rc)
|
|
|
- return rc;
|
|
|
break;
|
|
|
}
|
|
|
- return count;
|
|
|
+ mutex_unlock(&zdev->lock);
|
|
|
+ return rc ? rc : count;
|
|
|
}
|
|
|
|
|
|
static int pci_perf_seq_open(struct inode *inode, struct file *filp)
|