Skip to content

Commit b4cdeb7

Browse files
bebarinogregkh
authored andcommitted
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>
1 parent e07f100 commit b4cdeb7

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎drivers/firmware/google/memconsole.c‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,16 @@
2222

2323
#include "memconsole.h"
2424

25-
static ssize_t (*memconsole_read_func)(char *, loff_t, size_t);
26-
2725
static ssize_t memconsole_read(struct file *filp, struct kobject *kobp,
2826
struct bin_attribute *bin_attr, char *buf,
2927
loff_t pos, size_t count)
3028
{
29+
ssize_t (*memconsole_read_func)(char *, loff_t, size_t);
30+
31+
memconsole_read_func = bin_attr->private;
3132
if (WARN_ON_ONCE(!memconsole_read_func))
3233
return -EIO;
34+
3335
return memconsole_read_func(buf, pos, count);
3436
}
3537

@@ -40,7 +42,7 @@ static struct bin_attribute memconsole_bin_attr = {
4042

4143
void memconsole_setup(ssize_t (*read_func)(char *, loff_t, size_t))
4244
{
43-
memconsole_read_func = read_func;
45+
memconsole_bin_attr.private = read_func;
4446
}
4547
EXPORT_SYMBOL(memconsole_setup);
4648

0 commit comments

Comments
 (0)