LeapIO inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/IB9KS0
------------------------------------------
This commit is to Fix the compilation warnings in LeapIOraid driver in loongarch64:
1. warning: no previous prototype for 'XXX'[-Wmissing-prototypes], etc. 2. warning: variable 'XXX' set but not used [-Wunused-but-set-variable], etc. 3. warning: '%d' directive output may be truncated writing between 1 and 3 bytes into a region of size between 1 and 26 [-Wformat-truncation=], etc.
Signed-off-by: haodongdong doubled@leap-io.com --- drivers/scsi/leapioraid/leapioraid_func.c | 39 +++++++++---------- drivers/scsi/leapioraid/leapioraid_func.h | 9 ++--- drivers/scsi/leapioraid/leapioraid_os.c | 24 ++++++------ .../scsi/leapioraid/leapioraid_transport.c | 2 +- 4 files changed, 35 insertions(+), 39 deletions(-)
diff --git a/drivers/scsi/leapioraid/leapioraid_func.c b/drivers/scsi/leapioraid/leapioraid_func.c index 82945c0431394..b52cd6c925558 100644 --- a/drivers/scsi/leapioraid/leapioraid_func.c +++ b/drivers/scsi/leapioraid/leapioraid_func.c @@ -306,7 +306,7 @@ leapioraid_udp_init(void) memset(&msg, 0, sizeof(msg)); msg.msg_name = &dest_addr; msg.msg_namelen = sizeof(struct sockaddr_in); - return 0; + return ret; }
static void @@ -389,7 +389,7 @@ leapioraid_base_start_log_watchdog(struct LEAPIORAID_ADAPTER *ioc) leapioraid_udp_init(); INIT_DELAYED_WORK(&ioc->pcie_log_work, leapioraid_base_pcie_log_work); snprintf(ioc->pcie_log_work_q_name, - sizeof(ioc->pcie_log_work_q_name), "poll_%s%d_status", + sizeof(ioc->pcie_log_work_q_name), "poll_%s%u_status", ioc->driver_name, ioc->id); ioc->pcie_log_work_q = create_singlethread_workqueue(ioc->pcie_log_work_q_name); @@ -585,7 +585,7 @@ leapioraid_base_start_watchdog(struct LEAPIORAID_ADAPTER *ioc) INIT_DELAYED_WORK(&ioc->fault_reset_work, leapioraid_base_fault_reset_work); snprintf(ioc->fault_reset_work_q_name, - sizeof(ioc->fault_reset_work_q_name), "poll_%s%d_status", + sizeof(ioc->fault_reset_work_q_name), "poll_%s%u_status", ioc->driver_name, ioc->id); ioc->fault_reset_work_q = create_singlethread_workqueue(ioc->fault_reset_work_q_name); @@ -634,7 +634,7 @@ leapioraid_base_start_hba_unplug_watchdog(struct LEAPIORAID_ADAPTER *ioc) leapioraid_base_hba_hot_unplug_work); snprintf(ioc->hba_hot_unplug_work_q_name, sizeof(ioc->hba_hot_unplug_work_q_name), - "poll_%s%d_hba_unplug", ioc->driver_name, ioc->id); + "poll_%s%u_hba_unplug", ioc->driver_name, ioc->id); ioc->hba_hot_unplug_work_q = create_singlethread_workqueue(ioc->hba_hot_unplug_work_q_name); if (!ioc->hba_hot_unplug_work_q) { @@ -667,7 +667,7 @@ leapioraid_base_stop_hba_unplug_watchdog(struct LEAPIORAID_ADAPTER *ioc) } }
-void +static void leapioraid_base_stop_smart_polling(struct LEAPIORAID_ADAPTER *ioc) { struct workqueue_struct *wq; @@ -1296,7 +1296,7 @@ union leapioraid_reply_descriptor { } u; };
-int +static int leapioraid_base_process_reply_queue( struct leapioraid_adapter_reply_queue *reply_q) { @@ -1465,6 +1465,7 @@ leapioraid_base_interrupt(int irq, void *bus_id) IRQ_HANDLED : IRQ_NONE); }
+static int leapioraid_base_irqpoll(struct irq_poll *irqpoll, int budget) { struct leapioraid_adapter_reply_queue *reply_q; @@ -1486,7 +1487,7 @@ int leapioraid_base_irqpoll(struct irq_poll *irqpoll, int budget) return num_entries; }
-void +static void leapioraid_base_init_irqpolls(struct LEAPIORAID_ADAPTER *ioc) { struct leapioraid_adapter_reply_queue *reply_q, *next; @@ -1717,7 +1718,7 @@ leapioraid_base_build_sg_scmd_ieee(struct LEAPIORAID_ADAPTER *ioc, struct LeapioraidSCSIIOReq_t *mpi_request; dma_addr_t chain_dma; struct scatterlist *sg_scmd; - void *sg_local, *chain, *sgl_zero_addr; + void *sg_local, *chain; u32 chain_offset; u32 chain_length; int sges_left; @@ -1743,7 +1744,7 @@ leapioraid_base_build_sg_scmd_ieee(struct LEAPIORAID_ADAPTER *ioc, dev_name(&scmd->device->sdev_gendev), scsi_bufflen(scmd)); return -ENOMEM; } - sgl_zero_addr = sg_local = &mpi_request->SGL; + sg_local = &mpi_request->SGL; sges_in_segment = (ioc->request_sz - offsetof(struct LeapioraidSCSIIOReq_t, SGL)) / ioc->sge_size_ieee; @@ -2015,7 +2016,7 @@ leapioraid_base_request_irq(struct LEAPIORAID_ADAPTER *ioc, u8 index) { struct leapioraid_adapter_reply_queue *reply_q; int r; - int qid; + u8 qid;
reply_q = kzalloc(sizeof(struct leapioraid_adapter_reply_queue), GFP_KERNEL); @@ -2027,7 +2028,7 @@ leapioraid_base_request_irq(struct LEAPIORAID_ADAPTER *ioc, u8 index) atomic_set(&reply_q->busy, 0); if (index >= ioc->iopoll_q_start_index) { qid = index - ioc->iopoll_q_start_index; - snprintf(reply_q->name, LEAPIORAID_NAME_LENGTH, "%s%d-mq-poll%d", + snprintf(reply_q->name, LEAPIORAID_NAME_LENGTH, "%s%u-mq-poll%u", ioc->driver_name, ioc->id, qid); reply_q->is_blk_mq_poll_q = 1; ioc->blk_mq_poll_queues[qid].reply_q = reply_q; @@ -2036,7 +2037,7 @@ leapioraid_base_request_irq(struct LEAPIORAID_ADAPTER *ioc, u8 index) return 0; } if (ioc->msix_enable) - snprintf(reply_q->name, LEAPIORAID_NAME_LENGTH, "%s%d-msix%d", + snprintf(reply_q->name, LEAPIORAID_NAME_LENGTH, "%s%u-msix%u", ioc->driver_name, ioc->id, index); else snprintf(reply_q->name, LEAPIORAID_NAME_LENGTH, "%s%d", @@ -3917,10 +3918,10 @@ base_alloc_rdpq_dma_pool(struct LEAPIORAID_ADAPTER *ioc, int sz) }
static int -leapioraid_base_allocate_chain_dma_pool(struct LEAPIORAID_ADAPTER *ioc, int sz, - struct leapioraid_chain_tracker *ctr) +leapioraid_base_allocate_chain_dma_pool(struct LEAPIORAID_ADAPTER *ioc, int sz) { int i = 0, j = 0; + struct leapioraid_chain_tracker *ctr;
ioc->chain_dma_pool = dma_pool_create("chain pool", &ioc->pdev->dev, ioc->chain_segment_sz, 16, 0); @@ -4083,7 +4084,6 @@ leapioraid_base_allocate_memory_pools(struct LEAPIORAID_ADAPTER *ioc) unsigned short sg_tablesize; u16 sge_size; int i = 0; - struct leapioraid_chain_tracker *ct;
dinitprintk(ioc, pr_info("%s %s\n", ioc->name, __func__)); @@ -4303,8 +4303,7 @@ leapioraid_base_allocate_memory_pools(struct LEAPIORAID_ADAPTER *ioc) } } ioc->chains_per_prp_buffer = 0; - rc = leapioraid_base_allocate_chain_dma_pool(ioc, ioc->chain_segment_sz, - ct); + rc = leapioraid_base_allocate_chain_dma_pool(ioc, ioc->chain_segment_sz); if (rc == -ENOMEM) return -ENOMEM; else if (rc == -EAGAIN) { @@ -4410,7 +4409,7 @@ leapioraid_base_allocate_memory_pools(struct LEAPIORAID_ADAPTER *ioc) return rc; }
-void +static void leapioraid_base_flush_ios_and_panic( struct LEAPIORAID_ADAPTER *ioc, u16 fault_code) { @@ -5720,7 +5719,6 @@ leapioraid_base_hard_reset_handler( { int r; unsigned long flags; - u32 ioc_state;
dtmprintk(ioc, pr_info("%s %s: enter\n", ioc->name, __func__)); @@ -5749,7 +5747,7 @@ leapioraid_base_hard_reset_handler( spin_lock_irqsave(&ioc->ioc_reset_in_progress_lock, flags); ioc->shost_recovery = 1; spin_unlock_irqrestore(&ioc->ioc_reset_in_progress_lock, flags); - ioc_state = leapioraid_base_get_iocstate(ioc, 0); + leapioraid_base_get_iocstate(ioc, 0); leapioraid_base_reset_handler(ioc, LEAPIORAID_IOC_PRE_RESET_PHASE); leapioraid_wait_for_commands_to_complete(ioc); leapioraid_base_mask_interrupts(ioc); @@ -6060,6 +6058,7 @@ leapioraid_config_request( mpi_request, sizeof(struct LeapioraidCfgReq_t) / 4, issue_reset); + pr_info("%s issue_reset=%d\n", __func__, issue_reset); retry_count++; if (ioc->config_cmds.smid == smid) leapioraid_base_free_smid(ioc, smid); diff --git a/drivers/scsi/leapioraid/leapioraid_func.h b/drivers/scsi/leapioraid/leapioraid_func.h index 1980cfc244d64..9cf8206ccb3ce 100644 --- a/drivers/scsi/leapioraid/leapioraid_func.h +++ b/drivers/scsi/leapioraid/leapioraid_func.h @@ -582,17 +582,16 @@ struct LEAPIORAID_ADAPTER { int bars; u8 mask_interrupts; struct mutex pci_access_mutex; - char fault_reset_work_q_name[20]; - char hba_hot_unplug_work_q_name[20]; + char fault_reset_work_q_name[48]; + char hba_hot_unplug_work_q_name[48]; struct workqueue_struct *fault_reset_work_q; struct workqueue_struct *hba_hot_unplug_work_q; struct delayed_work fault_reset_work; struct delayed_work hba_hot_unplug_work; - char smart_poll_work_q_name[20]; struct workqueue_struct *smart_poll_work_q; struct delayed_work smart_poll_work; u8 adapter_over_temp; - char firmware_event_name[20]; + char firmware_event_name[48]; struct workqueue_struct *firmware_event_thread; spinlock_t fw_event_lock; struct list_head fw_event_list; @@ -814,7 +813,7 @@ struct LEAPIORAID_ADAPTER { struct list_head port_table_list; u8 *log_buffer; dma_addr_t log_buffer_dma; - char pcie_log_work_q_name[20]; + char pcie_log_work_q_name[48]; struct workqueue_struct *pcie_log_work_q; struct delayed_work pcie_log_work; u32 open_pcie_trace; diff --git a/drivers/scsi/leapioraid/leapioraid_os.c b/drivers/scsi/leapioraid/leapioraid_os.c index 4d2a7d064826c..83d47e7bcaec7 100644 --- a/drivers/scsi/leapioraid/leapioraid_os.c +++ b/drivers/scsi/leapioraid/leapioraid_os.c @@ -505,7 +505,8 @@ leapioraid_scsihost_determine_boot_device( } }
-static struct leapioraid_sas_device *__leapioraid_get_sdev_from_target( +static +struct leapioraid_sas_device *__leapioraid_get_sdev_from_target( struct LEAPIORAID_ADAPTER *ioc, struct LEAPIORAID_TARGET *tgt_priv) { @@ -518,6 +519,7 @@ static struct leapioraid_sas_device *__leapioraid_get_sdev_from_target( return ret; }
+static struct leapioraid_sas_device *leapioraid_get_sdev_from_target( struct LEAPIORAID_ADAPTER *ioc, struct LEAPIORAID_TARGET *tgt_priv) @@ -531,6 +533,7 @@ struct leapioraid_sas_device *leapioraid_get_sdev_from_target( return ret; }
+static struct leapioraid_sas_device *__leapioraid_get_sdev_by_addr( struct LEAPIORAID_ADAPTER *ioc, u64 sas_address, struct leapioraid_hba_port *port) @@ -863,6 +866,7 @@ struct leapioraid_raid_sas_node *leapioraid_scsihost_expander_find_by_handle( return r; }
+static struct leapioraid_enclosure_node *leapioraid_scsihost_enclosure_find_by_handle( struct LEAPIORAID_ADAPTER *ioc, u16 handle) @@ -1850,7 +1854,7 @@ leapioraid_scsihost_clear_tm_flag( } }
-int +static int leapioraid_scsihost_tm_cmd_map_status( struct LEAPIORAID_ADAPTER *ioc, uint channel, uint id, uint lun, u8 type, u16 smid_task) @@ -1885,7 +1889,7 @@ leapioraid_scsihost_tm_cmd_map_status( return FAILED; }
-int +static int leapioraid_scsihost_tm_post_processing(struct LEAPIORAID_ADAPTER *ioc, u16 handle, uint channel, uint id, uint lun, u8 type, u16 smid_task) @@ -3599,7 +3603,6 @@ leapioraid_scsihost_flush_running_cmds( struct LEAPIORAID_ADAPTER *ioc) { struct scsi_cmnd *scmd; - struct LeapioraidSCSIIOReq_t *mpi_request; struct leapioraid_scsiio_tracker *st; u16 smid; u16 count = 0; @@ -3613,7 +3616,7 @@ leapioraid_scsihost_flush_running_cmds( if (st && st->smid == 0) continue; leapioraid_scsihost_set_satl_pending(scmd, false); - mpi_request = leapioraid_base_get_msg_frame(ioc, smid); + leapioraid_base_get_msg_frame(ioc, smid); scsi_dma_unmap(scmd);
leapioraid_base_clear_st(ioc, st); @@ -5290,7 +5293,6 @@ leapioraid_scsi_send_scsi_io( struct LeapioraidSCSIIORep_t *mpi_reply; struct LeapioSCSIIOReq_t *mpi_request; u16 smid; - unsigned long timeleft; u8 issue_reset = 0; int rc; void *priv_sense; @@ -5394,7 +5396,7 @@ leapioraid_scsi_send_scsi_io( ioc->put_smid_scsi_io(ioc, smid, handle); else ioc->put_smid_default(ioc, smid); - timeleft = wait_for_completion_timeout(&ioc->scsih_cmds.done, + wait_for_completion_timeout(&ioc->scsih_cmds.done, transfer_packet->timeout * HZ); if (!(ioc->scsih_cmds.status & LEAPIORAID_CMD_COMPLETE)) { leapioraid_check_cmd_timeout(ioc, @@ -7167,6 +7169,7 @@ leapioraid_scsihost_reprobe_lun( sdev_printk(KERN_INFO, sdev, "%s raid component\n", sdev->no_uld_attach ? "hiding" : "exposing"); rc = scsi_device_reprobe(sdev); + pr_info("%s rc=%d\n", __func__, rc); }
static void @@ -7724,7 +7727,6 @@ static void leapioraid_scsihost_update_device_qdepth(struct LEAPIORAID_ADAPTER *ioc) { struct LEAPIORAID_DEVICE *sas_device_priv_data; - struct LEAPIORAID_TARGET *sas_target_priv_data; struct leapioraid_sas_device *sas_device; struct scsi_device *sdev; u16 qdepth; @@ -7734,7 +7736,6 @@ leapioraid_scsihost_update_device_qdepth(struct LEAPIORAID_ADAPTER *ioc) shost_for_each_device(sdev, ioc->shost) { sas_device_priv_data = sdev->hostdata; if (sas_device_priv_data && sas_device_priv_data->sas_target) { - sas_target_priv_data = sas_device_priv_data->sas_target; sas_device = sas_device_priv_data->sas_target->sas_dev; if (sas_device && sas_device->device_info & LEAPIORAID_SAS_DEVICE_INFO_SSP_TARGET) @@ -9376,7 +9377,6 @@ leapioraid_scsihost_probe( struct LEAPIORAID_ADAPTER *ioc; struct Scsi_Host *shost = NULL; int rv; - u8 revision;
shost = scsi_host_alloc(&leapioraid_driver_template, sizeof(struct LEAPIORAID_ADAPTER)); @@ -9387,8 +9387,6 @@ leapioraid_scsihost_probe( ioc->id = leapioraid_ids++; sprintf(ioc->driver_name, "%s", LEAPIORAID_DRIVER_NAME);
- revision = pdev->revision; - ioc->combined_reply_queue = 1; ioc->nc_reply_index_count = 16; ioc->multipath_on_hba = 1; @@ -9461,7 +9459,7 @@ leapioraid_scsihost_probe(
ioc->disable_eedp_support = 1; snprintf(ioc->firmware_event_name, sizeof(ioc->firmware_event_name), - "fw_event_%s%d", ioc->driver_name, ioc->id); + "fw_event_%s%u", ioc->driver_name, ioc->id); ioc->firmware_event_thread = alloc_ordered_workqueue(ioc->firmware_event_name, 0); if (!ioc->firmware_event_thread) { diff --git a/drivers/scsi/leapioraid/leapioraid_transport.c b/drivers/scsi/leapioraid/leapioraid_transport.c index ecfbdcc129613..e7ff263a8b6e7 100644 --- a/drivers/scsi/leapioraid/leapioraid_transport.c +++ b/drivers/scsi/leapioraid/leapioraid_transport.c @@ -100,7 +100,7 @@ leapioraid_transport_find_parent_node( return 0; }
-u8 +static u8 leapioraid_transport_get_port_id_by_rphy(struct LEAPIORAID_ADAPTER *ioc, struct sas_rphy *rphy) {