Commit d5933855 authored by Bjorn Andersson's avatar Bjorn Andersson Committed by Andy Gross

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: default avatarBjorn Andersson <bjorn.andersson@sonymobile.com>
Signed-off-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: default avatarAndy Gross <andy.gross@linaro.org>
parent 3fd3f2fd
...@@ -193,6 +193,7 @@ struct qcom_smd_channel { ...@@ -193,6 +193,7 @@ struct qcom_smd_channel {
int pkt_size; int pkt_size;
struct list_head list; struct list_head list;
struct list_head dev_list;
}; };
/** /**
...@@ -887,6 +888,8 @@ static int qcom_smd_dev_remove(struct device *dev) ...@@ -887,6 +888,8 @@ static int qcom_smd_dev_remove(struct device *dev)
struct qcom_smd_device *qsdev = to_smd_device(dev); struct qcom_smd_device *qsdev = to_smd_device(dev);
struct qcom_smd_driver *qsdrv = to_smd_driver(dev); struct qcom_smd_driver *qsdrv = to_smd_driver(dev);
struct qcom_smd_channel *channel = qsdev->channel; 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); qcom_smd_channel_set_state(channel, SMD_CHANNEL_CLOSING);
...@@ -906,10 +909,14 @@ static int qcom_smd_dev_remove(struct device *dev) ...@@ -906,10 +909,14 @@ static int qcom_smd_dev_remove(struct device *dev)
qsdrv->remove(qsdev); 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; list_for_each_entry_safe(ch, tmp, &channel->dev_list, dev_list) {
qcom_smd_channel_close(channel); qcom_smd_channel_close(ch);
list_del(&ch->dev_list);
ch->qsdev = NULL;
}
return 0; return 0;
} }
...@@ -1056,6 +1063,7 @@ static struct qcom_smd_channel *qcom_smd_create_channel(struct qcom_smd_edge *ed ...@@ -1056,6 +1063,7 @@ static struct qcom_smd_channel *qcom_smd_create_channel(struct qcom_smd_edge *ed
if (!channel) if (!channel)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
INIT_LIST_HEAD(&channel->dev_list);
channel->edge = edge; channel->edge = edge;
channel->name = devm_kstrdup(smd->dev, name, GFP_KERNEL); channel->name = devm_kstrdup(smd->dev, name, GFP_KERNEL);
if (!channel->name) if (!channel->name)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment