Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

scsi: qla2xxx: Introduce qla2x00_els_dcmd2_free()

This patch reduces code duplication.

Cc: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Tested-by: Himanshu Madhani <hmadhani@marvell.com>
Reviewed-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Bart Van Assche and committed by
Martin K. Petersen
c6e58160 897def20

+21 -35
+1 -1
drivers/scsi/qla2xxx/qla_def.h
··· 455 455 struct els_logo_payload *els_logo_pyld; 456 456 dma_addr_t els_logo_pyld_dma; 457 457 } els_logo; 458 - struct { 458 + struct els_plogi { 459 459 #define ELS_DCMD_PLOGI 0x3 460 460 uint32_t flags; 461 461 uint32_t els_cmd;
+2
drivers/scsi/qla2xxx/qla_gbl.h
··· 45 45 46 46 extern int qla24xx_els_dcmd_iocb(scsi_qla_host_t *, int, port_id_t); 47 47 extern int qla24xx_els_dcmd2_iocb(scsi_qla_host_t *, int, fc_port_t *, bool); 48 + extern void qla2x00_els_dcmd2_free(scsi_qla_host_t *vha, 49 + struct els_plogi *els_plogi); 48 50 49 51 extern void qla2x00_update_fcports(scsi_qla_host_t *); 50 52
+1 -11
drivers/scsi/qla2xxx/qla_gs.c
··· 3119 3119 3120 3120 switch (sp->type) { 3121 3121 case SRB_ELS_DCMD: 3122 - if (c->u.els_plogi.els_plogi_pyld) 3123 - dma_free_coherent(&vha->hw->pdev->dev, 3124 - c->u.els_plogi.tx_size, 3125 - c->u.els_plogi.els_plogi_pyld, 3126 - c->u.els_plogi.els_plogi_pyld_dma); 3127 - 3128 - if (c->u.els_plogi.els_resp_pyld) 3129 - dma_free_coherent(&vha->hw->pdev->dev, 3130 - c->u.els_plogi.rx_size, 3131 - c->u.els_plogi.els_resp_pyld, 3132 - c->u.els_plogi.els_resp_pyld_dma); 3122 + qla2x00_els_dcmd2_free(vha, &c->u.els_plogi); 3133 3123 break; 3134 3124 case SRB_CT_PTHRU_CMD: 3135 3125 default:
+17 -23
drivers/scsi/qla2xxx/qla_iocb.c
··· 2717 2717 sp->done(sp, QLA_FUNCTION_TIMEOUT); 2718 2718 } 2719 2719 2720 + void qla2x00_els_dcmd2_free(scsi_qla_host_t *vha, struct els_plogi *els_plogi) 2721 + { 2722 + if (els_plogi->els_plogi_pyld) 2723 + dma_free_coherent(&vha->hw->pdev->dev, 2724 + els_plogi->tx_size, 2725 + els_plogi->els_plogi_pyld, 2726 + els_plogi->els_plogi_pyld_dma); 2727 + 2728 + if (els_plogi->els_resp_pyld) 2729 + dma_free_coherent(&vha->hw->pdev->dev, 2730 + els_plogi->rx_size, 2731 + els_plogi->els_resp_pyld, 2732 + els_plogi->els_resp_pyld_dma); 2733 + } 2734 + 2720 2735 static void qla2x00_els_dcmd2_sp_done(srb_t *sp, int res) 2721 2736 { 2722 2737 fc_port_t *fcport = sp->fcport; ··· 2763 2748 if (!e) { 2764 2749 struct srb_iocb *elsio = &sp->u.iocb_cmd; 2765 2750 2766 - if (elsio->u.els_plogi.els_plogi_pyld) 2767 - dma_free_coherent(&sp->vha->hw->pdev->dev, 2768 - elsio->u.els_plogi.tx_size, 2769 - elsio->u.els_plogi.els_plogi_pyld, 2770 - elsio->u.els_plogi.els_plogi_pyld_dma); 2771 - 2772 - if (elsio->u.els_plogi.els_resp_pyld) 2773 - dma_free_coherent(&sp->vha->hw->pdev->dev, 2774 - elsio->u.els_plogi.rx_size, 2775 - elsio->u.els_plogi.els_resp_pyld, 2776 - elsio->u.els_plogi.els_resp_pyld_dma); 2751 + qla2x00_els_dcmd2_free(vha, &elsio->u.els_plogi); 2777 2752 sp->free(sp); 2778 2753 return; 2779 2754 } ··· 2863 2858 2864 2859 out: 2865 2860 fcport->flags &= ~(FCF_ASYNC_SENT); 2866 - if (elsio->u.els_plogi.els_plogi_pyld) 2867 - dma_free_coherent(&sp->vha->hw->pdev->dev, 2868 - elsio->u.els_plogi.tx_size, 2869 - elsio->u.els_plogi.els_plogi_pyld, 2870 - elsio->u.els_plogi.els_plogi_pyld_dma); 2871 - 2872 - if (elsio->u.els_plogi.els_resp_pyld) 2873 - dma_free_coherent(&sp->vha->hw->pdev->dev, 2874 - elsio->u.els_plogi.rx_size, 2875 - elsio->u.els_plogi.els_resp_pyld, 2876 - elsio->u.els_plogi.els_resp_pyld_dma); 2877 - 2861 + qla2x00_els_dcmd2_free(vha, &elsio->u.els_plogi); 2878 2862 sp->free(sp); 2879 2863 done: 2880 2864 return rval;