lkml.org 
[lkml]   [2019]   [May]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
Subject[PATCH 2/3] PCI: Move pci_[get|set]_resource_alignment_param() into their callers
Both the functions pci_get_resource_alignment_param() and
pci_set_resource_alignment_param() are now only called in one place:
resource_alignment_show() and resource_alignment_store() respectively.

There is no value in this extra set of functions so we move both into
their callers respectively.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
---
drivers/pci/pci.c | 30 ++++++++++--------------------
1 file changed, 10 insertions(+), 20 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index bd7cdcfeb094..3e71e161f18b 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -6081,39 +6081,29 @@ void pci_reassigndev_resource_alignment(struct pci_dev *dev)
}
}

-static ssize_t pci_set_resource_alignment_param(const char *buf, size_t count)
-{
- spin_lock(&resource_alignment_lock);
-
- kfree(resource_alignment_param);
- resource_alignment_param = kstrndup(buf, count, GFP_KERNEL);
-
- spin_unlock(&resource_alignment_lock);
-
- return resource_alignment_param ? count : -ENOMEM;
-}
-
-static ssize_t pci_get_resource_alignment_param(char *buf, size_t size)
+static ssize_t resource_alignment_show(struct bus_type *bus, char *buf)
{
size_t count = 0;

spin_lock(&resource_alignment_lock);
if (resource_alignment_param)
- count = snprintf(buf, size, "%s", resource_alignment_param);
+ count = snprintf(buf, PAGE_SIZE, "%s", resource_alignment_param);
spin_unlock(&resource_alignment_lock);

return count;
}

-static ssize_t resource_alignment_show(struct bus_type *bus, char *buf)
-{
- return pci_get_resource_alignment_param(buf, PAGE_SIZE);
-}
-
static ssize_t resource_alignment_store(struct bus_type *bus,
const char *buf, size_t count)
{
- return pci_set_resource_alignment_param(buf, count);
+ spin_lock(&resource_alignment_lock);
+
+ kfree(resource_alignment_param);
+ resource_alignment_param = kstrndup(buf, count, GFP_KERNEL);
+
+ spin_unlock(&resource_alignment_lock);
+
+ return resource_alignment_param ? count : -ENOMEM;
}

static BUS_ATTR_RW(resource_alignment);
--
2.20.1
\
 
 \ /
  Last update: 2019-05-24 22:16    [W:0.643 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site