]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
HID: intel-ish-hid: Simplify ishtp_cl_link()
authorSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Mon, 18 Mar 2019 19:14:21 +0000 (12:14 -0700)
committerJiri Kosina <jkosina@suse.cz>
Tue, 19 Mar 2019 10:57:23 +0000 (11:57 +0100)
All callers will only use ISHTP_HOST_CLIENT_ID_ANY, so get rid of
option to pass this additional id.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/intel-ish-hid/ishtp-hid-client.c
drivers/hid/intel-ish-hid/ishtp/client.c
drivers/hid/intel-ish-hid/ishtp/client.h

index 17d5bd4f52c1c3f8b1ded294231be8a6c2b4401d..94a00ffeb09bcf7dab057fb7946f6a267fde2444 100644 (file)
@@ -652,7 +652,7 @@ static int hid_ishtp_cl_init(struct ishtp_cl *hid_ishtp_cl, int reset)
        dev_dbg(cl_data_to_dev(client_data), "%s\n", __func__);
        hid_ishtp_trace(client_data,  "%s reset flag: %d\n", __func__, reset);
 
-       rv = ishtp_cl_link(hid_ishtp_cl, ISHTP_HOST_CLIENT_ID_ANY);
+       rv = ishtp_cl_link(hid_ishtp_cl);
        if (rv) {
                dev_err(cl_data_to_dev(client_data),
                        "ishtp_cl_link failed\n");
index 760e48a368a8c27c856d90d05159978f4cf8f39b..657b46dcefa646ced99fa6d34eccfa607c2683b4 100644 (file)
@@ -168,9 +168,6 @@ EXPORT_SYMBOL(ishtp_cl_free);
 /**
  * ishtp_cl_link() - Reserve a host id and link the client instance
  * @cl: client device instance
- * @id: host client id to use. It can be ISHTP_HOST_CLIENT_ID_ANY if any
- *     id from the available can be used
- *
  *
  * This allocates a single bit in the hostmap. This function will make sure
  * that not many client sessions are opened at the same time. Once allocated
@@ -179,11 +176,11 @@ EXPORT_SYMBOL(ishtp_cl_free);
  *
  * Return: 0 or error code on failure
  */
-int ishtp_cl_link(struct ishtp_cl *cl, int id)
+int ishtp_cl_link(struct ishtp_cl *cl)
 {
        struct ishtp_device *dev;
-       unsigned long   flags, flags_cl;
-       int     ret = 0;
+       unsigned long flags, flags_cl;
+       int id, ret = 0;
 
        if (WARN_ON(!cl || !cl->dev))
                return -EINVAL;
@@ -197,10 +194,7 @@ int ishtp_cl_link(struct ishtp_cl *cl, int id)
                goto unlock_dev;
        }
 
-       /* If Id is not assigned get one*/
-       if (id == ISHTP_HOST_CLIENT_ID_ANY)
-               id = find_first_zero_bit(dev->host_clients_map,
-                       ISHTP_CLIENTS_MAX);
+       id = find_first_zero_bit(dev->host_clients_map, ISHTP_CLIENTS_MAX);
 
        if (id >= ISHTP_CLIENTS_MAX) {
                spin_unlock_irqrestore(&dev->device_lock, flags);
index 992625891a6ccd09d8558b85c8af86ddaf5819e7..afa8b1f521d0e7ce5f43baea2ed76ec2e161c6de 100644 (file)
@@ -172,7 +172,7 @@ static inline bool ishtp_cl_cmp_id(const struct ishtp_cl *cl1,
 /* exported functions from ISHTP under client management scope */
 struct ishtp_cl *ishtp_cl_allocate(struct ishtp_cl_device *cl_device);
 void ishtp_cl_free(struct ishtp_cl *cl);
-int ishtp_cl_link(struct ishtp_cl *cl, int id);
+int ishtp_cl_link(struct ishtp_cl *cl);
 void ishtp_cl_unlink(struct ishtp_cl *cl);
 int ishtp_cl_disconnect(struct ishtp_cl *cl);
 int ishtp_cl_connect(struct ishtp_cl *cl);