diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2008-07-25 13:06:07 -0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2008-07-24 22:06:12 -0400 |
commit | c624896e488ba2bff5ae497782cfb265c8b00646 (patch) | |
tree | 714145903ff8c889e9544e8366b2ee2a62234c0c /drivers/lguest | |
parent | dd7c7bc46211785a1aa7d70feb15830f62682b3c (diff) |
virtio: Rename set_features to finalize_features
Rather than explicitly handing the features to the lower-level, we just
hand the virtio_device and have it set the features. This make it clear
that it has the chance to manipulate the features of the device at this
point (and that all feature negotiation is already done).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/lguest')
-rw-r--r-- | drivers/lguest/lguest_device.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/lguest/lguest_device.c b/drivers/lguest/lguest_device.c index 1a8de57289eb..54fdc2aa4806 100644 --- a/drivers/lguest/lguest_device.c +++ b/drivers/lguest/lguest_device.c | |||
@@ -98,16 +98,17 @@ static u32 lg_get_features(struct virtio_device *vdev) | |||
98 | return features; | 98 | return features; |
99 | } | 99 | } |
100 | 100 | ||
101 | static void lg_set_features(struct virtio_device *vdev, u32 features) | 101 | static 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 | memset(out_features, 0, desc->feature_len); | 108 | memset(out_features, 0, desc->feature_len); |
109 | for (i = 0; i < min(desc->feature_len * 8, 32); i++) { | 109 | bits = min_t(unsigned, desc->feature_len, sizeof(vdev->features)) * 8; |
110 | if (features & (1 << i)) | 110 | for (i = 0; i < bits; i++) { |
111 | if (test_bit(i, vdev->features)) | ||
111 | out_features[i / 8] |= (1 << (i % 8)); | 112 | out_features[i / 8] |= (1 << (i % 8)); |
112 | } | 113 | } |
113 | } | 114 | } |
@@ -297,7 +298,7 @@ static void lg_del_vq(struct virtqueue *vq) | |||
297 | /* The ops structure which hooks everything together. */ | 298 | /* The ops structure which hooks everything together. */ |
298 | static struct virtio_config_ops lguest_config_ops = { | 299 | static struct virtio_config_ops lguest_config_ops = { |
299 | .get_features = lg_get_features, | 300 | .get_features = lg_get_features, |
300 | .set_features = lg_set_features, | 301 | .finalize_features = lg_finalize_features, |
301 | .get = lg_get, | 302 | .get = lg_get, |
302 | .set = lg_set, | 303 | .set = lg_set, |
303 | .get_status = lg_get_status, | 304 | .get_status = lg_get_status, |