net/sfc: start to make MCDI helpers interface shareable
authorAndrew Rybchenko <arybchenko@solarflare.com>
Thu, 17 Sep 2020 06:34:35 +0000 (07:34 +0100)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 30 Sep 2020 17:19:08 +0000 (19:19 +0200)
sfc_adapter is network driver specific structure which finally
should not be used in shared MCDI helpers interface.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
drivers/net/sfc/sfc_mcdi.c

index c716caa..35e1f39 100644 (file)
@@ -248,17 +248,14 @@ sfc_efx_mcdi_ev_proxy_response(void *arg, uint32_t handle, efx_rc_t result)
 }
 
 static int
-sfc_efx_mcdi_init(struct sfc_adapter *sa)
+sfc_efx_mcdi_init(struct sfc_adapter *sa, struct sfc_efx_mcdi *mcdi)
 {
-       struct sfc_efx_mcdi *mcdi;
        size_t max_msg_size;
        efx_mcdi_transport_t *emtp;
        int rc;
 
        sfc_log_init(sa, "entry");
 
-       mcdi = &sa->mcdi;
-
        SFC_ASSERT(mcdi->state == SFC_EFX_MCDI_UNINITIALIZED);
 
        rte_spinlock_init(&mcdi->lock);
@@ -301,14 +298,12 @@ fail_dma_alloc:
 }
 
 static void
-sfc_efx_mcdi_fini(struct sfc_adapter *sa)
+sfc_efx_mcdi_fini(struct sfc_adapter *sa, struct sfc_efx_mcdi *mcdi)
 {
-       struct sfc_efx_mcdi *mcdi;
        efx_mcdi_transport_t *emtp;
 
        sfc_log_init(sa, "entry");
 
-       mcdi = &sa->mcdi;
        emtp = &mcdi->transport;
 
        rte_spinlock_lock(&mcdi->lock);
@@ -328,11 +323,11 @@ sfc_efx_mcdi_fini(struct sfc_adapter *sa)
 int
 sfc_mcdi_init(struct sfc_adapter *sa)
 {
-       return sfc_efx_mcdi_init(sa);
+       return sfc_efx_mcdi_init(sa, &sa->mcdi);
 }
 
 void
 sfc_mcdi_fini(struct sfc_adapter *sa)
 {
-       sfc_efx_mcdi_fini(sa);
+       sfc_efx_mcdi_fini(sa, &sa->mcdi);
 }