Skip to content

Commit 80975ad

Browse files
damien-lemoalmartinkpetersen
authored andcommitted
scsi: pm8001: Remove PM8001_READ_VPD
Remove the macro PM8001_READ_VPD used to define if a controller WWN should be retrieved from the device. Instead, define the better named boolean module parameter "read_wwn" to control this. The code to set a fixed address for a phy device address when read_wwn is set to false is simplified and fixed to avoid sparse warnings. Signed-off-by: Damien Le Moal <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 2054302 commit 80975ad

File tree

2 files changed

+28
-25
lines changed

2 files changed

+28
-25
lines changed

drivers/scsi/pm8001/pm8001_init.c

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ static bool pm8001_use_tasklet = true;
6464
module_param_named(use_tasklet, pm8001_use_tasklet, bool, 0444);
6565
MODULE_PARM_DESC(zoned, "Use MSIX interrupts. Default: true");
6666

67+
static bool pm8001_read_wwn = true;
68+
module_param_named(read_wwn, pm8001_read_wwn, bool, 0444);
69+
MODULE_PARM_DESC(zoned, "Get WWN from the controller. Default: true");
70+
6771
static struct scsi_transport_template *pm8001_stt;
6872
static int pm8001_init_ccb_tag(struct pm8001_hba_info *);
6973

@@ -683,19 +687,30 @@ static void pm8001_post_sas_ha_init(struct Scsi_Host *shost,
683687
*/
684688
static int pm8001_init_sas_add(struct pm8001_hba_info *pm8001_ha)
685689
{
686-
u8 i, j;
687-
u8 sas_add[8];
688-
#ifdef PM8001_READ_VPD
689-
/* For new SPC controllers WWN is stored in flash vpd
690-
* For SPC/SPCve controllers WWN is stored in EEPROM
691-
* For Older SPC WWN is stored in NVMD
692-
*/
693690
DECLARE_COMPLETION_ONSTACK(completion);
694691
struct pm8001_ioctl_payload payload;
692+
unsigned long time_remaining;
693+
u8 sas_add[8];
695694
u16 deviceid;
696695
int rc;
697-
unsigned long time_remaining;
696+
u8 i, j;
697+
698+
if (!pm8001_read_wwn) {
699+
__be64 dev_sas_addr = cpu_to_be64(0x50010c600047f9d0ULL);
700+
701+
for (i = 0; i < pm8001_ha->chip->n_phy; i++)
702+
memcpy(&pm8001_ha->phy[i].dev_sas_addr, &dev_sas_addr,
703+
SAS_ADDR_SIZE);
704+
memcpy(pm8001_ha->sas_addr, &pm8001_ha->phy[0].dev_sas_addr,
705+
SAS_ADDR_SIZE);
706+
return 0;
707+
}
698708

709+
/*
710+
* For new SPC controllers WWN is stored in flash vpd. For SPC/SPCve
711+
* controllers WWN is stored in EEPROM. And for Older SPC WWN is stored
712+
* in NVMD.
713+
*/
699714
if (PM8001_CHIP_DISP->fatal_errors(pm8001_ha)) {
700715
pm8001_dbg(pm8001_ha, FAIL, "controller is in fatal error state\n");
701716
return -EIO;
@@ -769,16 +784,7 @@ static int pm8001_init_sas_add(struct pm8001_hba_info *pm8001_ha)
769784
pm8001_ha->phy[i].dev_sas_addr);
770785
}
771786
kfree(payload.func_specific);
772-
#else
773-
for (i = 0; i < pm8001_ha->chip->n_phy; i++) {
774-
pm8001_ha->phy[i].dev_sas_addr = 0x50010c600047f9d0ULL;
775-
pm8001_ha->phy[i].dev_sas_addr =
776-
cpu_to_be64((u64)
777-
(*(u64 *)&pm8001_ha->phy[i].dev_sas_addr));
778-
}
779-
memcpy(pm8001_ha->sas_addr, &pm8001_ha->phy[0].dev_sas_addr,
780-
SAS_ADDR_SIZE);
781-
#endif
787+
782788
return 0;
783789
}
784790

@@ -788,13 +794,13 @@ static int pm8001_init_sas_add(struct pm8001_hba_info *pm8001_ha)
788794
*/
789795
static int pm8001_get_phy_settings_info(struct pm8001_hba_info *pm8001_ha)
790796
{
791-
792-
#ifdef PM8001_READ_VPD
793-
/*OPTION ROM FLASH read for the SPC cards */
794797
DECLARE_COMPLETION_ONSTACK(completion);
795798
struct pm8001_ioctl_payload payload;
796799
int rc;
797800

801+
if (!pm8001_read_wwn)
802+
return 0;
803+
798804
pm8001_ha->nvmd_completion = &completion;
799805
/* SAS ADDRESS read from flash / EEPROM */
800806
payload.minor_function = 6;
@@ -813,7 +819,7 @@ static int pm8001_get_phy_settings_info(struct pm8001_hba_info *pm8001_ha)
813819
wait_for_completion(&completion);
814820
pm8001_set_phy_profile(pm8001_ha, sizeof(u8), payload.func_specific);
815821
kfree(payload.func_specific);
816-
#endif
822+
817823
return 0;
818824
}
819825

drivers/scsi/pm8001/pm8001_sas.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,6 @@ do { \
8585

8686
extern bool pm8001_use_msix;
8787

88-
#define PM8001_READ_VPD
89-
90-
9188
#define IS_SPCV_12G(dev) ((dev->device == 0X8074) \
9289
|| (dev->device == 0X8076) \
9390
|| (dev->device == 0X8077) \

0 commit comments

Comments
 (0)