From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
To: jikos@kernel.org
Cc: benjamin.tissoires@redhat.com, linux-input@vger.kernel.org,
linux-kernel@vger.kernel.org, Even Xu <even.xu@intel.com>
Subject: [PATCH 5/9] hid: intel-ish-hid: ishtp: add helper function for client search
Date: Tue, 11 Sep 2018 16:44:17 -0700 [thread overview]
Message-ID: <20180911234421.10691-6-srinivas.pandruvada@linux.intel.com> (raw)
In-Reply-To: <20180911234421.10691-1-srinivas.pandruvada@linux.intel.com>
From: Even Xu <even.xu@intel.com>
Add helper function ishtp_fw_cl_get_client() for client driver searching
client information to hide internal details from callers.
Signed-off-by: Even Xu <even.xu@intel.com>
Reviewed-by: Andriy Shevchenko <andriy.shevchenko@intel.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
---
drivers/hid/intel-ish-hid/ishtp/bus.c | 25 +++++++++++++++++++++++++
drivers/hid/intel-ish-hid/ishtp/bus.h | 2 ++
2 files changed, 27 insertions(+)
diff --git a/drivers/hid/intel-ish-hid/ishtp/bus.c b/drivers/hid/intel-ish-hid/ishtp/bus.c
index d5db5e96e4a1..728dc6d4561a 100644
--- a/drivers/hid/intel-ish-hid/ishtp/bus.c
+++ b/drivers/hid/intel-ish-hid/ishtp/bus.c
@@ -148,6 +148,31 @@ int ishtp_fw_cl_by_uuid(struct ishtp_device *dev, const uuid_le *uuid)
}
EXPORT_SYMBOL(ishtp_fw_cl_by_uuid);
+/**
+ * ishtp_fw_cl_get_client() - return client information to client
+ * @dev: the ishtp device structure
+ * @uuid: uuid of the client to search
+ *
+ * Search firmware client using UUID and reture related client information.
+ *
+ * Return: pointer of client information on success, NULL on failure.
+ */
+struct ishtp_fw_client *ishtp_fw_cl_get_client(struct ishtp_device *dev,
+ const uuid_le *uuid)
+{
+ int i;
+ unsigned long flags;
+
+ spin_lock_irqsave(&dev->fw_clients_lock, flags);
+ i = ishtp_fw_cl_by_uuid(dev, uuid);
+ spin_unlock_irqrestore(&dev->fw_clients_lock, flags);
+ if (i < 0 || dev->fw_clients[i].props.fixed_address)
+ return NULL;
+
+ return &dev->fw_clients[i];
+}
+EXPORT_SYMBOL(ishtp_fw_cl_get_client);
+
/**
* ishtp_fw_cl_by_id() - return index to fw_clients for client_id
* @dev: the ishtp device structure
diff --git a/drivers/hid/intel-ish-hid/ishtp/bus.h b/drivers/hid/intel-ish-hid/ishtp/bus.h
index 88883311667e..b8a5bcc82536 100644
--- a/drivers/hid/intel-ish-hid/ishtp/bus.h
+++ b/drivers/hid/intel-ish-hid/ishtp/bus.h
@@ -113,5 +113,7 @@ void ishtp_cl_driver_unregister(struct ishtp_cl_driver *driver);
int ishtp_register_event_cb(struct ishtp_cl_device *device,
void (*read_cb)(struct ishtp_cl_device *));
int ishtp_fw_cl_by_uuid(struct ishtp_device *dev, const uuid_le *cuuid);
+struct ishtp_fw_client *ishtp_fw_cl_get_client(struct ishtp_device *dev,
+ const uuid_le *uuid);
#endif /* _LINUX_ISHTP_CL_BUS_H */
--
2.17.1
next prev parent reply other threads:[~2018-09-11 23:45 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-11 23:44 [PATCH 0/9] HID: intel ISH: Cleanup patches Srinivas Pandruvada
2018-09-11 23:44 ` [PATCH 1/9] hid: intel-ish-hid: ishtp: add helper function for driver data get/set Srinivas Pandruvada
2018-09-11 23:44 ` [PATCH 2/9] hid: intel-ish-hid: use helper function for private driver data set/get Srinivas Pandruvada
2018-09-11 23:44 ` [PATCH 3/9] hid: intel-ish-hid: ishtp: add helper functions for client buffer operation Srinivas Pandruvada
2018-09-11 23:44 ` [PATCH 4/9] hid: intel-ish-hid: use helper function to access client buffer Srinivas Pandruvada
2018-09-11 23:44 ` Srinivas Pandruvada [this message]
2018-09-11 23:44 ` [PATCH 6/9] hid: intel-ish-hid: use helper function to search client id Srinivas Pandruvada
2018-09-11 23:44 ` [PATCH 7/9] HID: intel_ish-hid: Enhance API to get ring buffer sizes Srinivas Pandruvada
2018-09-11 23:44 ` [PATCH 8/9] HID: intel-ish-hid: use resource-managed api Srinivas Pandruvada
2018-09-11 23:44 ` [PATCH 9/9] HID: intel-ish-hid: using list_head for ipc write queue Srinivas Pandruvada
2018-09-24 9:21 ` [PATCH 0/9] HID: intel ISH: Cleanup patches Jiri Kosina
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=20180911234421.10691-6-srinivas.pandruvada@linux.intel.com \
--to=srinivas.pandruvada@linux.intel.com \
--cc=benjamin.tissoires@redhat.com \
--cc=even.xu@intel.com \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@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;
as well as URLs for NNTP newsgroup(s).