]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
scsi: bfa: Convert bfad_reset_sdev_bflags() from a macro into a function
authorBart Van Assche <bvanassche@acm.org>
Mon, 31 Oct 2022 22:47:27 +0000 (15:47 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 8 Nov 2022 03:34:39 +0000 (03:34 +0000)
Before modifying bfad_reset_sdev_bflags(), convert it from a macro into a
function.

Cc: Anil Gurumurthy <anil.gurumurthy@qlogic.com>
Cc: Sudarsana Kalluru <sudarsana.kalluru@qlogic.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20221031224728.2607760-4-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/bfa/bfad_bsg.c
drivers/scsi/bfa/bfad_im.h

index be8dfbe13e904e057e5f007550b47b557251cb7b..73754032e25c09f7c634639db71ecf56a7563b46 100644 (file)
@@ -2540,6 +2540,33 @@ out:
        return 0;
 }
 
+/*
+ * Set the SCSI device sdev_bflags - sdev_bflags are used by the
+ * SCSI mid-layer to choose LUN Scanning mode REPORT_LUNS vs. Sequential Scan
+ *
+ * Internally iterates over all the ITNIM's part of the im_port & sets the
+ * sdev_bflags for the scsi_device associated with LUN #0.
+ */
+static void bfad_reset_sdev_bflags(struct bfad_im_port_s *im_port,
+                                  int lunmask_cfg)
+{
+       const u32 scan_flags = BLIST_NOREPORTLUN | BLIST_SPARSELUN;
+       struct bfad_itnim_s *itnim;
+       struct scsi_device *sdev;
+
+       list_for_each_entry(itnim, &im_port->itnim_mapped_list, list_entry) {
+               sdev = scsi_device_lookup(im_port->shost, itnim->channel,
+                                         itnim->scsi_tgt_id, 0);
+               if (sdev) {
+                       if (lunmask_cfg == BFA_TRUE)
+                               sdev->sdev_bflags |= scan_flags;
+                       else
+                               sdev->sdev_bflags &= ~scan_flags;
+                       scsi_device_put(sdev);
+               }
+       }
+}
+
 /* Function to reset the LUN SCAN mode */
 static void
 bfad_iocmd_lunmask_reset_lunscan_mode(struct bfad_s *bfad, int lunmask_cfg)
index c03b225ea1ba0e2b586268c0c9be550bfa1ba2ba..4353feedf76ad25861ff1c065b05249fccaa532b 100644 (file)
@@ -198,30 +198,4 @@ irqreturn_t bfad_intx(int irq, void *dev_id);
 int bfad_im_bsg_request(struct bsg_job *job);
 int bfad_im_bsg_timeout(struct bsg_job *job);
 
-/*
- * Macro to set the SCSI device sdev_bflags - sdev_bflags are used by the
- * SCSI mid-layer to choose LUN Scanning mode REPORT_LUNS vs. Sequential Scan
- *
- * Internally iterate's over all the ITNIM's part of the im_port & set's the
- * sdev_bflags for the scsi_device associated with LUN #0.
- */
-#define bfad_reset_sdev_bflags(__im_port, __lunmask_cfg) do {          \
-       struct scsi_device *__sdev = NULL;                              \
-       struct bfad_itnim_s *__itnim = NULL;                            \
-       u32 scan_flags = BLIST_NOREPORTLUN | BLIST_SPARSELUN;           \
-       list_for_each_entry(__itnim, &((__im_port)->itnim_mapped_list), \
-                           list_entry) {                               \
-               __sdev = scsi_device_lookup((__im_port)->shost,         \
-                                           __itnim->channel,           \
-                                           __itnim->scsi_tgt_id, 0);   \
-               if (__sdev) {                                           \
-                       if ((__lunmask_cfg) == BFA_TRUE)                \
-                               __sdev->sdev_bflags |= scan_flags;      \
-                       else                                            \
-                               __sdev->sdev_bflags &= ~scan_flags;     \
-                       scsi_device_put(__sdev);                        \
-               }                                                       \
-       }                                                               \
-} while (0)
-
 #endif