diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-09-13 14:32:50 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-09-26 12:01:15 -0400 |
commit | a8fb5f3d582d3b4997d9449ceb82a0223d169486 (patch) | |
tree | aafa9ae9904fd17a64518e3d605c372b166ddfb3 /drivers/hv | |
parent | 03f3a9107f5e848a42f25e3ab133db9f3b6546c7 (diff) |
hv: move "state" bus attribute to dev_groups
This moves the "state" bus attribute to the dev_groups structure,
removing the need for it to be in a temporary structure.
Tested-by: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hv')
-rw-r--r-- | drivers/hv/channel.c | 1 | ||||
-rw-r--r-- | drivers/hv/vmbus_drv.c | 17 |
2 files changed, 12 insertions, 6 deletions
diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c index b58a1785d038..64f19f226c4e 100644 --- a/drivers/hv/channel.c +++ b/drivers/hv/channel.c | |||
@@ -69,7 +69,6 @@ void vmbus_get_debug_info(struct vmbus_channel *channel, | |||
69 | u8 monitor_group = (u8)channel->offermsg.monitorid / 32; | 69 | u8 monitor_group = (u8)channel->offermsg.monitorid / 32; |
70 | u8 monitor_offset = (u8)channel->offermsg.monitorid % 32; | 70 | u8 monitor_offset = (u8)channel->offermsg.monitorid % 32; |
71 | 71 | ||
72 | debuginfo->state = channel->state; | ||
73 | memcpy(&debuginfo->interfacetype, | 72 | memcpy(&debuginfo->interfacetype, |
74 | &channel->offermsg.offer.if_type, sizeof(uuid_le)); | 73 | &channel->offermsg.offer.if_type, sizeof(uuid_le)); |
75 | memcpy(&debuginfo->interface_instance, | 74 | memcpy(&debuginfo->interface_instance, |
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index 5c21b22860af..1e5bc9c49c63 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c | |||
@@ -47,7 +47,6 @@ static struct completion probe_event; | |||
47 | static int irq; | 47 | static int irq; |
48 | 48 | ||
49 | struct hv_device_info { | 49 | struct hv_device_info { |
50 | u32 chn_state; | ||
51 | uuid_le chn_type; | 50 | uuid_le chn_type; |
52 | uuid_le chn_instance; | 51 | uuid_le chn_instance; |
53 | 52 | ||
@@ -82,7 +81,6 @@ static void get_channel_info(struct hv_device *device, | |||
82 | 81 | ||
83 | vmbus_get_debug_info(device->channel, &debug_info); | 82 | vmbus_get_debug_info(device->channel, &debug_info); |
84 | 83 | ||
85 | info->chn_state = debug_info.state; | ||
86 | memcpy(&info->chn_type, &debug_info.interfacetype, | 84 | memcpy(&info->chn_type, &debug_info.interfacetype, |
87 | sizeof(uuid_le)); | 85 | sizeof(uuid_le)); |
88 | memcpy(&info->chn_instance, &debug_info.interface_instance, | 86 | memcpy(&info->chn_instance, &debug_info.interface_instance, |
@@ -152,8 +150,6 @@ static ssize_t vmbus_show_device_attr(struct device *dev, | |||
152 | } else if (!strcmp(dev_attr->attr.name, "modalias")) { | 150 | } else if (!strcmp(dev_attr->attr.name, "modalias")) { |
153 | print_alias_name(hv_dev, alias_name); | 151 | print_alias_name(hv_dev, alias_name); |
154 | ret = sprintf(buf, "vmbus:%s\n", alias_name); | 152 | ret = sprintf(buf, "vmbus:%s\n", alias_name); |
155 | } else if (!strcmp(dev_attr->attr.name, "state")) { | ||
156 | ret = sprintf(buf, "%d\n", device_info->chn_state); | ||
157 | } else if (!strcmp(dev_attr->attr.name, "out_intr_mask")) { | 153 | } else if (!strcmp(dev_attr->attr.name, "out_intr_mask")) { |
158 | ret = sprintf(buf, "%d\n", device_info->outbound.int_mask); | 154 | ret = sprintf(buf, "%d\n", device_info->outbound.int_mask); |
159 | } else if (!strcmp(dev_attr->attr.name, "out_read_index")) { | 155 | } else if (!strcmp(dev_attr->attr.name, "out_read_index")) { |
@@ -211,15 +207,26 @@ static ssize_t id_show(struct device *dev, struct device_attribute *dev_attr, | |||
211 | } | 207 | } |
212 | static DEVICE_ATTR_RO(id); | 208 | static DEVICE_ATTR_RO(id); |
213 | 209 | ||
210 | static ssize_t state_show(struct device *dev, struct device_attribute *dev_attr, | ||
211 | char *buf) | ||
212 | { | ||
213 | struct hv_device *hv_dev = device_to_hv_device(dev); | ||
214 | |||
215 | if (!hv_dev->channel) | ||
216 | return -ENODEV; | ||
217 | return sprintf(buf, "%d\n", hv_dev->channel->state); | ||
218 | } | ||
219 | static DEVICE_ATTR_RO(state); | ||
220 | |||
214 | static struct attribute *vmbus_attrs[] = { | 221 | static struct attribute *vmbus_attrs[] = { |
215 | &dev_attr_id.attr, | 222 | &dev_attr_id.attr, |
223 | &dev_attr_state.attr, | ||
216 | NULL, | 224 | NULL, |
217 | }; | 225 | }; |
218 | ATTRIBUTE_GROUPS(vmbus); | 226 | ATTRIBUTE_GROUPS(vmbus); |
219 | 227 | ||
220 | /* Set up per device attributes in /sys/bus/vmbus/devices/<bus device> */ | 228 | /* Set up per device attributes in /sys/bus/vmbus/devices/<bus device> */ |
221 | static struct device_attribute vmbus_device_attrs[] = { | 229 | static struct device_attribute vmbus_device_attrs[] = { |
222 | __ATTR(state, S_IRUGO, vmbus_show_device_attr, NULL), | ||
223 | __ATTR(class_id, S_IRUGO, vmbus_show_device_attr, NULL), | 230 | __ATTR(class_id, S_IRUGO, vmbus_show_device_attr, NULL), |
224 | __ATTR(device_id, S_IRUGO, vmbus_show_device_attr, NULL), | 231 | __ATTR(device_id, S_IRUGO, vmbus_show_device_attr, NULL), |
225 | __ATTR(monitor_id, S_IRUGO, vmbus_show_device_attr, NULL), | 232 | __ATTR(monitor_id, S_IRUGO, vmbus_show_device_attr, NULL), |