linux/drivers/firmware/google
Duncan Laurie 655603de68 gsmi: Fix bug in append_to_eventlog sysfs handler
The sysfs handler should return the number of bytes consumed, which in the
case of a successful write is the entire buffer.  Also fix a bug where
param.data_len was being set to (count - (2 * sizeof(u32))) instead of just
(count - sizeof(u32)).  The latter is correct because we skip over the
leading u32 which is our param.type, but we were also incorrectly
subtracting sizeof(u32) on the line where we were actually setting
param.data_len:

	param.data_len = count - sizeof(u32);

This meant that for our example event.kernel_software_watchdog with total
length 10 bytes, param.data_len was just 2 prior to this change.

To test, successfully append an event to the log with gsmi sysfs.
This sample event is for a "Kernel Software Watchdog"

> xxd -g 1 event.kernel_software_watchdog
0000000: 01 00 00 00 ad de 06 00 00 00

> cat event.kernel_software_watchdog > /sys/firmware/gsmi/append_to_eventlog

> mosys eventlog list | tail -1
14 | 2012-06-25 10:14:14 | Kernl Event | Software Watchdog

Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
Signed-off-by: Furquan Shaikh <furquan@google.com>
Tested-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Justin TerAvest <teravest@chromium.org>
[zwisler: updated changelog for 2nd bug fix and upstream]
Signed-off-by: Ross Zwisler <zwisler@google.com>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-15 20:32:26 +02:00
..
coreboot_table.c firmware: coreboot: Only populate devices in coreboot_table_init() 2018-09-14 15:37:23 +02:00
coreboot_table.h firmware: coreboot: Collapse platform drivers into bus core 2018-09-14 15:37:23 +02:00
framebuffer-coreboot.c firmware: coreboot: Add coreboot framebuffer driver 2018-04-23 13:37:19 +02:00
gsmi.c gsmi: Fix bug in append_to_eventlog sysfs handler 2018-10-15 20:32:26 +02:00
Kconfig firmware: coreboot: Collapse platform drivers into bus core 2018-09-14 15:37:23 +02:00
Makefile firmware: coreboot: Collapse platform drivers into bus core 2018-09-14 15:37:23 +02:00
memconsole-coreboot.c firmware: memconsole: Probe via coreboot bus 2018-04-23 13:37:19 +02:00
memconsole-x86-legacy.c dmi: Mark all struct dmi_system_id instances const 2017-09-14 11:59:30 +02:00
memconsole.c firmware: google: memconsole: Make memconsole interface more flexible 2017-05-18 16:59:06 +02:00
memconsole.h firmware: google: memconsole: Make memconsole interface more flexible 2017-05-18 16:59:06 +02:00
vpd_decode.c firmware: Google VPD: import lib_vpd source files 2017-04-18 18:04:45 +02:00
vpd_decode.h firmware: Google VPD: import lib_vpd source files 2017-04-18 18:04:45 +02:00
vpd.c firmware: vpd: fix spelling mistake "partion" -> "partition" 2018-09-25 20:20:58 +02:00