aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/lguest/lguest_device.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2008-07-27 11:25:57 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-07-27 11:25:57 -0400
commit50cb993ea6cd187bfed085cb3e0747066edeb02f (patch)
tree61edac62c6c5bc07c59e4369c50c6821ad77f2c0 /drivers/lguest/lguest_device.c
parent445c2714cf72817ab1ad3ca894c6d9b2047b3a3e (diff)
parent8be1a6d6c77ab4532e4476fdb8177030ef48b52c (diff)
Merge ../linux-2.6
Diffstat (limited to 'drivers/lguest/lguest_device.c')
-rw-r--r--drivers/lguest/lguest_device.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/lguest/lguest_device.c b/drivers/lguest/lguest_device.c
index 1a8de57289eb..37344aaee22f 100644
--- a/drivers/lguest/lguest_device.c
+++ b/drivers/lguest/lguest_device.c
@@ -98,16 +98,20 @@ static u32 lg_get_features(struct virtio_device *vdev)
98 return features; 98 return features;
99} 99}
100 100
101static void lg_set_features(struct virtio_device *vdev, u32 features) 101static void lg_finalize_features(struct virtio_device *vdev)
102{ 102{
103 unsigned int i; 103 unsigned int i, bits;
104 struct lguest_device_desc *desc = to_lgdev(vdev)->desc; 104 struct lguest_device_desc *desc = to_lgdev(vdev)->desc;
105 /* Second half of bitmap is features we accept. */ 105 /* Second half of bitmap is features we accept. */
106 u8 *out_features = lg_features(desc) + desc->feature_len; 106 u8 *out_features = lg_features(desc) + desc->feature_len;
107 107
108 /* Give virtio_ring a chance to accept features. */
109 vring_transport_features(vdev);
110
108 memset(out_features, 0, desc->feature_len); 111 memset(out_features, 0, desc->feature_len);
109 for (i = 0; i < min(desc->feature_len * 8, 32); i++) { 112 bits = min_t(unsigned, desc->feature_len, sizeof(vdev->features)) * 8;
110 if (features & (1 << i)) 113 for (i = 0; i < bits; i++) {
114 if (test_bit(i, vdev->features))
111 out_features[i / 8] |= (1 << (i % 8)); 115 out_features[i / 8] |= (1 << (i % 8));
112 } 116 }
113} 117}
@@ -297,7 +301,7 @@ static void lg_del_vq(struct virtqueue *vq)
297/* The ops structure which hooks everything together. */ 301/* The ops structure which hooks everything together. */
298static struct virtio_config_ops lguest_config_ops = { 302static struct virtio_config_ops lguest_config_ops = {
299 .get_features = lg_get_features, 303 .get_features = lg_get_features,
300 .set_features = lg_set_features, 304 .finalize_features = lg_finalize_features,
301 .get = lg_get, 305 .get = lg_get,
302 .set = lg_set, 306 .set = lg_set,
303 .get_status = lg_get_status, 307 .get_status = lg_get_status,