135 lines
4.6 KiB
Diff
135 lines
4.6 KiB
Diff
From 97d8404c4e751475f0b428fee3dfda80dc936163 Mon Sep 17 00:00:00 2001
|
|
From: John Garry <john.garry@huawei.com>
|
|
Date: Fri, 25 Jan 2019 22:22:28 +0800
|
|
Subject: [PATCH 002/108] scsi: hisi_sas: Fix type casting and missing static
|
|
qualifier in debugfs code
|
|
|
|
mainline inclusion
|
|
from mainline-v5.1-rc1
|
|
commit 5b0eeac4bed4b1a261acf3cd893f929e68814a0d
|
|
category: bugfix
|
|
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I8EKNE
|
|
|
|
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5b0eeac4bed4b1a261acf3cd893f929e68814a0d
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
Sparse can detect some type casting issues in the debugfs code, so fix it
|
|
up.
|
|
|
|
Also a missing static qualifier is added to hisi_sas_debugfs_to_reg_name().
|
|
|
|
Signed-off-by: John Garry <john.garry@huawei.com>
|
|
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
|
|
Signed-off-by: YunYi Yang <yangyunyi2@huawei.com>
|
|
|
|
Conflicts:
|
|
drivers/scsi/hisi_sas/hisi_sas_main.c
|
|
---
|
|
drivers/scsi/hisi_sas/hisi_sas.h | 4 ++--
|
|
drivers/scsi/hisi_sas/hisi_sas_main.c | 19 ++++++++++---------
|
|
2 files changed, 12 insertions(+), 11 deletions(-)
|
|
|
|
diff --git a/drivers/scsi/hisi_sas/hisi_sas.h b/drivers/scsi/hisi_sas/hisi_sas.h
|
|
index d04d784c45b9..cd64ac88b684 100644
|
|
--- a/drivers/scsi/hisi_sas/hisi_sas.h
|
|
+++ b/drivers/scsi/hisi_sas/hisi_sas.h
|
|
@@ -422,8 +422,8 @@ struct hisi_hba {
|
|
int enable_dix_dif;
|
|
|
|
/* debugfs memories */
|
|
- void *debugfs_global_reg;
|
|
- void *debugfs_port_reg[HISI_SAS_MAX_PHYS];
|
|
+ u32 *debugfs_global_reg;
|
|
+ u32 *debugfs_port_reg[HISI_SAS_MAX_PHYS];
|
|
void *debugfs_complete_hdr[HISI_SAS_MAX_QUEUES];
|
|
struct hisi_sas_cmd_hdr *debugfs_cmd_hdr[HISI_SAS_MAX_QUEUES];
|
|
struct hisi_sas_iost *debugfs_iost;
|
|
diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c
|
|
index 6d8f9e9e0120..e7ffc5eaabe6 100644
|
|
--- a/drivers/scsi/hisi_sas/hisi_sas_main.c
|
|
+++ b/drivers/scsi/hisi_sas/hisi_sas_main.c
|
|
@@ -2847,7 +2847,7 @@ static void hisi_sas_debugfs_snapshot_iost_reg(struct hisi_hba *hisi_hba)
|
|
}
|
|
}
|
|
|
|
-const char *
|
|
+static const char *
|
|
hisi_sas_debugfs_to_reg_name(int off, int base_off,
|
|
const struct hisi_sas_debugfs_reg_lu *lu)
|
|
{
|
|
@@ -2874,10 +2874,10 @@ static void hisi_sas_debugfs_print_reg(u32 *regs_val, const void *ptr,
|
|
|
|
if (name)
|
|
seq_printf(s, "0x%08x 0x%08x %s\n", off,
|
|
- le32_to_cpu(regs_val[i]), name);
|
|
+ regs_val[i], name);
|
|
else
|
|
seq_printf(s, "0x%08x 0x%08x\n", off,
|
|
- le32_to_cpu(regs_val[i]));
|
|
+ regs_val[i]);
|
|
}
|
|
}
|
|
|
|
@@ -2887,7 +2887,7 @@ static int hisi_sas_debugfs_global_show(struct seq_file *s, void *p)
|
|
const struct hisi_sas_hw *hw = hisi_hba->hw;
|
|
const struct hisi_sas_debugfs_reg *reg_global = hw->debugfs_reg_global;
|
|
|
|
- hisi_sas_debugfs_print_reg((u32 *)hisi_hba->debugfs_global_reg,
|
|
+ hisi_sas_debugfs_print_reg(hisi_hba->debugfs_global_reg,
|
|
reg_global, s);
|
|
|
|
return 0;
|
|
@@ -3317,7 +3317,7 @@ static const struct file_operations hisi_sas_debugfs_port_fops = {
|
|
};
|
|
|
|
static int hisi_sas_show_row_64(struct seq_file *s, int index,
|
|
- int sz, u64 *ptr)
|
|
+ int sz, __le64 *ptr)
|
|
{
|
|
int i;
|
|
|
|
@@ -3336,7 +3336,7 @@ static int hisi_sas_show_row_64(struct seq_file *s, int index,
|
|
}
|
|
|
|
static int hisi_sas_show_row_32(struct seq_file *s, int index,
|
|
- int sz, u32 *ptr)
|
|
+ int sz, __le32 *ptr)
|
|
{
|
|
int i;
|
|
|
|
@@ -3359,7 +3359,7 @@ static int hisi_sas_cq_show_slot(struct seq_file *s, int slot, void *cq_ptr)
|
|
struct hisi_hba *hisi_hba = cq->hisi_hba;
|
|
void *complete_queue = hisi_hba->debugfs_complete_hdr[cq->id];
|
|
u64 offset = hisi_hba->hw->complete_hdr_size * slot;
|
|
- void *complete_hdr = complete_queue + offset;
|
|
+ __le32 *complete_hdr = complete_queue + offset;
|
|
|
|
return hisi_sas_show_row_32(s, slot,
|
|
hisi_hba->hw->complete_hdr_size,
|
|
@@ -3398,7 +3398,7 @@ static int hisi_sas_dq_show_slot(struct seq_file *s, int slot, void *dq_ptr)
|
|
struct hisi_hba *hisi_hba = dq->hisi_hba;
|
|
void *cmd_queue = hisi_hba->debugfs_cmd_hdr[dq->id];
|
|
u64 offset = sizeof(struct hisi_sas_cmd_hdr) * slot;
|
|
- void *cmd_hdr = cmd_queue + offset;
|
|
+ __le32 *cmd_hdr = cmd_queue + offset;
|
|
|
|
return hisi_sas_show_row_32(s, slot, sizeof(struct hisi_sas_cmd_hdr),
|
|
cmd_hdr);
|
|
@@ -3434,10 +3434,11 @@ static int hisi_sas_debugfs_iost_show(struct seq_file *s, void *p)
|
|
struct hisi_hba *hisi_hba = s->private;
|
|
struct hisi_sas_iost *debugfs_iost = hisi_hba->debugfs_iost;
|
|
int i, ret, max_command_entries = hisi_hba->hw->max_command_entries;
|
|
+ __le64 *iost = &debugfs_iost->qw0;
|
|
|
|
for (i = 0; i < max_command_entries; i++, debugfs_iost++) {
|
|
ret = hisi_sas_show_row_64(s, i, sizeof(*debugfs_iost),
|
|
- (u64 *)debugfs_iost);
|
|
+ iost);
|
|
if (ret)
|
|
return ret;
|
|
}
|
|
--
|
|
2.27.0
|
|
|