summaryrefslogtreecommitdiff
path: root/drivers/platform/x86/intel/speed_select_if
diff options
context:
space:
mode:
authorSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>2023-02-11 09:32:48 +0300
committerHans de Goede <hdegoede@redhat.com>2023-03-07 14:08:30 +0300
commit33c16dc1a2d1697be0fec95a0393bef4fbc27a0f (patch)
treef417819c8726b8a30a526418a532b22919e24795 /drivers/platform/x86/intel/speed_select_if
parent6614823a16b700b7d996e75b1200b29bec88f8ef (diff)
downloadlinux-33c16dc1a2d1697be0fec95a0393bef4fbc27a0f.tar.xz
platform/x86: ISST: Add IOCTL default callback
The common IOCTL handler has a predefined list of IOCTLs it can handle. There is no default handler, if there is no match. Allow a client driver to define their own version of default IOCTL callback. In this way the default handling is passed to the client drivers to handle. With the introduction of TPMI target, IOCTL list is extended. The additional TPMI specific IOCTLs will be passed to the TPMI client driver default IOCTL handler. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Link: https://lore.kernel.org/r/20230211063257.311746-4-srinivas.pandruvada@linux.intel.com Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'drivers/platform/x86/intel/speed_select_if')
-rw-r--r--drivers/platform/x86/intel/speed_select_if/isst_if_common.c11
-rw-r--r--drivers/platform/x86/intel/speed_select_if/isst_if_common.h4
2 files changed, 15 insertions, 0 deletions
diff --git a/drivers/platform/x86/intel/speed_select_if/isst_if_common.c b/drivers/platform/x86/intel/speed_select_if/isst_if_common.c
index 0954a04623ed..cdf0501f4e4f 100644
--- a/drivers/platform/x86/intel/speed_select_if/isst_if_common.c
+++ b/drivers/platform/x86/intel/speed_select_if/isst_if_common.c
@@ -588,6 +588,7 @@ static long isst_if_def_ioctl(struct file *file, unsigned int cmd,
struct isst_if_cmd_cb cmd_cb;
struct isst_if_cmd_cb *cb;
long ret = -ENOTTY;
+ int i;
switch (cmd) {
case ISST_IF_GET_PLATFORM_INFO:
@@ -616,6 +617,16 @@ static long isst_if_def_ioctl(struct file *file, unsigned int cmd,
ret = isst_if_exec_multi_cmd(argp, &cmd_cb);
break;
default:
+ for (i = 0; i < ISST_IF_DEV_MAX; ++i) {
+ struct isst_if_cmd_cb *cb = &punit_callbacks[i];
+ int ret;
+
+ if (cb->def_ioctl) {
+ ret = cb->def_ioctl(file, cmd, arg);
+ if (!ret)
+ return ret;
+ }
+ }
break;
}
diff --git a/drivers/platform/x86/intel/speed_select_if/isst_if_common.h b/drivers/platform/x86/intel/speed_select_if/isst_if_common.h
index 967c338e83c5..34a172e5c82c 100644
--- a/drivers/platform/x86/intel/speed_select_if/isst_if_common.h
+++ b/drivers/platform/x86/intel/speed_select_if/isst_if_common.h
@@ -48,6 +48,8 @@
* response to user ioctl buffer. The "resume" argument
* can be used to avoid storing the command for replay
* during system resume
+ * @def_ioctl: Default IOCTL handler callback, if there is no match in
+ * the existing list of IOCTL handled by the common handler.
*
* This structure is used to register an handler for IOCTL. To avoid
* code duplication common code handles all the IOCTL command read/write
@@ -58,8 +60,10 @@ struct isst_if_cmd_cb {
int registered;
int cmd_size;
int offset;
+
struct module *owner;
long (*cmd_callback)(u8 *ptr, int *write_only, int resume);
+ long (*def_ioctl)(struct file *file, unsigned int cmd, unsigned long arg);
};
/* Internal interface functions */