aboutsummaryrefslogtreecommitdiff
path: root/drivers/soc
diff options
context:
space:
mode:
authorBjorn Andersson <bjorn.andersson@sonymobile.com>2015-10-20 10:45:43 +0800
committerYin, Fengwei <fengwei.yin@linaro.org>2015-10-20 15:51:23 +0800
commit2bdeec6c3c0e14da2d5f558cf6706fdb01451069 (patch)
tree340d47f5607baf2c7eb5463b3b99b6f2834a980f /drivers/soc
parent0725735b889758acadf8d818029c4e40f5a54b07 (diff)
soc: qcom: smd: Support multiple channels per sdev
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>
Diffstat (limited to 'drivers/soc')
-rw-r--r--drivers/soc/qcom/smd.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/soc/qcom/smd.c b/drivers/soc/qcom/smd.c
index b0d4d6ac6c08..4fcde4504ecd 100644
--- a/drivers/soc/qcom/smd.c
+++ b/drivers/soc/qcom/smd.c
@@ -775,6 +775,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);
@@ -794,10 +796,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;
}
@@ -946,6 +952,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)