]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
soc: qcom: smd: Support multiple channels per sdev
authorBjorn Andersson <bjorn.andersson@sonymobile.com>
Tue, 20 Oct 2015 02:45:43 +0000 (10:45 +0800)
committerSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Mon, 11 Jan 2016 09:55:14 +0000 (09:55 +0000)
This patch allows chaining additional channels to a SMD device, enabling
implementation of multi-channel SMD devies - like Bluetooth.

Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
drivers/soc/qcom/smd.c
include/linux/soc/qcom/smd.h

index 90da9168333c1ef6361a5e23dabefacda53a8b22..091d23c0e49f271f522787d7332eb2e9c9a95687 100644 (file)
@@ -827,6 +827,8 @@ static int qcom_smd_dev_remove(struct device *dev)
        struct qcom_smd_device *qsdev = to_smd_device(dev);
        struct qcom_smd_driver *qsdrv = to_smd_driver(dev);
        struct qcom_smd_channel *channel = qsdev->channel;
+       struct qcom_smd_channel *tmp;
+       struct qcom_smd_channel *ch;
 
        qcom_smd_channel_set_state(channel, SMD_CHANNEL_CLOSING);
 
@@ -846,10 +848,14 @@ static int qcom_smd_dev_remove(struct device *dev)
                qsdrv->remove(qsdev);
 
        /*
-        * The client is now gone, cleanup and reset the channel state.
+        * The client is now gone, close and release all channels associated
+        * with this sdev
         */
-       channel->qsdev = NULL;
-       qcom_smd_channel_close(channel);
+       list_for_each_entry_safe(ch, tmp, &channel->dev_list, dev_list) {
+               qcom_smd_channel_close(ch);
+               list_del(&ch->dev_list);
+               ch->qsdev = NULL;
+       }
 
        return 0;
 }
@@ -996,6 +1002,7 @@ static struct qcom_smd_channel *qcom_smd_create_channel(struct qcom_smd_edge *ed
        if (!channel)
                return ERR_PTR(-ENOMEM);
 
+       INIT_LIST_HEAD(&channel->dev_list);
        channel->edge = edge;
        channel->name = devm_kstrdup(smd->dev, name, GFP_KERNEL);
        if (!channel->name)
index 5532e73f45d167c1261b6ac82caa96c84e644f68..cccf2b17c077ad90b3a9ae66b5d6dfb20dd11ab7 100644 (file)
@@ -71,6 +71,7 @@ struct qcom_smd_channel {
        int pkt_size;
 
        struct list_head list;
+       struct list_head dev_list;
 };
 
 /**