summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorStephen Boyd <swboyd@chromium.org>2019-05-10 11:01:50 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-05-24 20:55:04 +0200
commitb4cdeb785ea482ebfe6f8d12242620edf4fbf11c (patch)
tree1768edb110d5e7b01fba0d007fb8b58046931c3d /drivers
parente07f100993c6d411c4886ba37b2047322e302917 (diff)
downloadlinux-b4cdeb785ea482ebfe6f8d12242620edf4fbf11c.tar.bz2
firmware: google: memconsole: Drop global func pointer
We can store this function pointer directly in the bin_attribute structure's private field. Do this to save one global pointer. Cc: Wei-Ning Huang <wnhuang@chromium.org> Cc: Julius Werner <jwerner@chromium.org> Cc: Brian Norris <briannorris@chromium.org> Cc: Samuel Holland <samuel@sholland.org> Cc: Guenter Roeck <groeck@chromium.org> Signed-off-by: Stephen Boyd <swboyd@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Samuel Holland <samuel@sholland.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/firmware/google/memconsole.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/firmware/google/memconsole.c b/drivers/firmware/google/memconsole.c
index 166f07c68c02..968135025e4f 100644
--- a/drivers/firmware/google/memconsole.c
+++ b/drivers/firmware/google/memconsole.c
@@ -22,14 +22,16 @@
#include "memconsole.h"
-static ssize_t (*memconsole_read_func)(char *, loff_t, size_t);
-
static ssize_t memconsole_read(struct file *filp, struct kobject *kobp,
struct bin_attribute *bin_attr, char *buf,
loff_t pos, size_t count)
{
+ ssize_t (*memconsole_read_func)(char *, loff_t, size_t);
+
+ memconsole_read_func = bin_attr->private;
if (WARN_ON_ONCE(!memconsole_read_func))
return -EIO;
+
return memconsole_read_func(buf, pos, count);
}
@@ -40,7 +42,7 @@ static struct bin_attribute memconsole_bin_attr = {
void memconsole_setup(ssize_t (*read_func)(char *, loff_t, size_t))
{
- memconsole_read_func = read_func;
+ memconsole_bin_attr.private = read_func;
}
EXPORT_SYMBOL(memconsole_setup);