Skip to contentSkip to conversation

lpfc 8.2.7 : Rework the worker thread

SCSI Dan Carpenter 1 participant 1 message May 15, 2015 SCSI

lore
Share & tools
lore
#0 lore raw

Hello James Smart,

The patch 5e9d9b827698: "[SCSI] lpfc 8.2.7 : Rework the worker thread" from Jun 14, 2008, leads to the following static checker warning:

	drivers/scsi/lpfc/lpfc_sli.c:9365 lpfc_sli_host_down()
	warn: test_bit() takes a bit number

drivers/scsi/lpfc/lpfc_sli.c
9357 spin_lock_irqsave(&phba->hbalock, flags);
9358 for (i = 0; i < psli->num_rings; i++) {

  9359                  pring = &psli->ring[i];
  9360                  prev_pring_flag = pring->flag;
  9361                  /* Only slow rings */
  9362                  if (pring->ringno == LPFC_ELS_RING) {
  9363                          pring->flag |= LPFC_DEFERRED_RING_EVENT;
  9364                          /* Set the lpfc data pending flag */
  9365                          set_bit(LPFC_DATA_READY, &phba->data_flags);

LPFC_DATA_READY is defined as:

#define LPFC_DATA_READY (1<<0)

The intention seems to be that we use BIT(0) but because set_bit() has a shift built in it is using BIT(1). In other words:

Good: set_bit(0, &phba->data_flags);
Bad: set_bit(BIT(0), &phba->data_flags);

This seems to be used consistently so I think it's fine, but static checkers will complain. I think this is the only ->data_flag that we use so it doesn't matter (I haven't looked very hard at this code).

9366 }
9367 /*

  9368                   * Error everything on the txq since these iocbs have not been
  9369                   * given to the FW yet.
  9370                   */

regards,
dan carpenter