[PATCH 13/14] greybus: cpc: add private data pointer in CPC Host Device

Damien Riégel posted 14 patches 2 days, 8 hours ago
There is a newer version of this series
[PATCH 13/14] greybus: cpc: add private data pointer in CPC Host Device
Posted by Damien Riégel 2 days, 8 hours ago
Add a private data pointer when creating a CPC Host Device. This lets
the host device drivers get back their context more easily in the
callbacks.

Signed-off-by: Damien Riégel <damien.riegel@silabs.com>
---
 drivers/greybus/cpc/host.c | 4 +++-
 drivers/greybus/cpc/host.h | 5 ++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/greybus/cpc/host.c b/drivers/greybus/cpc/host.c
index 54f0b07efec..2784207279e 100644
--- a/drivers/greybus/cpc/host.c
+++ b/drivers/greybus/cpc/host.c
@@ -158,7 +158,8 @@ static void cpc_hd_init(struct cpc_host_device *cpc_hd)
 	skb_queue_head_init(&cpc_hd->tx_queue);
 }
 
-struct cpc_host_device *cpc_hd_create(struct cpc_hd_driver *driver, struct device *parent)
+struct cpc_host_device *cpc_hd_create(struct cpc_hd_driver *driver, struct device *parent,
+				      void *priv)
 {
 	struct cpc_host_device *cpc_hd;
 	struct gb_host_device *hd;
@@ -175,6 +176,7 @@ struct cpc_host_device *cpc_hd_create(struct cpc_hd_driver *driver, struct devic
 	cpc_hd = gb_hd_to_cpc_hd(hd);
 	cpc_hd->gb_hd = hd;
 	cpc_hd->driver = driver;
+	cpc_hd->priv = priv;
 
 	cpc_hd_init(cpc_hd);
 
diff --git a/drivers/greybus/cpc/host.h b/drivers/greybus/cpc/host.h
index ee6a86de309..4bb7339b394 100644
--- a/drivers/greybus/cpc/host.h
+++ b/drivers/greybus/cpc/host.h
@@ -37,6 +37,8 @@ struct cpc_host_device {
 	struct cpc_cport *cports[GB_CPC_NUM_CPORTS];
 
 	struct sk_buff_head tx_queue;
+
+	void *priv;
 };
 
 static inline struct device *cpc_hd_dev(struct cpc_host_device *cpc_hd)
@@ -44,7 +46,8 @@ static inline struct device *cpc_hd_dev(struct cpc_host_device *cpc_hd)
 	return &cpc_hd->gb_hd->dev;
 }
 
-struct cpc_host_device *cpc_hd_create(struct cpc_hd_driver *driver, struct device *parent);
+struct cpc_host_device *cpc_hd_create(struct cpc_hd_driver *driver, struct device *parent,
+				      void *priv);
 int cpc_hd_add(struct cpc_host_device *cpc_hd);
 void cpc_hd_put(struct cpc_host_device *cpc_hd);
 void cpc_hd_del(struct cpc_host_device *cpc_hd);
-- 
2.49.0