summaryrefslogtreecommitdiffstats
path: root/drivers/soc/qcom/smd-rpm.c
diff options
context:
space:
mode:
authorBjorn Andersson <bjorn.andersson@linaro.org>2016-03-28 21:35:22 -0700
committerAndy Gross <andy.gross@linaro.org>2016-04-19 21:55:12 -0500
commitb853cb9628bfbcc4017da46d5f5b46e3eba9d8c6 (patch)
tree1a5af00411dc2a4d4f731bf18a00a6e859f62aa5 /drivers/soc/qcom/smd-rpm.c
parentafd356dfb3a4127b61a3519802a4db9046703724 (diff)
downloadblackbird-obmc-linux-b853cb9628bfbcc4017da46d5f5b46e3eba9d8c6.tar.gz
blackbird-obmc-linux-b853cb9628bfbcc4017da46d5f5b46e3eba9d8c6.zip
soc: qcom: smd: Make callback pass channel reference
By passing the smd channel reference to the callback, rather than the smd device, we can open additional smd channels from sub-devices of smd devices. Also updates the two smd clients today found in mainline. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Andy Gross <andy.gross@linaro.org>
Diffstat (limited to 'drivers/soc/qcom/smd-rpm.c')
-rw-r--r--drivers/soc/qcom/smd-rpm.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/soc/qcom/smd-rpm.c b/drivers/soc/qcom/smd-rpm.c
index 731fa066f712..6609d7e0edb0 100644
--- a/drivers/soc/qcom/smd-rpm.c
+++ b/drivers/soc/qcom/smd-rpm.c
@@ -33,6 +33,7 @@
*/
struct qcom_smd_rpm {
struct qcom_smd_channel *rpm_channel;
+ struct device *dev;
struct completion ack;
struct mutex lock;
@@ -149,14 +150,14 @@ out:
}
EXPORT_SYMBOL(qcom_rpm_smd_write);
-static int qcom_smd_rpm_callback(struct qcom_smd_device *qsdev,
+static int qcom_smd_rpm_callback(struct qcom_smd_channel *channel,
const void *data,
size_t count)
{
const struct qcom_rpm_header *hdr = data;
size_t hdr_length = le32_to_cpu(hdr->length);
const struct qcom_rpm_message *msg;
- struct qcom_smd_rpm *rpm = dev_get_drvdata(&qsdev->dev);
+ struct qcom_smd_rpm *rpm = qcom_smd_get_drvdata(channel);
const u8 *buf = data + sizeof(struct qcom_rpm_header);
const u8 *end = buf + hdr_length;
char msgbuf[32];
@@ -165,7 +166,7 @@ static int qcom_smd_rpm_callback(struct qcom_smd_device *qsdev,
if (le32_to_cpu(hdr->service_type) != RPM_SERVICE_TYPE_REQUEST ||
hdr_length < sizeof(struct qcom_rpm_message)) {
- dev_err(&qsdev->dev, "invalid request\n");
+ dev_err(rpm->dev, "invalid request\n");
return 0;
}
@@ -206,7 +207,9 @@ static int qcom_smd_rpm_probe(struct qcom_smd_device *sdev)
mutex_init(&rpm->lock);
init_completion(&rpm->ack);
+ rpm->dev = &sdev->dev;
rpm->rpm_channel = sdev->channel;
+ qcom_smd_set_drvdata(sdev->channel, rpm);
dev_set_drvdata(&sdev->dev, rpm);
OpenPOWER on IntegriCloud