Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1243647 > unrolled thread
| Started by | Bjorn Andersson <bjorn.andersson@sonymobile.com> |
|---|---|
| First post | 2015-10-09 22:50 +0200 |
| Last post | 2015-10-09 23:00 +0200 |
| Articles | 2 — 1 participant |
Back to article view | Back to linux.kernel
[PATCH v2 0/7] Qualcomm WCNSS HCI support Bjorn Andersson <bjorn.andersson@sonymobile.com> - 2015-10-09 22:50 +0200
[PATCH v2 1/7] soc: qcom: smd: Introduce callback setter Bjorn Andersson <bjorn.andersson@sonymobile.com> - 2015-10-09 23:00 +0200
| From | Bjorn Andersson <bjorn.andersson@sonymobile.com> |
|---|---|
| Date | 2015-10-09 22:50 +0200 |
| Subject | [PATCH v2 0/7] Qualcomm WCNSS HCI support |
| Message-ID | <qhMM2-4K6-5@gated-at.bofh.it> |
After trying to avoid implementing multi-channel support in SMD in v1 of the HCI driver for Qualcomm WCNSS BT, this new version includes the necessary SMD refactoring and additon of an API that allows SMD devices to call back into the SMD core to acquire additonal channels. The additional channels are tied to the existing SMD device and the life cycle of the new channel will be tied to, and affect, the original channel. With this in place the btqcomsmd driver is refactored into being a single driver, without global state. Bjorn Andersson (7): soc: qcom: smd: Introduce callback setter soc: qcom: smd: Split discovery and state change work soc: qcom: smd: Refactor channel open and close handling soc: qcom: smd: Support multiple channels per sdev soc: qcom: smd: Support opening additional channels Bluetooth: Add HCI device identifier for Qualcomm SMD Bluetooth: hci_smd: Qualcomm WCNSS HCI driver drivers/bluetooth/Kconfig | 11 ++ drivers/bluetooth/Makefile | 1 + drivers/bluetooth/btqcomsmd.c | 198 ++++++++++++++++++++++++++++++++++++ drivers/soc/qcom/smd.c | 228 +++++++++++++++++++++++++++++++----------- include/linux/soc/qcom/smd.h | 8 +- include/net/bluetooth/hci.h | 1 + 6 files changed, 387 insertions(+), 60 deletions(-) create mode 100644 drivers/bluetooth/btqcomsmd.c -- 2.4.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Bjorn Andersson <bjorn.andersson@sonymobile.com> |
|---|---|
| Date | 2015-10-09 23:00 +0200 |
| Subject | [PATCH v2 1/7] soc: qcom: smd: Introduce callback setter |
| Message-ID | <qhMVJ-4VA-15@gated-at.bofh.it> |
| In reply to | #1243647 |
Introduce a setter for the callback function pointer to clarify the
locking around the operation and to reduce some duplication.
Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
---
Changes since v1:
- New patch
drivers/soc/qcom/smd.c | 25 +++++++++++++++++--------
include/linux/soc/qcom/smd.h | 4 +++-
2 files changed, 20 insertions(+), 9 deletions(-)
diff --git a/drivers/soc/qcom/smd.c b/drivers/soc/qcom/smd.c
index 18964f154383..8b401d89b0d0 100644
--- a/drivers/soc/qcom/smd.c
+++ b/drivers/soc/qcom/smd.c
@@ -186,7 +186,7 @@ struct qcom_smd_channel {
int fifo_size;
void *bounce_buffer;
- int (*cb)(struct qcom_smd_device *, const void *, size_t);
+ qcom_smd_cb_t cb;
spinlock_t recv_lock;
@@ -378,6 +378,19 @@ static void qcom_smd_channel_reset(struct qcom_smd_channel *channel)
}
/*
+ * Set the callback for a channel, with appropriate locking
+ */
+static void qcom_smd_channel_set_callback(struct qcom_smd_channel *channel,
+ qcom_smd_cb_t cb)
+{
+ unsigned long flags;
+
+ spin_lock_irqsave(&channel->recv_lock, flags);
+ channel->cb = cb;
+ spin_unlock_irqrestore(&channel->recv_lock, flags);
+};
+
+/*
* Calculate the amount of data available in the rx fifo
*/
static size_t qcom_smd_channel_get_rx_avail(struct qcom_smd_channel *channel)
@@ -815,8 +828,7 @@ static int qcom_smd_dev_probe(struct device *dev)
if (!channel->bounce_buffer)
return -ENOMEM;
- channel->cb = qsdrv->callback;
-
+ qcom_smd_channel_set_callback(channel, qsdrv->callback);
qcom_smd_channel_set_state(channel, SMD_CHANNEL_OPENING);
qcom_smd_channel_set_state(channel, SMD_CHANNEL_OPENED);
@@ -832,7 +844,7 @@ static int qcom_smd_dev_probe(struct device *dev)
err:
dev_err(&qsdev->dev, "probe failed\n");
- channel->cb = NULL;
+ qcom_smd_channel_set_callback(channel, NULL);
kfree(channel->bounce_buffer);
channel->bounce_buffer = NULL;
@@ -851,16 +863,13 @@ 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;
- unsigned long flags;
qcom_smd_channel_set_state(channel, SMD_CHANNEL_CLOSING);
/*
* Make sure we don't race with the code receiving data.
*/
- spin_lock_irqsave(&channel->recv_lock, flags);
- channel->cb = NULL;
- spin_unlock_irqrestore(&channel->recv_lock, flags);
+ qcom_smd_channel_set_callback(channel, NULL);
/* Wake up any sleepers in qcom_smd_send() */
wake_up_interruptible(&channel->fblockread_event);
diff --git a/include/linux/soc/qcom/smd.h b/include/linux/soc/qcom/smd.h
index d0cb6d189a0a..65a64fcdb1aa 100644
--- a/include/linux/soc/qcom/smd.h
+++ b/include/linux/soc/qcom/smd.h
@@ -26,6 +26,8 @@ struct qcom_smd_device {
struct qcom_smd_channel *channel;
};
+typedef int (*qcom_smd_cb_t)(struct qcom_smd_device *, const void *, size_t);
+
/**
* struct qcom_smd_driver - smd driver struct
* @driver: underlying device driver
@@ -42,7 +44,7 @@ struct qcom_smd_driver {
int (*probe)(struct qcom_smd_device *dev);
void (*remove)(struct qcom_smd_device *dev);
- int (*callback)(struct qcom_smd_device *, const void *, size_t);
+ qcom_smd_cb_t callback;
};
int qcom_smd_driver_register(struct qcom_smd_driver *drv);
--
2.4.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web