Justus Winter, le Mon 06 Jan 2014 00:34:53 +0100, a écrit : > The pattern is !x&y. An expression of this form is almost always > meaningless, because it combines a boolean operator with a bit > operator. In particular, if the rightmost bit of y is 0, the result > will always be 0. > > Fixed using coccinelle. > > // !x&y combines boolean negation with bitwise and > // > // Confidence: High > // Copyright: (C) Gilles Muller, Julia Lawall, EMN, DIKU. GPLv2. > // URL: http://www.emn.fr/x-info/coccinelle/rules/notand.html > // Options: > > @@ expression E1,E2; @@ > ( > !E1 & !E2 > | > - !E1 & E2 > + !(E1 & E2) > ) > > * linux/src/drivers/scsi/FlashPoint.c: Fix bit tests.
Ack, and ditto. > --- > linux/src/drivers/scsi/FlashPoint.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/linux/src/drivers/scsi/FlashPoint.c > b/linux/src/drivers/scsi/FlashPoint.c > index 4b96a66..8d2f102 100644 > --- a/linux/src/drivers/scsi/FlashPoint.c > +++ b/linux/src/drivers/scsi/FlashPoint.c > @@ -3756,17 +3756,17 @@ STATIC int SetDevSyncRate(PSCCBcard pCurrCard, PUCB > p_ucb) > } > if(currTar_Info->TarEEValue && EE_SYNC_MASK == syncVal) > return(0); > - currTar_Info->TarEEValue = (currTar_Info->TarEEValue & !EE_SYNC_MASK) > + currTar_Info->TarEEValue = (!(EE_SYNC_MASK & currTar_Info->TarEEValue)) > > | syncVal; > syncOffset = (SYNC_RATE_TBL + scsiID) / 2; > temp2.tempw = utilEERead(ioPort, syncOffset); > if(scsiID & 0x01) > { > - temp2.tempb[0] = (temp2.tempb[0] & !EE_SYNC_MASK) | syncVal; > + temp2.tempb[0] = (!(EE_SYNC_MASK & temp2.tempb[0])) | syncVal; > } > else > { > - temp2.tempb[1] = (temp2.tempb[1] & !EE_SYNC_MASK) | syncVal; > + temp2.tempb[1] = (!(EE_SYNC_MASK & temp2.tempb[1])) | syncVal; > } > utilEEWriteOnOff(ioPort, 1); > utilEEWrite(ioPort, temp2.tempw, syncOffset); > @@ -3854,18 +3854,18 @@ int SetDevWideMode(PSCCBcard pCurrCard,PUCB p_ucb) > scsiWideMode = 0; > } > } > - currTar_Info->TarEEValue = (currTar_Info->TarEEValue & !EE_WIDE_SCSI) > + currTar_Info->TarEEValue = (!(EE_WIDE_SCSI & currTar_Info->TarEEValue)) > > | scsiWideMode; > > syncOffset = (SYNC_RATE_TBL + scsiID) / 2; > temp2.tempw = utilEERead(ioPort, syncOffset); > if(scsiID & 0x01) > { > - temp2.tempb[0] = (temp2.tempb[0] & !EE_WIDE_SCSI) | > scsiWideMode; > + temp2.tempb[0] = (!(EE_WIDE_SCSI & temp2.tempb[0])) | > scsiWideMode; > } > else > { > - temp2.tempb[1] = (temp2.tempb[1] & !EE_WIDE_SCSI) | > scsiWideMode; > + temp2.tempb[1] = (!(EE_WIDE_SCSI & temp2.tempb[1])) | > scsiWideMode; > } > utilEEWriteOnOff(ioPort, 1); > utilEEWrite(ioPort, temp2.tempw, syncOffset); > -- > 1.8.5.2 > -- Samuel <Raize> can you guys see what I type? <vecna> no, raize <Raize> How do I set it up so you can see it?