diff mbox series

[13/24] aic7xxx: make BUILD_SCSIID() a function

Message ID 20220502213820.3187-14-hare@suse.de
State Superseded
Headers show
Series [01/24] csiostor: use fc_block_rport() | expand

Commit Message

Hannes Reinecke May 2, 2022, 9:38 p.m. UTC
Convert BUILD_SCSIID() into a function and add a scsi_device argument.

Signed-off-by: Hannes Reinecke <hare@suse.com>
---
 drivers/scsi/aic7xxx/aic7xxx_osm.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

Comments

kernel test robot May 3, 2022, 9:39 a.m. UTC | #1
Hi Hannes,

I love your patch! Perhaps something to improve:

[auto build test WARNING on mkp-scsi/for-next]
[also build test WARNING on jejb-scsi/for-next powerpc/next linus/master v5.18-rc5 next-20220502]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/intel-lab-lkp/linux/commits/Hannes-Reinecke/scsi-EH-rework-prep-patches-part-1/20220503-054317
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
config: arm64-randconfig-r022-20220502 (https://download.01.org/0day-ci/archive/20220503/202205031715.Eiw7By3c-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 363b3a645a1e30011cc8da624f13dac5fd915628)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install arm64 cross compiling tool for clang build
        # apt-get install binutils-aarch64-linux-gnu
        # https://github.com/intel-lab-lkp/linux/commit/5436bc0a0e277a5742af0b7b443b4591ce0e5b74
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Hannes-Reinecke/scsi-EH-rework-prep-patches-part-1/20220503-054317
        git checkout 5436bc0a0e277a5742af0b7b443b4591ce0e5b74
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash drivers/scsi/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/scsi/aic7xxx/aic7xxx_osm.c:808:24: warning: operator '?:' has lower precedence than '|'; '|' will be evaluated first [-Wbitwise-conditional-parentheses]
                   (sdev->channel == 0) ? 0 : TWIN_CHNLB;
                   ~~~~~~~~~~~~~~~~~~~~ ^
   drivers/scsi/aic7xxx/aic7xxx_osm.c:808:24: note: place parentheses around the '|' expression to silence this warning
                   (sdev->channel == 0) ? 0 : TWIN_CHNLB;
                                        ^
                                       )
   drivers/scsi/aic7xxx/aic7xxx_osm.c:808:24: note: place parentheses around the '?:' expression to evaluate it first
                   (sdev->channel == 0) ? 0 : TWIN_CHNLB;
                   ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
   1 warning generated.


vim +808 drivers/scsi/aic7xxx/aic7xxx_osm.c

   800	
   801	
   802	static inline unsigned int ahc_build_scsiid(struct ahc_softc *ahc,
   803						    struct scsi_device *sdev)
   804	{
   805		unsigned int scsiid =
   806			((sdev->id << TID_SHIFT) & TID) |
   807			((sdev->channel == 0) ? ahc->our_id : ahc->our_id_b) |
 > 808			(sdev->channel == 0) ? 0 : TWIN_CHNLB;
   809		return scsiid;
   810	}
   811
Hannes Reinecke May 3, 2022, 2:18 p.m. UTC | #2
On 5/3/22 07:12, Christoph Hellwig wrote:
>> +{
>> +	unsigned int scsiid =
>> +		((sdev->id << TID_SHIFT) & TID) |
>> +		((sdev->channel == 0) ? ahc->our_id : ahc->our_id_b) |
>> +		(sdev->channel == 0) ? 0 : TWIN_CHNLB;
>> +	return scsiid;
> 
> This still look weird.  Why not:
> 
> 	unsigned int scsiid = (sdev->id << TID_SHIFT) & TID);
> 
> 	if (sdev->channel == 0) {
> 		scsiid |= ahc->our_id;
> 	else
> 		scsiid |= ahc->our_id_b | TWIN_CHNLB;
> 	return scsiid;
> 
> ?
Yeah, kbuild had been complaining, too.

Will be fixing it up.

Cheers,

Hannes
diff mbox series

Patch

diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c
index d3b1082654d5..85fe8808399f 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c
@@ -798,11 +798,16 @@  struct scsi_host_template aic7xxx_driver_template = {
 
 /**************************** Tasklet Handler *********************************/
 
-/******************************** Macros **************************************/
-#define BUILD_SCSIID(ahc, cmd)						    \
-	((((cmd)->device->id << TID_SHIFT) & TID)			    \
-	| (((cmd)->device->channel == 0) ? (ahc)->our_id : (ahc)->our_id_b) \
-	| (((cmd)->device->channel == 0) ? 0 : TWIN_CHNLB))
+
+static inline unsigned int ahc_build_scsiid(struct ahc_softc *ahc,
+					    struct scsi_device *sdev)
+{
+	unsigned int scsiid =
+		((sdev->id << TID_SHIFT) & TID) |
+		((sdev->channel == 0) ? ahc->our_id : ahc->our_id_b) |
+		(sdev->channel == 0) ? 0 : TWIN_CHNLB;
+	return scsiid;
+}
 
 /******************************** Bus DMA *************************************/
 int
@@ -1457,7 +1462,7 @@  ahc_linux_run_command(struct ahc_softc *ahc, struct ahc_linux_device *dev,
 	 * Fill out basics of the HSCB.
 	 */
 	hscb->control = 0;
-	hscb->scsiid = BUILD_SCSIID(ahc, cmd);
+	hscb->scsiid = ahc_build_scsiid(ahc, cmd->device);
 	hscb->lun = cmd->device->lun;
 	mask = SCB_GET_TARGET_MASK(ahc, scb);
 	tinfo = ahc_fetch_transinfo(ahc, SCB_GET_CHANNEL(ahc, scb),