Calling rte_cryptodev_pmd_get_named_dev() is enough to retrieve the
crypto device object.

This leaves no user of the cryptodev field in the fslmc device object.

Signed-off-by: David Marchand <[email protected]>
---
 drivers/bus/fslmc/bus_fslmc_driver.h        | 1 -
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 8 +++++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/bus/fslmc/bus_fslmc_driver.h 
b/drivers/bus/fslmc/bus_fslmc_driver.h
index b6a6238a01..45c7a519f9 100644
--- a/drivers/bus/fslmc/bus_fslmc_driver.h
+++ b/drivers/bus/fslmc/bus_fslmc_driver.h
@@ -99,7 +99,6 @@ struct rte_dpaa2_device {
        struct rte_device device;           /**< Inherit core device */
        union {
                struct rte_eth_dev *eth_dev;        /**< ethernet device */
-               struct rte_cryptodev *cryptodev;    /**< Crypto Device */
                struct rte_dma_dev *dmadev;          /**< DMA Device */
                struct rte_rawdev *rawdev;          /**< Raw Device */
        };
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c 
b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index ca10d88da7..698548e6ea 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -4503,8 +4503,6 @@ cryptodev_dpaa2_sec_probe(struct rte_dpaa2_driver 
*dpaa2_drv __rte_unused,
                return -ENOMEM;
        }
 
-       dpaa2_dev->cryptodev = cryptodev;
-
        if (dpaa2_svr_family == SVR_LX2160A)
                rta_set_sec_era(RTA_SEC_ERA_10);
        else
@@ -4526,10 +4524,14 @@ cryptodev_dpaa2_sec_probe(struct rte_dpaa2_driver 
*dpaa2_drv __rte_unused,
 static int
 cryptodev_dpaa2_sec_remove(struct rte_dpaa2_device *dpaa2_dev)
 {
+       char cryptodev_name[RTE_CRYPTODEV_NAME_MAX_LEN];
        struct rte_cryptodev *cryptodev;
        int ret;
 
-       cryptodev = dpaa2_dev->cryptodev;
+       snprintf(cryptodev_name, sizeof(cryptodev_name), "dpsec-%d",
+                       dpaa2_dev->object_id);
+
+       cryptodev = rte_cryptodev_pmd_get_named_dev(cryptodev_name);
        if (cryptodev == NULL)
                return -ENODEV;
 
-- 
2.51.0

Reply via email to