uio_hv_generic: Query the ringbuffer size for device
[linux-2.6-block.git] / drivers / uio / uio_hv_generic.c
index 20d9762331bd767aa88c7b04d3f4c2e84ff72648..4bda6b52e49ea28b57efed9e785fa7228dd528f6 100644 (file)
@@ -238,6 +238,7 @@ hv_uio_probe(struct hv_device *dev,
        struct hv_uio_private_data *pdata;
        void *ring_buffer;
        int ret;
+       size_t ring_size = hv_dev_ring_size(channel);
 
        /* Communicating with host has to be via shared memory not hypercall */
        if (!channel->offermsg.monitor_allocated) {
@@ -245,12 +246,14 @@ hv_uio_probe(struct hv_device *dev,
                return -ENOTSUPP;
        }
 
+       if (!ring_size)
+               ring_size = HV_RING_SIZE * PAGE_SIZE;
+
        pdata = devm_kzalloc(&dev->device, sizeof(*pdata), GFP_KERNEL);
        if (!pdata)
                return -ENOMEM;
 
-       ret = vmbus_alloc_ring(channel, HV_RING_SIZE * PAGE_SIZE,
-                              HV_RING_SIZE * PAGE_SIZE);
+       ret = vmbus_alloc_ring(channel, ring_size, ring_size);
        if (ret)
                return ret;