[PRE-REVIEW,04/16] net: liquidio: Prepare to use the new tasklet API
diff mbox series

Message ID 20190929163028.9665-5-romain.perier@gmail.com
State New
Headers show
  • Modernize the tasklet API
Related show

Commit Message

Romain Perier Sept. 29, 2019, 4:30 p.m. UTC
The future tasklet API will no longer allow to pass an arbitrary
"unsigned long" data parameter. The tasklet data structure will need to
be embedded into a data structure that will be retrieved from the tasklet
handler. Currently, the private driver data structure "struct
octeon_priv" is retrievable from the tasklet (by using container_of),
howerver it is not the case for the "struct octeon_device" (the field
"priv" is a pointer and cannot be used in container_of). This commit
adds a new field in the private data structure, so we can easily get a
pointer to the main device from the private context.

Signed-off-by: Romain Perier <romain.perier@gmail.com>
 drivers/net/ethernet/cavium/liquidio/lio_main.c    | 1 +
 drivers/net/ethernet/cavium/liquidio/octeon_main.h | 1 +
 2 files changed, 2 insertions(+)

diff mbox series

diff --git a/drivers/net/ethernet/cavium/liquidio/lio_main.c b/drivers/net/ethernet/cavium/liquidio/lio_main.c
index 7f3b2e3b0868..283e1461257d 100644
--- a/drivers/net/ethernet/cavium/liquidio/lio_main.c
+++ b/drivers/net/ethernet/cavium/liquidio/lio_main.c
@@ -4326,6 +4326,7 @@  static int octeon_device_init(struct octeon_device *octeon_dev)
 	atomic_set(&octeon_dev->status, OCT_DEV_HOST_OK);
+	oct_priv->dev = octeon_dev;
 	return 0;
diff --git a/drivers/net/ethernet/cavium/liquidio/octeon_main.h b/drivers/net/ethernet/cavium/liquidio/octeon_main.h
index 073d0647b439..5b4cb725f60f 100644
--- a/drivers/net/ethernet/cavium/liquidio/octeon_main.h
+++ b/drivers/net/ethernet/cavium/liquidio/octeon_main.h
@@ -39,6 +39,7 @@  struct octeon_device_priv {
 	/** Tasklet structures for this device. */
 	struct tasklet_struct droq_tasklet;
 	unsigned long napi_mask;
+	struct octeon_device *dev;
 /** This structure is used by NIC driver to store information required