pvpanic-pci.c (33a430419456991480cde9d8889e5a27f6049df4) pvpanic-pci.c (84b0f12a953c4feff9994b1c4583ed18b441f482)
1// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Pvpanic PCI Device Support
4 *
5 * Copyright (C) 2021 Oracle.
6 */
7
8#include <linux/kernel.h>

--- 5 unchanged lines hidden (view full) ---

14#include <uapi/misc/pvpanic.h>
15
16#include "pvpanic.h"
17
18#define PCI_VENDOR_ID_REDHAT 0x1b36
19#define PCI_DEVICE_ID_REDHAT_PVPANIC 0x0011
20
21MODULE_AUTHOR("Mihai Carabas <mihai.carabas@oracle.com>");
1// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Pvpanic PCI Device Support
4 *
5 * Copyright (C) 2021 Oracle.
6 */
7
8#include <linux/kernel.h>

--- 5 unchanged lines hidden (view full) ---

14#include <uapi/misc/pvpanic.h>
15
16#include "pvpanic.h"
17
18#define PCI_VENDOR_ID_REDHAT 0x1b36
19#define PCI_DEVICE_ID_REDHAT_PVPANIC 0x0011
20
21MODULE_AUTHOR("Mihai Carabas <mihai.carabas@oracle.com>");
22MODULE_DESCRIPTION("pvpanic device driver ");
22MODULE_DESCRIPTION("pvpanic device driver");
23MODULE_LICENSE("GPL");
24
23MODULE_LICENSE("GPL");
24
25static ssize_t capability_show(struct device *dev,
26 struct device_attribute *attr, char *buf)
25static ssize_t capability_show(struct device *dev, struct device_attribute *attr, char *buf)
27{
28 struct pvpanic_instance *pi = dev_get_drvdata(dev);
29
30 return sysfs_emit(buf, "%x\n", pi->capability);
31}
32static DEVICE_ATTR_RO(capability);
33
26{
27 struct pvpanic_instance *pi = dev_get_drvdata(dev);
28
29 return sysfs_emit(buf, "%x\n", pi->capability);
30}
31static DEVICE_ATTR_RO(capability);
32
34static ssize_t events_show(struct device *dev, struct device_attribute *attr, char *buf)
33static ssize_t events_show(struct device *dev, struct device_attribute *attr, char *buf)
35{
36 struct pvpanic_instance *pi = dev_get_drvdata(dev);
37
38 return sysfs_emit(buf, "%x\n", pi->events);
39}
40
34{
35 struct pvpanic_instance *pi = dev_get_drvdata(dev);
36
37 return sysfs_emit(buf, "%x\n", pi->events);
38}
39
41static ssize_t events_store(struct device *dev, struct device_attribute *attr,
40static ssize_t events_store(struct device *dev, struct device_attribute *attr,
42 const char *buf, size_t count)
43{
44 struct pvpanic_instance *pi = dev_get_drvdata(dev);
45 unsigned int tmp;
46 int err;
47
48 err = kstrtouint(buf, 16, &tmp);
49 if (err)

--- 10 unchanged lines hidden (view full) ---

60
61static struct attribute *pvpanic_pci_dev_attrs[] = {
62 &dev_attr_capability.attr,
63 &dev_attr_events.attr,
64 NULL
65};
66ATTRIBUTE_GROUPS(pvpanic_pci_dev);
67
41 const char *buf, size_t count)
42{
43 struct pvpanic_instance *pi = dev_get_drvdata(dev);
44 unsigned int tmp;
45 int err;
46
47 err = kstrtouint(buf, 16, &tmp);
48 if (err)

--- 10 unchanged lines hidden (view full) ---

59
60static struct attribute *pvpanic_pci_dev_attrs[] = {
61 &dev_attr_capability.attr,
62 &dev_attr_events.attr,
63 NULL
64};
65ATTRIBUTE_GROUPS(pvpanic_pci_dev);
66
68static int pvpanic_pci_probe(struct pci_dev *pdev,
69 const struct pci_device_id *ent)
67static int pvpanic_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
70{
71 struct pvpanic_instance *pi;
72 void __iomem *base;
73 int ret;
74
75 ret = pcim_enable_device(pdev);
76 if (ret < 0)
77 return ret;

--- 34 unchanged lines hidden ---
68{
69 struct pvpanic_instance *pi;
70 void __iomem *base;
71 int ret;
72
73 ret = pcim_enable_device(pdev);
74 if (ret < 0)
75 return ret;

--- 34 unchanged lines hidden ---