* [PATCH 1/2] virtio: Use bus_type probe and remove methods
@ 2008-06-13 12:46 Mark McLoughlin
2008-06-13 12:46 ` [PATCH 2/2] virtio: Complete feature negotation before updating status Mark McLoughlin
2008-06-14 4:02 ` [PATCH 1/2] virtio: Use bus_type probe and remove methods Rusty Russell
0 siblings, 2 replies; 4+ messages in thread
From: Mark McLoughlin @ 2008-06-13 12:46 UTC (permalink / raw)
To: Rusty Russell; +Cc: linux-kernel, virtualization, Mark McLoughlin
Hook up to the probe() and remove() methods in bus_type
rather than device_driver. The latter has been preferred
since 2.6.16.
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
---
drivers/virtio/virtio.c | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c
index 0f3c2bb..ab0aca7 100644
--- a/drivers/virtio/virtio.c
+++ b/drivers/virtio/virtio.c
@@ -71,13 +71,6 @@ static int virtio_uevent(struct device *_dv, struct kobj_uevent_env *env)
dev->id.device, dev->id.vendor);
}
-static struct bus_type virtio_bus = {
- .name = "virtio",
- .match = virtio_dev_match,
- .dev_attrs = virtio_dev_attrs,
- .uevent = virtio_uevent,
-};
-
static void add_status(struct virtio_device *dev, unsigned status)
{
dev->config->set_status(dev, dev->config->get_status(dev) | status);
@@ -147,13 +140,20 @@ static int virtio_dev_remove(struct device *_d)
return 0;
}
+static struct bus_type virtio_bus = {
+ .name = "virtio",
+ .match = virtio_dev_match,
+ .dev_attrs = virtio_dev_attrs,
+ .uevent = virtio_uevent,
+ .probe = virtio_dev_probe,
+ .remove = virtio_dev_remove,
+};
+
int register_virtio_driver(struct virtio_driver *driver)
{
/* Catch this early. */
BUG_ON(driver->feature_table_size && !driver->feature_table);
driver->driver.bus = &virtio_bus;
- driver->driver.probe = virtio_dev_probe;
- driver->driver.remove = virtio_dev_remove;
return driver_register(&driver->driver);
}
EXPORT_SYMBOL_GPL(register_virtio_driver);
--
1.5.4.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 2/2] virtio: Complete feature negotation before updating status
2008-06-13 12:46 [PATCH 1/2] virtio: Use bus_type probe and remove methods Mark McLoughlin
@ 2008-06-13 12:46 ` Mark McLoughlin
2008-06-14 4:13 ` Rusty Russell
2008-06-14 4:02 ` [PATCH 1/2] virtio: Use bus_type probe and remove methods Rusty Russell
1 sibling, 1 reply; 4+ messages in thread
From: Mark McLoughlin @ 2008-06-13 12:46 UTC (permalink / raw)
To: Rusty Russell; +Cc: linux-kernel, virtualization, Mark McLoughlin
lguest (in rusty's use-tun-ringfd patch) assumes that the
guest has updated its feature bits before setting its status
to VIRTIO_CONFIG_S_DRIVER_OK.
That's pretty reasonable, so let's make it so.
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
---
drivers/virtio/virtio.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c
index ab0aca7..fc85cba 100644
--- a/drivers/virtio/virtio.c
+++ b/drivers/virtio/virtio.c
@@ -117,9 +117,9 @@ static int virtio_dev_probe(struct device *_d)
if (err)
add_status(dev, VIRTIO_CONFIG_S_FAILED);
else {
- add_status(dev, VIRTIO_CONFIG_S_DRIVER_OK);
/* They should never have set feature bits beyond 32 */
dev->config->set_features(dev, dev->features[0]);
+ add_status(dev, VIRTIO_CONFIG_S_DRIVER_OK);
}
return err;
}
--
1.5.4.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH 1/2] virtio: Use bus_type probe and remove methods
2008-06-13 12:46 [PATCH 1/2] virtio: Use bus_type probe and remove methods Mark McLoughlin
2008-06-13 12:46 ` [PATCH 2/2] virtio: Complete feature negotation before updating status Mark McLoughlin
@ 2008-06-14 4:02 ` Rusty Russell
1 sibling, 0 replies; 4+ messages in thread
From: Rusty Russell @ 2008-06-14 4:02 UTC (permalink / raw)
To: Mark McLoughlin; +Cc: linux-kernel, virtualization
On Friday 13 June 2008 22:46:40 Mark McLoughlin wrote:
> Hook up to the probe() and remove() methods in bus_type
> rather than device_driver. The latter has been preferred
> since 2.6.16.
>
> Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Thanks, applied.
Cheers,
Rusty.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-06-14 4:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-13 12:46 [PATCH 1/2] virtio: Use bus_type probe and remove methods Mark McLoughlin
2008-06-13 12:46 ` [PATCH 2/2] virtio: Complete feature negotation before updating status Mark McLoughlin
2008-06-14 4:13 ` Rusty Russell
2008-06-14 4:02 ` [PATCH 1/2] virtio: Use bus_type probe and remove methods Rusty Russell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox