aboutsummaryrefslogtreecommitdiff
path: root/drivers/uio
diff options
context:
space:
mode:
authorSaurabh Sengar2024-03-30 01:52:03 -0700
committerGreg Kroah-Hartman2024-04-11 14:55:53 +0200
commit76457f9a11dd1521efeb553526d350100e1ef422 (patch)
treeffb2673c12db02529905113846d95d6cdc70ce87 /drivers/uio
parentec314f61e4fc2d3dd6ea78aa18a5ac276eb1a8e3 (diff)
uio_hv_generic: Remove use of PAGE_SIZE
Remove use of PAGE_SIZE for device ring buffer size calculation, as there is no dependency on device ring buffer size for linux kernel's PAGE_SIZE. Use the absolute value of 2 MB instead. Signed-off-by: Saurabh Sengar <ssengar@linux.microsoft.com> Reviewed-by: Long Li <longli@microsoft.com> Link: https://lore.kernel.org/r/1711788723-8593-8-git-send-email-ssengar@linux.microsoft.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/uio')
-rw-r--r--drivers/uio/uio_hv_generic.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/uio/uio_hv_generic.c b/drivers/uio/uio_hv_generic.c
index 289611c7dfd7..015ddbddd6e1 100644
--- a/drivers/uio/uio_hv_generic.c
+++ b/drivers/uio/uio_hv_generic.c
@@ -36,7 +36,6 @@
#define DRIVER_AUTHOR "Stephen Hemminger <sthemmin at microsoft.com>"
#define DRIVER_DESC "Generic UIO driver for VMBus devices"
-#define HV_RING_SIZE 512 /* pages */
#define SEND_BUFFER_SIZE (16 * 1024 * 1024)
#define RECV_BUFFER_SIZE (31 * 1024 * 1024)
@@ -146,7 +145,7 @@ static const struct bin_attribute ring_buffer_bin_attr = {
.name = "ring",
.mode = 0600,
},
- .size = 2 * HV_RING_SIZE * PAGE_SIZE,
+ .size = 2 * SZ_2M,
.mmap = hv_uio_ring_mmap,
};
@@ -156,7 +155,7 @@ hv_uio_new_channel(struct vmbus_channel *new_sc)
{
struct hv_device *hv_dev = new_sc->primary_channel->device_obj;
struct device *device = &hv_dev->device;
- const size_t ring_bytes = HV_RING_SIZE * PAGE_SIZE;
+ const size_t ring_bytes = SZ_2M;
int ret;
/* Create host communication ring */
@@ -244,7 +243,7 @@ hv_uio_probe(struct hv_device *dev,
size_t ring_size = hv_dev_ring_size(channel);
if (!ring_size)
- ring_size = HV_RING_SIZE * PAGE_SIZE;
+ ring_size = SZ_2M;
pdata = devm_kzalloc(&dev->device, sizeof(*pdata), GFP_KERNEL);
if (!pdata)