diff mbox series

[v2,06/16] bus/fslmc: limit pthread destructor called for dpaa2 only

Message ID 20200306095742.18080-7-hemant.agrawal@nxp.com
State New
Headers show
Series NXP DPAAx fixes and enhancements | expand

Commit Message

Hemant Agrawal March 6, 2020, 9:57 a.m. UTC
From: Nipun Gupta <nipun.gupta@nxp.com>


The destructor was being called for non-dpaa2 as well

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>

---
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

-- 
2.17.1
diff mbox series

Patch

diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
index 1a1453ea3..054d45306 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
@@ -299,6 +299,13 @@  static struct dpaa2_dpio_dev *dpaa2_get_qbman_swp(void)
 		return NULL;
 	}
 
+	ret = pthread_setspecific(dpaa2_portal_key, (void *)dpio_dev);
+	if (ret) {
+		DPAA2_BUS_ERR("pthread_setspecific failed with ret: %d", ret);
+		dpaa2_put_qbman_swp(dpio_dev);
+		return NULL;
+	}
+
 	return dpio_dev;
 }
 
@@ -346,12 +353,14 @@  dpaa2_affine_qbman_ethrx_swp(void)
 	return 0;
 }
 
-static void __attribute__((destructor(102))) dpaa2_portal_finish(void *arg)
+static void dpaa2_portal_finish(void *arg)
 {
 	RTE_SET_USED(arg);
 
 	dpaa2_put_qbman_swp(RTE_PER_LCORE(_dpaa2_io).dpio_dev);
 	dpaa2_put_qbman_swp(RTE_PER_LCORE(_dpaa2_io).ethrx_dpio_dev);
+
+	pthread_setspecific(dpaa2_portal_key, NULL);
 }
 
 /*