virtio: convert bus code to use dev_groups
The dev_attrs field of struct bus_type is going away soon, dev_groups should be used instead. This converts the virtio bus code to use the correct field. Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: "Michael S. Tsirkin" <mst@redhat.com> Cc: <virtualization@lists.linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
5152a5098c
commit
3736dab6e5
1 changed files with 19 additions and 8 deletions
|
@ -13,18 +13,24 @@ static ssize_t device_show(struct device *_d,
|
|||
struct virtio_device *dev = dev_to_virtio(_d);
|
||||
return sprintf(buf, "0x%04x\n", dev->id.device);
|
||||
}
|
||||
static DEVICE_ATTR_RO(device);
|
||||
|
||||
static ssize_t vendor_show(struct device *_d,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct virtio_device *dev = dev_to_virtio(_d);
|
||||
return sprintf(buf, "0x%04x\n", dev->id.vendor);
|
||||
}
|
||||
static DEVICE_ATTR_RO(vendor);
|
||||
|
||||
static ssize_t status_show(struct device *_d,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct virtio_device *dev = dev_to_virtio(_d);
|
||||
return sprintf(buf, "0x%08x\n", dev->config->get_status(dev));
|
||||
}
|
||||
static DEVICE_ATTR_RO(status);
|
||||
|
||||
static ssize_t modalias_show(struct device *_d,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
|
@ -32,6 +38,8 @@ static ssize_t modalias_show(struct device *_d,
|
|||
return sprintf(buf, "virtio:d%08Xv%08X\n",
|
||||
dev->id.device, dev->id.vendor);
|
||||
}
|
||||
static DEVICE_ATTR_RO(modalias);
|
||||
|
||||
static ssize_t features_show(struct device *_d,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
|
@ -47,14 +55,17 @@ static ssize_t features_show(struct device *_d,
|
|||
len += sprintf(buf+len, "\n");
|
||||
return len;
|
||||
}
|
||||
static struct device_attribute virtio_dev_attrs[] = {
|
||||
__ATTR_RO(device),
|
||||
__ATTR_RO(vendor),
|
||||
__ATTR_RO(status),
|
||||
__ATTR_RO(modalias),
|
||||
__ATTR_RO(features),
|
||||
__ATTR_NULL
|
||||
static DEVICE_ATTR_RO(features);
|
||||
|
||||
static struct attribute *virtio_dev_attrs[] = {
|
||||
&dev_attr_device.attr,
|
||||
&dev_attr_vendor.attr,
|
||||
&dev_attr_status.attr,
|
||||
&dev_attr_modalias.attr,
|
||||
&dev_attr_features.attr,
|
||||
NULL,
|
||||
};
|
||||
ATTRIBUTE_GROUPS(virtio_dev);
|
||||
|
||||
static inline int virtio_id_match(const struct virtio_device *dev,
|
||||
const struct virtio_device_id *id)
|
||||
|
@ -165,7 +176,7 @@ static int virtio_dev_remove(struct device *_d)
|
|||
static struct bus_type virtio_bus = {
|
||||
.name = "virtio",
|
||||
.match = virtio_dev_match,
|
||||
.dev_attrs = virtio_dev_attrs,
|
||||
.dev_groups = virtio_dev_groups,
|
||||
.uevent = virtio_uevent,
|
||||
.probe = virtio_dev_probe,
|
||||
.remove = virtio_dev_remove,
|
||||
|
|
Loading…
Reference in a new issue