hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/firmware/google/memconsole.c
....@@ -1,35 +1,28 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * memconsole.c
34 *
45 * Architecture-independent parts of the memory based BIOS console.
56 *
67 * Copyright 2017 Google Inc.
7
- *
8
- * This program is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License v2.0 as published by
10
- * the Free Software Foundation.
11
- *
12
- * This program is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- * GNU General Public License for more details.
168 */
179
18
-#include <linux/init.h>
1910 #include <linux/sysfs.h>
2011 #include <linux/kobject.h>
2112 #include <linux/module.h>
2213
2314 #include "memconsole.h"
2415
25
-static ssize_t (*memconsole_read_func)(char *, loff_t, size_t);
26
-
2716 static ssize_t memconsole_read(struct file *filp, struct kobject *kobp,
2817 struct bin_attribute *bin_attr, char *buf,
2918 loff_t pos, size_t count)
3019 {
20
+ ssize_t (*memconsole_read_func)(char *, loff_t, size_t);
21
+
22
+ memconsole_read_func = bin_attr->private;
3123 if (WARN_ON_ONCE(!memconsole_read_func))
3224 return -EIO;
25
+
3326 return memconsole_read_func(buf, pos, count);
3427 }
3528
....@@ -40,7 +33,7 @@
4033
4134 void memconsole_setup(ssize_t (*read_func)(char *, loff_t, size_t))
4235 {
43
- memconsole_read_func = read_func;
36
+ memconsole_bin_attr.private = read_func;
4437 }
4538 EXPORT_SYMBOL(memconsole_setup);
4639