mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
To: hdegoede@redhat.com, markgross@kernel.org
Cc: platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Subject: [PATCH 03/12] platform/x86: ISST: Add IOCTL default callback
Date: Fri, 10 Feb 2023 22:32:48 -0800	[thread overview]
Message-ID: <20230211063257.311746-4-srinivas.pandruvada@linux.intel.com> (raw)
In-Reply-To: <20230211063257.311746-1-srinivas.pandruvada@linux.intel.com>

The common IOCTL handler has a predefined list of 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>
---
 .../x86/intel/speed_select_if/isst_if_common.c        | 11 +++++++++++
 .../x86/intel/speed_select_if/isst_if_common.h        |  4 ++++
 2 files changed, 15 insertions(+)

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 63d49fe17a16..9fef955bdedc 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 */
-- 
2.39.1


  parent reply	other threads:[~2023-02-11  6:33 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-11  6:32 [PATCH 00/12] platform/x86: ISST: Use TPMI interface Srinivas Pandruvada
2023-02-11  6:32 ` [PATCH 01/12] platform/x86: ISST: Fix kernel documentation warnings Srinivas Pandruvada
2023-03-01 14:23   ` Hans de Goede
2023-03-01 14:48     ` srinivas pandruvada
2023-03-01 14:48       ` Hans de Goede
2023-02-11  6:32 ` [PATCH 02/12] platform/x86: ISST: Add TPMI target Srinivas Pandruvada
2023-03-01 14:25   ` Hans de Goede
2023-02-11  6:32 ` Srinivas Pandruvada [this message]
2023-02-11  6:32 ` [PATCH 04/12] platform/x86: ISST: Add API version of the target Srinivas Pandruvada
2023-02-11  6:32 ` [PATCH 05/12] platform/x86: ISST: Add support for MSR 0x54 Srinivas Pandruvada
2023-03-01 14:30   ` Hans de Goede
2023-03-01 14:41     ` srinivas pandruvada
2023-03-01 14:46       ` Hans de Goede
2023-02-11  6:32 ` [PATCH 06/12] platform/x86: ISST: Enumerate TPMI SST and create framework Srinivas Pandruvada
2023-03-01 14:37   ` Hans de Goede
2023-03-01 14:45     ` srinivas pandruvada
2023-03-01 14:47       ` Hans de Goede
2023-02-11  6:32 ` [PATCH 07/12] platform/x86: ISST: Parse SST MMIO and update instance Srinivas Pandruvada
2023-02-11  6:32 ` [PATCH 08/12] platform/x86: ISST: Add SST-CP support via TPMI Srinivas Pandruvada
2023-02-11  6:32 ` [PATCH 09/12] platform/x86: ISST: Add SST-PP " Srinivas Pandruvada
2023-02-11  6:32 ` [PATCH 10/12] platform/x86: ISST: Add SST-BF " Srinivas Pandruvada
2023-02-11  6:32 ` [PATCH 11/12] platform/x86: ISST: Add SST-TF " Srinivas Pandruvada
2023-02-11  6:32 ` [PATCH 12/12] platform/x86: ISST: Add suspend/resume callbacks Srinivas Pandruvada
2023-03-01 14:40   ` Hans de Goede
2023-03-01 14:46     ` srinivas pandruvada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230211063257.311746-4-srinivas.pandruvada@linux.intel.com \
    --to=srinivas.pandruvada@linux.intel.com \
    --cc=hdegoede@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=markgross@kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®