Commit 122b7e33 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'char-misc-4.20-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc

Pull char/misc driver fixes from Greg KH:
 "Here are three tiny last-minute driver fixes for 4.20-rc8 that resolve
  some reported issues, and one MAINTAINERS file update.

  All of them are related to the hyper-v subsystem, it seems people are
  actually testing and using it now, which is nice to see :)

  The fixes are:
   - uio_hv_generic: fix for opening multiple times
   - Remove PCI dependancy on hyperv drivers
   - return proper error code for an unopened channel.

  And Sasha has signed up to help out with the hyperv maintainership.

  All of these have been in linux-next for a while with no reported
  issues"

* tag 'char-misc-4.20-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
  Drivers: hv: vmbus: Return -EINVAL for the sys files for unopened channels
  x86, hyperv: remove PCI dependency
  MAINTAINERS: Patch monkey for the Hyper-V code
  uio_hv_generic: set callbacks on open
parents bfd7bd5b 55449af1
...@@ -6906,8 +6906,10 @@ Hyper-V CORE AND DRIVERS ...@@ -6906,8 +6906,10 @@ Hyper-V CORE AND DRIVERS
M: "K. Y. Srinivasan" <kys@microsoft.com> M: "K. Y. Srinivasan" <kys@microsoft.com>
M: Haiyang Zhang <haiyangz@microsoft.com> M: Haiyang Zhang <haiyangz@microsoft.com>
M: Stephen Hemminger <sthemmin@microsoft.com> M: Stephen Hemminger <sthemmin@microsoft.com>
M: Sasha Levin <sashal@kernel.org>
T: git git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux.git
L: devel@linuxdriverproject.org L: devel@linuxdriverproject.org
S: Maintained S: Supported
F: Documentation/networking/netvsc.txt F: Documentation/networking/netvsc.txt
F: arch/x86/include/asm/mshyperv.h F: arch/x86/include/asm/mshyperv.h
F: arch/x86/include/asm/trace/hyperv.h F: arch/x86/include/asm/trace/hyperv.h
......
...@@ -4,7 +4,7 @@ menu "Microsoft Hyper-V guest support" ...@@ -4,7 +4,7 @@ menu "Microsoft Hyper-V guest support"
config HYPERV config HYPERV
tristate "Microsoft Hyper-V client drivers" tristate "Microsoft Hyper-V client drivers"
depends on X86 && ACPI && PCI && X86_LOCAL_APIC && HYPERVISOR_GUEST depends on X86 && ACPI && X86_LOCAL_APIC && HYPERVISOR_GUEST
select PARAVIRT select PARAVIRT
help help
Select this option to run Linux as a Hyper-V client operating Select this option to run Linux as a Hyper-V client operating
......
...@@ -316,6 +316,8 @@ static ssize_t out_intr_mask_show(struct device *dev, ...@@ -316,6 +316,8 @@ static ssize_t out_intr_mask_show(struct device *dev,
if (!hv_dev->channel) if (!hv_dev->channel)
return -ENODEV; return -ENODEV;
if (hv_dev->channel->state != CHANNEL_OPENED_STATE)
return -EINVAL;
hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, &outbound); hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, &outbound);
return sprintf(buf, "%d\n", outbound.current_interrupt_mask); return sprintf(buf, "%d\n", outbound.current_interrupt_mask);
} }
...@@ -329,6 +331,8 @@ static ssize_t out_read_index_show(struct device *dev, ...@@ -329,6 +331,8 @@ static ssize_t out_read_index_show(struct device *dev,
if (!hv_dev->channel) if (!hv_dev->channel)
return -ENODEV; return -ENODEV;
if (hv_dev->channel->state != CHANNEL_OPENED_STATE)
return -EINVAL;
hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, &outbound); hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, &outbound);
return sprintf(buf, "%d\n", outbound.current_read_index); return sprintf(buf, "%d\n", outbound.current_read_index);
} }
...@@ -343,6 +347,8 @@ static ssize_t out_write_index_show(struct device *dev, ...@@ -343,6 +347,8 @@ static ssize_t out_write_index_show(struct device *dev,
if (!hv_dev->channel) if (!hv_dev->channel)
return -ENODEV; return -ENODEV;
if (hv_dev->channel->state != CHANNEL_OPENED_STATE)
return -EINVAL;
hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, &outbound); hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, &outbound);
return sprintf(buf, "%d\n", outbound.current_write_index); return sprintf(buf, "%d\n", outbound.current_write_index);
} }
...@@ -357,6 +363,8 @@ static ssize_t out_read_bytes_avail_show(struct device *dev, ...@@ -357,6 +363,8 @@ static ssize_t out_read_bytes_avail_show(struct device *dev,
if (!hv_dev->channel) if (!hv_dev->channel)
return -ENODEV; return -ENODEV;
if (hv_dev->channel->state != CHANNEL_OPENED_STATE)
return -EINVAL;
hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, &outbound); hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, &outbound);
return sprintf(buf, "%d\n", outbound.bytes_avail_toread); return sprintf(buf, "%d\n", outbound.bytes_avail_toread);
} }
...@@ -371,6 +379,8 @@ static ssize_t out_write_bytes_avail_show(struct device *dev, ...@@ -371,6 +379,8 @@ static ssize_t out_write_bytes_avail_show(struct device *dev,
if (!hv_dev->channel) if (!hv_dev->channel)
return -ENODEV; return -ENODEV;
if (hv_dev->channel->state != CHANNEL_OPENED_STATE)
return -EINVAL;
hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, &outbound); hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, &outbound);
return sprintf(buf, "%d\n", outbound.bytes_avail_towrite); return sprintf(buf, "%d\n", outbound.bytes_avail_towrite);
} }
...@@ -384,6 +394,8 @@ static ssize_t in_intr_mask_show(struct device *dev, ...@@ -384,6 +394,8 @@ static ssize_t in_intr_mask_show(struct device *dev,
if (!hv_dev->channel) if (!hv_dev->channel)
return -ENODEV; return -ENODEV;
if (hv_dev->channel->state != CHANNEL_OPENED_STATE)
return -EINVAL;
hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound); hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound);
return sprintf(buf, "%d\n", inbound.current_interrupt_mask); return sprintf(buf, "%d\n", inbound.current_interrupt_mask);
} }
...@@ -397,6 +409,8 @@ static ssize_t in_read_index_show(struct device *dev, ...@@ -397,6 +409,8 @@ static ssize_t in_read_index_show(struct device *dev,
if (!hv_dev->channel) if (!hv_dev->channel)
return -ENODEV; return -ENODEV;
if (hv_dev->channel->state != CHANNEL_OPENED_STATE)
return -EINVAL;
hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound); hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound);
return sprintf(buf, "%d\n", inbound.current_read_index); return sprintf(buf, "%d\n", inbound.current_read_index);
} }
...@@ -410,6 +424,8 @@ static ssize_t in_write_index_show(struct device *dev, ...@@ -410,6 +424,8 @@ static ssize_t in_write_index_show(struct device *dev,
if (!hv_dev->channel) if (!hv_dev->channel)
return -ENODEV; return -ENODEV;
if (hv_dev->channel->state != CHANNEL_OPENED_STATE)
return -EINVAL;
hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound); hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound);
return sprintf(buf, "%d\n", inbound.current_write_index); return sprintf(buf, "%d\n", inbound.current_write_index);
} }
...@@ -424,6 +440,8 @@ static ssize_t in_read_bytes_avail_show(struct device *dev, ...@@ -424,6 +440,8 @@ static ssize_t in_read_bytes_avail_show(struct device *dev,
if (!hv_dev->channel) if (!hv_dev->channel)
return -ENODEV; return -ENODEV;
if (hv_dev->channel->state != CHANNEL_OPENED_STATE)
return -EINVAL;
hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound); hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound);
return sprintf(buf, "%d\n", inbound.bytes_avail_toread); return sprintf(buf, "%d\n", inbound.bytes_avail_toread);
} }
...@@ -438,6 +456,8 @@ static ssize_t in_write_bytes_avail_show(struct device *dev, ...@@ -438,6 +456,8 @@ static ssize_t in_write_bytes_avail_show(struct device *dev,
if (!hv_dev->channel) if (!hv_dev->channel)
return -ENODEV; return -ENODEV;
if (hv_dev->channel->state != CHANNEL_OPENED_STATE)
return -EINVAL;
hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound); hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound);
return sprintf(buf, "%d\n", inbound.bytes_avail_towrite); return sprintf(buf, "%d\n", inbound.bytes_avail_towrite);
} }
......
...@@ -204,9 +204,11 @@ hv_uio_open(struct uio_info *info, struct inode *inode) ...@@ -204,9 +204,11 @@ hv_uio_open(struct uio_info *info, struct inode *inode)
if (atomic_inc_return(&pdata->refcnt) != 1) if (atomic_inc_return(&pdata->refcnt) != 1)
return 0; return 0;
vmbus_set_chn_rescind_callback(dev->channel, hv_uio_rescind);
vmbus_set_sc_create_callback(dev->channel, hv_uio_new_channel);
ret = vmbus_connect_ring(dev->channel, ret = vmbus_connect_ring(dev->channel,
hv_uio_channel_cb, dev->channel); hv_uio_channel_cb, dev->channel);
if (ret == 0) if (ret == 0)
dev->channel->inbound.ring_buffer->interrupt_mask = 1; dev->channel->inbound.ring_buffer->interrupt_mask = 1;
else else
...@@ -334,9 +336,6 @@ hv_uio_probe(struct hv_device *dev, ...@@ -334,9 +336,6 @@ hv_uio_probe(struct hv_device *dev,
goto fail_close; goto fail_close;
} }
vmbus_set_chn_rescind_callback(channel, hv_uio_rescind);
vmbus_set_sc_create_callback(channel, hv_uio_new_channel);
ret = sysfs_create_bin_file(&channel->kobj, &ring_buffer_bin_attr); ret = sysfs_create_bin_file(&channel->kobj, &ring_buffer_bin_attr);
if (ret) if (ret)
dev_notice(&dev->device, dev_notice(&dev->device,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment