diff mbox series

[v2,12/21] scsi: pm8001: Convert timeouts to secs_to_jiffies()

Message ID 20241115-converge-secs-to-jiffies-v2-12-911fb7595e79@linux.microsoft.com (mailing list archive)
State Not Applicable
Headers show
Series Converge on using secs_to_jiffies() | expand

Checks

Context Check Description
netdev/series_format fail Series longer than 15 patches
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit fail Errors and warnings before: 45 this patch: 48
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 4 of 4 maintainers
netdev/build_clang fail Errors and warnings before: 74 this patch: 78
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn fail Errors and warnings before: 51 this patch: 54
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 15 this patch: 15
netdev/source_inline success Was 0 now: 0

Commit Message

Easwar Hariharan Nov. 15, 2024, 9:26 p.m. UTC
Changes made with the following Coccinelle rules:

@@ constant C; @@

- msecs_to_jiffies(C * 1000)
+ secs_to_jiffies(C)

@@ constant C; @@

- msecs_to_jiffies(C * MSEC_PER_SEC)
+ secs_to_jiffies(C)

Signed-off-by: Easwar Hariharan <eahariha@linux.microsoft.com>
---
 drivers/scsi/pm8001/pm8001_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

kernel test robot Nov. 17, 2024, 6:24 p.m. UTC | #1
Hi Easwar,

kernel test robot noticed the following build errors:

[auto build test ERROR on 2d5404caa8c7bb5c4e0435f94b28834ae5456623]

url:    https://github.com/intel-lab-lkp/linux/commits/Easwar-Hariharan/netfilter-conntrack-Cleanup-timeout-definitions/20241117-003530
base:   2d5404caa8c7bb5c4e0435f94b28834ae5456623
patch link:    https://lore.kernel.org/r/20241115-converge-secs-to-jiffies-v2-12-911fb7595e79%40linux.microsoft.com
patch subject: [PATCH v2 12/21] scsi: pm8001: Convert timeouts to secs_to_jiffies()
config: x86_64-kexec (https://download.01.org/0day-ci/archive/20241118/202411180252.N1NjfHcR-lkp@intel.com/config)
compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241118/202411180252.N1NjfHcR-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202411180252.N1NjfHcR-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from drivers/scsi/pm8001/pm8001_init.c:42:
   In file included from drivers/scsi/pm8001/pm8001_sas.h:50:
   In file included from include/linux/dma-mapping.h:11:
   In file included from include/linux/scatterlist.h:8:
   In file included from include/linux/mm.h:2213:
   include/linux/vmstat.h:504:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     504 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     505 |                            item];
         |                            ~~~~
   include/linux/vmstat.h:511:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     511 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     512 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     518 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
   include/linux/vmstat.h:524:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     524 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     525 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
>> drivers/scsi/pm8001/pm8001_init.c:737:5: error: call to undeclared function 'secs_to_jiffies'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     737 |                                 secs_to_jiffies(60)); // 1 min
         |                                 ^
   4 warnings and 1 error generated.


vim +/secs_to_jiffies +737 drivers/scsi/pm8001/pm8001_init.c

   665	
   666	/**
   667	 * pm8001_init_sas_add - initialize sas address
   668	 * @pm8001_ha: our ha struct.
   669	 *
   670	 * Currently we just set the fixed SAS address to our HBA, for manufacture,
   671	 * it should read from the EEPROM
   672	 */
   673	static int pm8001_init_sas_add(struct pm8001_hba_info *pm8001_ha)
   674	{
   675		DECLARE_COMPLETION_ONSTACK(completion);
   676		struct pm8001_ioctl_payload payload;
   677		unsigned long time_remaining;
   678		u8 sas_add[8];
   679		u16 deviceid;
   680		int rc;
   681		u8 i, j;
   682	
   683		if (!pm8001_read_wwn) {
   684			__be64 dev_sas_addr = cpu_to_be64(0x50010c600047f9d0ULL);
   685	
   686			for (i = 0; i < pm8001_ha->chip->n_phy; i++)
   687				memcpy(&pm8001_ha->phy[i].dev_sas_addr, &dev_sas_addr,
   688				       SAS_ADDR_SIZE);
   689			memcpy(pm8001_ha->sas_addr, &pm8001_ha->phy[0].dev_sas_addr,
   690			       SAS_ADDR_SIZE);
   691			return 0;
   692		}
   693	
   694		/*
   695		 * For new SPC controllers WWN is stored in flash vpd. For SPC/SPCve
   696		 * controllers WWN is stored in EEPROM. And for Older SPC WWN is stored
   697		 * in NVMD.
   698		 */
   699		if (PM8001_CHIP_DISP->fatal_errors(pm8001_ha)) {
   700			pm8001_dbg(pm8001_ha, FAIL, "controller is in fatal error state\n");
   701			return -EIO;
   702		}
   703	
   704		pci_read_config_word(pm8001_ha->pdev, PCI_DEVICE_ID, &deviceid);
   705		pm8001_ha->nvmd_completion = &completion;
   706	
   707		if (pm8001_ha->chip_id == chip_8001) {
   708			if (deviceid == 0x8081 || deviceid == 0x0042) {
   709				payload.minor_function = 4;
   710				payload.rd_length = 4096;
   711			} else {
   712				payload.minor_function = 0;
   713				payload.rd_length = 128;
   714			}
   715		} else if ((pm8001_ha->chip_id == chip_8070 ||
   716				pm8001_ha->chip_id == chip_8072) &&
   717				pm8001_ha->pdev->subsystem_vendor == PCI_VENDOR_ID_ATTO) {
   718			payload.minor_function = 4;
   719			payload.rd_length = 4096;
   720		} else {
   721			payload.minor_function = 1;
   722			payload.rd_length = 4096;
   723		}
   724		payload.offset = 0;
   725		payload.func_specific = kzalloc(payload.rd_length, GFP_KERNEL);
   726		if (!payload.func_specific) {
   727			pm8001_dbg(pm8001_ha, FAIL, "mem alloc fail\n");
   728			return -ENOMEM;
   729		}
   730		rc = PM8001_CHIP_DISP->get_nvmd_req(pm8001_ha, &payload);
   731		if (rc) {
   732			kfree(payload.func_specific);
   733			pm8001_dbg(pm8001_ha, FAIL, "nvmd failed\n");
   734			return -EIO;
   735		}
   736		time_remaining = wait_for_completion_timeout(&completion,
 > 737					secs_to_jiffies(60)); // 1 min
   738		if (!time_remaining) {
   739			kfree(payload.func_specific);
   740			pm8001_dbg(pm8001_ha, FAIL, "get_nvmd_req timeout\n");
   741			return -EIO;
   742		}
   743	
   744	
   745		for (i = 0, j = 0; i <= 7; i++, j++) {
   746			if (pm8001_ha->chip_id == chip_8001) {
   747				if (deviceid == 0x8081)
   748					pm8001_ha->sas_addr[j] =
   749						payload.func_specific[0x704 + i];
   750				else if (deviceid == 0x0042)
   751					pm8001_ha->sas_addr[j] =
   752						payload.func_specific[0x010 + i];
   753			} else if ((pm8001_ha->chip_id == chip_8070 ||
   754					pm8001_ha->chip_id == chip_8072) &&
   755					pm8001_ha->pdev->subsystem_vendor == PCI_VENDOR_ID_ATTO) {
   756				pm8001_ha->sas_addr[j] =
   757						payload.func_specific[0x010 + i];
   758			} else
   759				pm8001_ha->sas_addr[j] =
   760						payload.func_specific[0x804 + i];
   761		}
   762		memcpy(sas_add, pm8001_ha->sas_addr, SAS_ADDR_SIZE);
   763		for (i = 0; i < pm8001_ha->chip->n_phy; i++) {
   764			if (i && ((i % 4) == 0))
   765				sas_add[7] = sas_add[7] + 4;
   766			memcpy(&pm8001_ha->phy[i].dev_sas_addr,
   767				sas_add, SAS_ADDR_SIZE);
   768			pm8001_dbg(pm8001_ha, INIT, "phy %d sas_addr = %016llx\n", i,
   769				   pm8001_ha->phy[i].dev_sas_addr);
   770		}
   771		kfree(payload.func_specific);
   772	
   773		return 0;
   774	}
   775
diff mbox series

Patch

diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c
index 33e1eba62ca12c2555419197ecdbebad817e4a6d..be88890716cc152b4687edf5e204d14bd177e188 100644
--- a/drivers/scsi/pm8001/pm8001_init.c
+++ b/drivers/scsi/pm8001/pm8001_init.c
@@ -734,7 +734,7 @@  static int pm8001_init_sas_add(struct pm8001_hba_info *pm8001_ha)
 		return -EIO;
 	}
 	time_remaining = wait_for_completion_timeout(&completion,
-				msecs_to_jiffies(60*1000)); // 1 min
+				secs_to_jiffies(60)); // 1 min
 	if (!time_remaining) {
 		kfree(payload.func_specific);
 		pm8001_dbg(pm8001_ha, FAIL, "get_nvmd_req timeout\n");