]> git.baikalelectronics.ru Git - kernel.git/commitdiff
scsi: smartpqi: Fix BUILD_BUG_ON() statements
authorMike McGowen <Mike.McGowen@microchip.com>
Tue, 1 Feb 2022 21:49:03 +0000 (15:49 -0600)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 8 Feb 2022 04:38:36 +0000 (23:38 -0500)
Add calls to the functions at the beginning driver initialization.

The BUILD_BUG_ON() statements that are currently in functions named
verify_structures() in the modules smartpqi_init.c and smartpqi_sis.c do
not work as currently implemented.

Link: https://lore.kernel.org/r/164375214355.440833.13129778749209816497.stgit@brunhilda.pdev.net
Reviewed-by: Kevin Barnett <kevin.barnett@microchip.com>
Reviewed-by: Scott Teel <scott.teel@microchip.com>
Reviewed-by: Scott Benesh <scott.benesh@microchip.com>
Signed-off-by: Mike McGowen <Mike.McGowen@microchip.com>
Signed-off-by: Don Brace <don.brace@microchip.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/smartpqi/smartpqi_init.c
drivers/scsi/smartpqi/smartpqi_sis.c
drivers/scsi/smartpqi/smartpqi_sis.h

index d886a9c860af65d4fe92e386b0ca0562a15a143a..29cef682bde9c331fd4541c50c0a193dc3d83a0d 100644 (file)
@@ -54,6 +54,7 @@ MODULE_DESCRIPTION("Driver for Microchip Smart Family Controller version "
 MODULE_VERSION(DRIVER_VERSION);
 MODULE_LICENSE("GPL");
 
+static void pqi_verify_structures(void);
 static void pqi_take_ctrl_offline(struct pqi_ctrl_info *ctrl_info,
        enum pqi_ctrl_shutdown_reason ctrl_shutdown_reason);
 static void pqi_ctrl_offline_worker(struct work_struct *work);
@@ -9703,6 +9704,8 @@ static int __init pqi_init(void)
        int rc;
 
        pr_info(DRIVER_NAME "\n");
+       pqi_verify_structures();
+       sis_verify_structures();
 
        pqi_sas_transport_template = sas_attach_transport(&pqi_sas_transport_functions);
        if (!pqi_sas_transport_template)
@@ -9726,7 +9729,7 @@ static void __exit pqi_cleanup(void)
 module_init(pqi_init);
 module_exit(pqi_cleanup);
 
-static void __attribute__((unused)) verify_structures(void)
+static void pqi_verify_structures(void)
 {
        BUILD_BUG_ON(offsetof(struct pqi_ctrl_registers,
                sis_host_to_ctrl_doorbell) != 0x20);
index e176a1a0534dd4aa4eb9bafa22cdd69afcc3599e..afc27adf68e975eddb9561e28ac9f880357b62cb 100644 (file)
@@ -479,7 +479,7 @@ int sis_wait_for_fw_triage_completion(struct pqi_ctrl_info *ctrl_info)
        return rc;
 }
 
-static void __attribute__((unused)) verify_structures(void)
+void sis_verify_structures(void)
 {
        BUILD_BUG_ON(offsetof(struct sis_base_struct,
                revision) != 0x0);
index bd92ff49f385515b9c81cfe537c2d4bb5f0a70f2..5f3575261a8ed530dedaebf6fe23fcbfcf1816f4 100644 (file)
@@ -12,6 +12,7 @@
 #if !defined(_SMARTPQI_SIS_H)
 #define _SMARTPQI_SIS_H
 
+void sis_verify_structures(void);
 int sis_wait_for_ctrl_ready(struct pqi_ctrl_info *ctrl_info);
 int sis_wait_for_ctrl_ready_resume(struct pqi_ctrl_info *ctrl_info);
 bool sis_is_firmware_running(struct pqi_ctrl_info *ctrl_info);