platform/chrome: cros_ec_chardev: Export chardev ioctls to UAPI
PATCH 1/1 platform/chrome: cros_ec_chardev: Export chardev ioctls to UAPI
These ioctls and structures are part of the UAPI, export them as such by moving the header to include/uapi/. We leave the version define out of the header as it isn't part of the UAPI. Similarly, EC_MEMMAP_SIZE is from the copy/pasted cros ec header so we just hardcode the array size instead of exporting that define.
Cc Guenter Roeck <[email protected]>
Signed-off-by Stephen Boyd <[email protected]>
---
drivers/mfd/cros_ec_dev.c | 1 -
drivers/platform/chrome/cros_ec_chardev.c | 5 ++-
include/linux/platform_data/cros_ec_proto.h | 19 +-----------
.../linux}/cros_ec_chardev.h | 31 +++++++++++++------
4 files changed, 27 insertions(+), 29 deletions(-)
rename include/{linux/platform_data => uapi/linux}/cros_ec_chardev.h (55%)drivers/mfd/cros_ec_dev.c +0 -1
@@ -12,7 +12,6 @@#include <linux/mod_devicetable.h> #include <linux/of_platform.h> #include <linux/platform_device.h> -#include <linux/platform_data/cros_ec_chardev.h> #include <linux/platform_data/cros_ec_commands.h> #include <linux/platform_data/cros_ec_proto.h> #include <linux/slab.h>
drivers/platform/chrome/cros_ec_chardev.c +4 -1
@@ -16,7 +16,6 @@#include <linux/miscdevice.h> #include <linux/module.h> #include <linux/notifier.h> -#include <linux/platform_data/cros_ec_chardev.h> #include <linux/platform_data/cros_ec_commands.h> #include <linux/platform_data/cros_ec_proto.h> #include <linux/platform_device.h>
@@ -25,6 +24,10 @@#include <linux/types.h> #include <linux/uaccess.h> +#include <uapi/linux/cros_ec_chardev.h> + +#define CROS_EC_DEV_VERSION "1.0.0" +#define DRV_NAME "cros-ec-chardev"/* Arbitrary bounded size for the event queue */
include/linux/platform_data/cros_ec_proto.h +1 -18
@@ -13,6 +13,7 @@#include <linux/notifier.h> #include <linux/platform_data/cros_ec_commands.h> +#include <uapi/linux/cros_ec_chardev.h> #define CROS_EC_DEV_NAME "cros_ec"#define CROS_EC_DEV_FP_NAME "cros_fp"
@@ -54,24 +55,6 @@ enum { EC_MAX_MSG_BYTES = 64 * 1024, }; -/** -* struct cros_ec_command - Information about a ChromeOS EC command. -* @version: Command version number (often 0). -* @command: Command to send (EC_CMD_...). -* @outsize: Outgoing length in bytes. -* @insize: Max number of bytes to accept from the EC. -* @result: EC's response to the command (separate from communication failure). -* @data: Where to put the incoming data from EC and outgoing data to EC. -*/ -struct cros_ec_command { -uint32_t version; -uint32_t command; -uint32_t outsize; -uint32_t insize; -uint32_t result; -uint8_t data[]; -}; -/** * struct cros_ec_device - Information about a ChromeOS EC device. * @phys_name: Name of physical comms layer (e.g. 'i2c-4').
include/uapi/linux/cros_ec_chardev.h renamed from include/linux/platform_data/cros_ec_chardev.h +22 -9
@@ -1,4 +1,4 @@ -/* SPDX-License-Identifier: GPL-2.0 */ +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * ChromeOS EC device interface. *
@@ -8,13 +8,26 @@#ifndef _UAPI_LINUX_CROS_EC_DEV_H_#define _UAPI_LINUX_CROS_EC_DEV_H_ -#include <linux/bits.h> #include <linux/ioctl.h> #include <linux/types.h> -#include <linux/platform_data/cros_ec_commands.h> - -#define CROS_EC_DEV_VERSION "1.0.0" +/** +* struct cros_ec_command - Information about a ChromeOS EC command. +* @version: Command version number (often 0). +* @command: Command to send (EC_CMD_...). +* @outsize: Outgoing length in bytes. +* @insize: Max number of bytes to accept from the EC. +* @result: EC's response to the command (separate from communication failure). +* @data: Where to put the incoming data from EC and outgoing data to EC. +*/ +struct cros_ec_command { +__u32 version; +__u32 command; +__u32 outsize; +__u32 insize; +__u32 result; +__u8 data[]; +};/** * struct cros_ec_readmem - Struct used to read mapped memory.
@@ -25,9 +38,9 @@* read or negative on error. */ struct cros_ec_readmem { -uint32_t offset; -uint32_t bytes; -uint8_t buffer[EC_MEMMAP_SIZE ]; +__u32 offset; +__u32 bytes; +__u8 buffer[255 ]; };#define CROS_EC_DEV_IOC 0xEC
@@ -35,4 +48,4 @@ struct cros_ec_readmem {#define CROS_EC_DEV_IOCRDMEM _IOWR(CROS_EC_DEV_IOC, 1, struct cros_ec_readmem)#define CROS_EC_DEV_IOCEVENTMASK _IO(CROS_EC_DEV_IOC, 2) -#endif /* _CROS_EC_DEV_H_ */ +#endif /* _UAPI_LINUX_CROS_EC_DEV_H_ */
base-commit: 8bb7eca972ad531c9b149c0a51ab43a417385813
Signature · 1 line
https://chromeos.dev