hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/scsi/bfa/bfa_ioc.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
34 * Copyright (c) 2014- QLogic Corporation.
....@@ -5,15 +6,6 @@
56 * www.qlogic.com
67 *
78 * Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
8
- *
9
- * This program is free software; you can redistribute it and/or modify it
10
- * under the terms of the GNU General Public License (GPL) Version 2 as
11
- * published by the Free Software Foundation
12
- *
13
- * This program is distributed in the hope that it will be useful, but
14
- * WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
- * General Public License for more details.
179 */
1810
1911 #include "bfad_drv.h"
....@@ -709,7 +701,7 @@
709701 bfa_iocpf_sm_fwcheck_entry(struct bfa_iocpf_s *iocpf)
710702 {
711703 struct bfi_ioc_image_hdr_s fwhdr;
712
- u32 r32, fwstate, pgnum, pgoff, loff = 0;
704
+ u32 r32, fwstate, pgnum, loff = 0;
713705 int i;
714706
715707 /*
....@@ -739,7 +731,6 @@
739731 * Clear fwver hdr
740732 */
741733 pgnum = PSS_SMEM_PGNUM(iocpf->ioc->ioc_regs.smem_pg0, loff);
742
- pgoff = PSS_SMEM_PGOFF(loff);
743734 writel(pgnum, iocpf->ioc->ioc_regs.host_page_num_fn);
744735
745736 for (i = 0; i < sizeof(struct bfi_ioc_image_hdr_s) / sizeof(u32); i++) {
....@@ -978,9 +969,7 @@
978969
979970 case IOCPF_E_INITFAIL:
980971 bfa_iocpf_timer_stop(ioc);
981
- /*
982
- * !!! fall through !!!
983
- */
972
+ fallthrough;
984973
985974 case IOCPF_E_TIMEOUT:
986975 writel(1, ioc->ioc_regs.ioc_sem_reg);
....@@ -1056,9 +1045,7 @@
10561045
10571046 case IOCPF_E_FAIL:
10581047 bfa_iocpf_timer_stop(ioc);
1059
- /*
1060
- * !!! fall through !!!
1061
- */
1048
+ fallthrough;
10621049
10631050 case IOCPF_E_TIMEOUT:
10641051 bfa_ioc_set_cur_ioc_fwstate(ioc, BFI_IOC_FAIL);
....@@ -1452,13 +1439,12 @@
14521439 void
14531440 bfa_ioc_fwver_get(struct bfa_ioc_s *ioc, struct bfi_ioc_image_hdr_s *fwhdr)
14541441 {
1455
- u32 pgnum, pgoff;
1442
+ u32 pgnum;
14561443 u32 loff = 0;
14571444 int i;
14581445 u32 *fwsig = (u32 *) fwhdr;
14591446
14601447 pgnum = PSS_SMEM_PGNUM(ioc->ioc_regs.smem_pg0, loff);
1461
- pgoff = PSS_SMEM_PGOFF(loff);
14621448 writel(pgnum, ioc->ioc_regs.host_page_num_fn);
14631449
14641450 for (i = 0; i < (sizeof(struct bfi_ioc_image_hdr_s) / sizeof(u32));
....@@ -1674,7 +1660,7 @@
16741660 bfa_ioc_fwsig_invalidate(struct bfa_ioc_s *ioc)
16751661 {
16761662
1677
- u32 pgnum, pgoff;
1663
+ u32 pgnum;
16781664 u32 loff = 0;
16791665 enum bfi_ioc_state ioc_fwstate;
16801666
....@@ -1683,7 +1669,6 @@
16831669 return BFA_STATUS_ADAPTER_ENABLED;
16841670
16851671 pgnum = PSS_SMEM_PGNUM(ioc->ioc_regs.smem_pg0, loff);
1686
- pgoff = PSS_SMEM_PGOFF(loff);
16871672 writel(pgnum, ioc->ioc_regs.host_page_num_fn);
16881673 bfa_mem_write(ioc->ioc_regs.smem_page_start, loff, BFA_IOC_FW_INV_SIGN);
16891674
....@@ -1875,7 +1860,7 @@
18751860 u32 boot_env)
18761861 {
18771862 u32 *fwimg;
1878
- u32 pgnum, pgoff;
1863
+ u32 pgnum;
18791864 u32 loff = 0;
18801865 u32 chunkno = 0;
18811866 u32 i;
....@@ -1904,8 +1889,6 @@
19041889
19051890
19061891 pgnum = PSS_SMEM_PGNUM(ioc->ioc_regs.smem_pg0, loff);
1907
- pgoff = PSS_SMEM_PGOFF(loff);
1908
-
19091892 writel(pgnum, ioc->ioc_regs.host_page_num_fn);
19101893
19111894 for (i = 0; i < fwimg_size; i++) {
....@@ -3819,7 +3802,7 @@
38193802 sfp->state = BFA_SFP_STATE_REMOVED;
38203803 sfp->data_valid = 0;
38213804 bfa_sfp_scn_aen_post(sfp, rsp);
3822
- break;
3805
+ break;
38233806 case BFA_SFP_SCN_FAILED:
38243807 sfp->state = BFA_SFP_STATE_FAILED;
38253808 sfp->data_valid = 0;
....@@ -4775,11 +4758,9 @@
47754758 struct bfa_ioc_s *ioc = diag->ioc;
47764759 struct bfa_diag_memtest_result *res = diag->result;
47774760 u32 loff = BFI_BOOT_MEMTEST_RES_ADDR;
4778
- u32 pgnum, pgoff, i;
4761
+ u32 pgnum, i;
47794762
47804763 pgnum = PSS_SMEM_PGNUM(ioc->ioc_regs.smem_pg0, loff);
4781
- pgoff = PSS_SMEM_PGOFF(loff);
4782
-
47834764 writel(pgnum, ioc->ioc_regs.host_page_num_fn);
47844765
47854766 for (i = 0; i < (sizeof(struct bfa_diag_memtest_result) /
....@@ -5038,7 +5019,7 @@
50385019 /*
50395020 * Diag hmbox handler
50405021 */
5041
-void
5022
+static void
50425023 bfa_diag_intr(void *diagarg, struct bfi_mbmsg_s *msg)
50435024 {
50445025 struct bfa_diag_s *diag = diagarg;
....@@ -5763,7 +5744,7 @@
57635744 (struct bfa_phy_stats_s *) phy->ubuf;
57645745 bfa_phy_ntoh32((u32 *)stats, (u32 *)phy->dbuf_kva,
57655746 sizeof(struct bfa_phy_stats_s));
5766
- bfa_trc(phy, stats->status);
5747
+ bfa_trc(phy, stats->status);
57675748 }
57685749
57695750 phy->status = status;
....@@ -6007,6 +5988,7 @@
60075988 case BFA_DCONF_SM_IOCDISABLE:
60085989 case BFA_DCONF_SM_FLASH_COMP:
60095990 bfa_timer_stop(&dconf->timer);
5991
+ fallthrough;
60105992 case BFA_DCONF_SM_TIMEOUT:
60115993 bfa_sm_set_state(dconf, bfa_dconf_sm_uninit);
60125994 bfa_fsm_send_event(&dconf->bfa->iocfc, IOCFC_E_DCONF_DONE);
....@@ -6660,8 +6642,8 @@
66606642 BFA_FLASH_READ_STATUS = 0x05, /* read status */
66616643 };
66626644
6663
-/**
6664
- * @brief hardware error definition
6645
+/*
6646
+ * Hardware error definition
66656647 */
66666648 enum bfa_flash_err {
66676649 BFA_FLASH_NOT_PRESENT = -1, /*!< flash not present */
....@@ -6675,8 +6657,8 @@
66756657 BFA_FLASH_ERR_LEN = -9, /*!< invalid length */
66766658 };
66776659
6678
-/**
6679
- * @brief flash command register data structure
6660
+/*
6661
+ * Flash command register data structure
66806662 */
66816663 union bfa_flash_cmd_reg_u {
66826664 struct {
....@@ -6699,8 +6681,8 @@
66996681 u32 i;
67006682 };
67016683
6702
-/**
6703
- * @brief flash device status register data structure
6684
+/*
6685
+ * Flash device status register data structure
67046686 */
67056687 union bfa_flash_dev_status_reg_u {
67066688 struct {
....@@ -6725,8 +6707,8 @@
67256707 u32 i;
67266708 };
67276709
6728
-/**
6729
- * @brief flash address register data structure
6710
+/*
6711
+ * Flash address register data structure
67306712 */
67316713 union bfa_flash_addr_reg_u {
67326714 struct {
....@@ -6741,7 +6723,7 @@
67416723 u32 i;
67426724 };
67436725
6744
-/**
6726
+/*
67456727 * dg flash_raw_private Flash raw private functions
67466728 */
67476729 static void
....@@ -6782,7 +6764,7 @@
67826764 return 0;
67836765 }
67846766
6785
-/**
6767
+/*
67866768 * @brief
67876769 * Flush FLI data fifo.
67886770 *
....@@ -6795,7 +6777,6 @@
67956777 bfa_flash_fifo_flush(void __iomem *pci_bar)
67966778 {
67976779 u32 i;
6798
- u32 t;
67996780 union bfa_flash_dev_status_reg_u dev_status;
68006781
68016782 dev_status.i = readl(pci_bar + FLI_DEV_STATUS_REG);
....@@ -6805,7 +6786,7 @@
68056786
68066787 /* fifo counter in terms of words */
68076788 for (i = 0; i < dev_status.r.fifo_cnt; i++)
6808
- t = readl(pci_bar + FLI_RDDATA_REG);
6789
+ readl(pci_bar + FLI_RDDATA_REG);
68096790
68106791 /*
68116792 * Check the device status. It may take some time.
....@@ -6822,7 +6803,7 @@
68226803 return 0;
68236804 }
68246805
6825
-/**
6806
+/*
68266807 * @brief
68276808 * Read flash status.
68286809 *
....@@ -6867,7 +6848,7 @@
68676848 return ret_status;
68686849 }
68696850
6870
-/**
6851
+/*
68716852 * @brief
68726853 * Start flash read operation.
68736854 *
....@@ -6913,7 +6894,7 @@
69136894 return 0;
69146895 }
69156896
6916
-/**
6897
+/*
69176898 * @brief
69186899 * Check flash read operation.
69196900 *
....@@ -6929,7 +6910,8 @@
69296910
69306911 return 0;
69316912 }
6932
-/**
6913
+
6914
+/*
69336915 * @brief
69346916 * End flash read operation.
69356917 *
....@@ -6955,7 +6937,7 @@
69556937 bfa_flash_fifo_flush(pci_bar);
69566938 }
69576939
6958
-/**
6940
+/*
69596941 * @brief
69606942 * Perform flash raw read.
69616943 *
....@@ -6981,7 +6963,7 @@
69816963
69826964 }
69836965
6984
-bfa_status_t
6966
+static bfa_status_t
69856967 bfa_flash_sem_get(void __iomem *bar)
69866968 {
69876969 u32 n = FLASH_BLOCKING_OP_MAX;
....@@ -6994,7 +6976,7 @@
69946976 return BFA_STATUS_OK;
69956977 }
69966978
6997
-void
6979
+static void
69986980 bfa_flash_sem_put(void __iomem *bar)
69996981 {
70006982 writel(0, (bar + FLASH_SEM_LOCK_REG));