Commit 6cbf507f authored by Jason Gunthorpe's avatar Jason Gunthorpe Committed by Alex Williamson

vfio/mdev: Fix missing static's on MDEV_TYPE_ATTR's

These should always be prefixed with static, otherwise compilation
will fail on non-modular builds with

ld: samples/vfio-mdev/mbochs.o:(.data+0x2e0): multiple definition of `mdev_type_attr_name'; samples/vfio-mdev/mdpy.o:(.data+0x240): first defined here

Fixes: a5e6e650 ("sample: vfio bochs vbe display (host device for bochs-drm)")
Fixes: d61fc96f ("sample: vfio mdev display - host device")
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Message-Id: <1-v2-d36939638fc6+d54-vfio2_jgg@nvidia.com>
Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
parent 6a2a235a
...@@ -1334,7 +1334,7 @@ static const struct attribute_group mdev_dev_group = { ...@@ -1334,7 +1334,7 @@ static const struct attribute_group mdev_dev_group = {
.attrs = mdev_dev_attrs, .attrs = mdev_dev_attrs,
}; };
const struct attribute_group *mdev_dev_groups[] = { static const struct attribute_group *mdev_dev_groups[] = {
&mdev_dev_group, &mdev_dev_group,
NULL, NULL,
}; };
...@@ -1344,7 +1344,7 @@ name_show(struct kobject *kobj, struct device *dev, char *buf) ...@@ -1344,7 +1344,7 @@ name_show(struct kobject *kobj, struct device *dev, char *buf)
{ {
return sprintf(buf, "%s\n", kobj->name); return sprintf(buf, "%s\n", kobj->name);
} }
MDEV_TYPE_ATTR_RO(name); static MDEV_TYPE_ATTR_RO(name);
static ssize_t static ssize_t
description_show(struct kobject *kobj, struct device *dev, char *buf) description_show(struct kobject *kobj, struct device *dev, char *buf)
...@@ -1354,7 +1354,7 @@ description_show(struct kobject *kobj, struct device *dev, char *buf) ...@@ -1354,7 +1354,7 @@ description_show(struct kobject *kobj, struct device *dev, char *buf)
return sprintf(buf, "virtual display, %d MB video memory\n", return sprintf(buf, "virtual display, %d MB video memory\n",
type ? type->mbytes : 0); type ? type->mbytes : 0);
} }
MDEV_TYPE_ATTR_RO(description); static MDEV_TYPE_ATTR_RO(description);
static ssize_t static ssize_t
available_instances_show(struct kobject *kobj, struct device *dev, char *buf) available_instances_show(struct kobject *kobj, struct device *dev, char *buf)
...@@ -1364,14 +1364,14 @@ available_instances_show(struct kobject *kobj, struct device *dev, char *buf) ...@@ -1364,14 +1364,14 @@ available_instances_show(struct kobject *kobj, struct device *dev, char *buf)
return sprintf(buf, "%d\n", count); return sprintf(buf, "%d\n", count);
} }
MDEV_TYPE_ATTR_RO(available_instances); static MDEV_TYPE_ATTR_RO(available_instances);
static ssize_t device_api_show(struct kobject *kobj, struct device *dev, static ssize_t device_api_show(struct kobject *kobj, struct device *dev,
char *buf) char *buf)
{ {
return sprintf(buf, "%s\n", VFIO_DEVICE_API_PCI_STRING); return sprintf(buf, "%s\n", VFIO_DEVICE_API_PCI_STRING);
} }
MDEV_TYPE_ATTR_RO(device_api); static MDEV_TYPE_ATTR_RO(device_api);
static struct attribute *mdev_types_attrs[] = { static struct attribute *mdev_types_attrs[] = {
&mdev_type_attr_name.attr, &mdev_type_attr_name.attr,
......
...@@ -658,7 +658,7 @@ static const struct attribute_group mdev_dev_group = { ...@@ -658,7 +658,7 @@ static const struct attribute_group mdev_dev_group = {
.attrs = mdev_dev_attrs, .attrs = mdev_dev_attrs,
}; };
const struct attribute_group *mdev_dev_groups[] = { static const struct attribute_group *mdev_dev_groups[] = {
&mdev_dev_group, &mdev_dev_group,
NULL, NULL,
}; };
...@@ -668,7 +668,7 @@ name_show(struct kobject *kobj, struct device *dev, char *buf) ...@@ -668,7 +668,7 @@ name_show(struct kobject *kobj, struct device *dev, char *buf)
{ {
return sprintf(buf, "%s\n", kobj->name); return sprintf(buf, "%s\n", kobj->name);
} }
MDEV_TYPE_ATTR_RO(name); static MDEV_TYPE_ATTR_RO(name);
static ssize_t static ssize_t
description_show(struct kobject *kobj, struct device *dev, char *buf) description_show(struct kobject *kobj, struct device *dev, char *buf)
...@@ -679,21 +679,21 @@ description_show(struct kobject *kobj, struct device *dev, char *buf) ...@@ -679,21 +679,21 @@ description_show(struct kobject *kobj, struct device *dev, char *buf)
type ? type->width : 0, type ? type->width : 0,
type ? type->height : 0); type ? type->height : 0);
} }
MDEV_TYPE_ATTR_RO(description); static MDEV_TYPE_ATTR_RO(description);
static ssize_t static ssize_t
available_instances_show(struct kobject *kobj, struct device *dev, char *buf) available_instances_show(struct kobject *kobj, struct device *dev, char *buf)
{ {
return sprintf(buf, "%d\n", max_devices - mdpy_count); return sprintf(buf, "%d\n", max_devices - mdpy_count);
} }
MDEV_TYPE_ATTR_RO(available_instances); static MDEV_TYPE_ATTR_RO(available_instances);
static ssize_t device_api_show(struct kobject *kobj, struct device *dev, static ssize_t device_api_show(struct kobject *kobj, struct device *dev,
char *buf) char *buf)
{ {
return sprintf(buf, "%s\n", VFIO_DEVICE_API_PCI_STRING); return sprintf(buf, "%s\n", VFIO_DEVICE_API_PCI_STRING);
} }
MDEV_TYPE_ATTR_RO(device_api); static MDEV_TYPE_ATTR_RO(device_api);
static struct attribute *mdev_types_attrs[] = { static struct attribute *mdev_types_attrs[] = {
&mdev_type_attr_name.attr, &mdev_type_attr_name.attr,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment