From patchwork Fri Jan 25 14:22:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 156602 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp418692jaa; Fri, 25 Jan 2019 06:23:22 -0800 (PST) X-Google-Smtp-Source: ALg8bN5hk7FldZ+lxKXY8wnc+yKZw40indBwXT+jpv5UlIlzXM/ZLAXZMZB958/ZaJMeT0C139L8 X-Received: by 2002:a62:1c0a:: with SMTP id c10mr11103789pfc.213.1548426202299; Fri, 25 Jan 2019 06:23:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548426202; cv=none; d=google.com; s=arc-20160816; b=GyTN400nKtAN6VZtWLMQ7PusWUzJYUrC1Az/h1jSzA377djlh83kKRdVNfXLs+oiuu fCvdslVv+ae8Gkpx+HNJ/IkQ2ptgrHJwvMFodjh7wxC6cJ/FLVqAi2tk20HHuwwf/xE6 wx85Jz4wY8Q/Ja0pYNl37eqgLlO7zonSy7Honn9mflFTHxNvt63RKOMKKf7OTy86k1rF Ie9F+sKsPnObLcPfJyzXUSdzwHOAo1Rqk0EPdlMUGxchSOXDIpcPRrqWyne16D1Ccbt2 NVLoZIy2pHHBp7E9GSrTR8mFgNnkqvSijT4bRy/Fn5LEMk05BSFBvduXxlWrqx1w6XSU b53g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=9NDrTPyFonDSg0TQruWRcNePkOXYQoVbQTVj3ZQ5lis=; b=Tvqw8KlC3wVn3No2kDJoytIrjkdoZC8DjLViVe7u9ILrdneYXd7jysqPpHpwkHmkku ju1XoMT/u7mC5/Vt9O7urYU4HHskMCCe6TOvl8wJvfcEhogD8oSiOeH4BYaoZbFB1t7U 5HUp4xqMAcM4aca+qGNUJ3bFMorH0SWsykOt8EryEc1wZT4OZhKut2F8ua7HwY2z1ulK Xbf5ZKyb3fb5g+Xh8xYWbhba7KHAAD726fy2qdnB3tBL0ZgtONI7qjo7rjG1tdkfBhp2 VowCf1QIZqKD1Nct9u7pKjzrZ1m9UD8vN3jSmZbsmNqIXEEEFH0rdLCXgCSeAM9qYccG zAhw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e68si25047046pfb.101.2019.01.25.06.23.21; Fri, 25 Jan 2019 06:23:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729255AbfAYOXT (ORCPT + 31 others); Fri, 25 Jan 2019 09:23:19 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:2756 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727264AbfAYOWE (ORCPT ); Fri, 25 Jan 2019 09:22:04 -0500 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 3A94511CA24FCF14406F; Fri, 25 Jan 2019 22:21:59 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.408.0; Fri, 25 Jan 2019 22:21:51 +0800 From: John Garry To: , CC: , , , John Garry Subject: [PATCH 02/13] scsi: hisi_sas: Fix type casting and missing static qualifier in debugfs code Date: Fri, 25 Jan 2019 22:22:28 +0800 Message-ID: <1548426159-225679-3-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1548426159-225679-1-git-send-email-john.garry@huawei.com> References: <1548426159-225679-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/scsi/hisi_sas/hisi_sas.h | 4 ++-- drivers/scsi/hisi_sas/hisi_sas_main.c | 21 +++++++++++---------- 2 files changed, 13 insertions(+), 12 deletions(-) -- 1.9.1 diff --git a/drivers/scsi/hisi_sas/hisi_sas.h b/drivers/scsi/hisi_sas/hisi_sas.h index b8b1ded..5bb6759 100644 --- a/drivers/scsi/hisi_sas/hisi_sas.h +++ b/drivers/scsi/hisi_sas/hisi_sas.h @@ -359,8 +359,8 @@ struct hisi_hba { u32 intr_coal_count; /* Interrupt count to coalesce */ /* 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 72d2295..73a545a 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -2547,7 +2547,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) { @@ -2574,10 +2574,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]); } } @@ -2587,7 +2587,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; @@ -2634,7 +2634,7 @@ static int hisi_sas_debugfs_port_open(struct inode *inode, struct file *filp) }; static int hisi_sas_show_row_64(struct seq_file *s, int index, - int sz, u64 *ptr) + int sz, __le64 *ptr) { int i; @@ -2652,7 +2652,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; @@ -2672,7 +2672,7 @@ static int hisi_sas_cq_show_slot(struct seq_file *s, int slot, void *cq_ptr) struct hisi_sas_cq *cq = cq_ptr; struct hisi_hba *hisi_hba = cq->hisi_hba; void *complete_queue = hisi_hba->debugfs_complete_hdr[cq->id]; - void *complete_hdr = complete_queue + + __le32 *complete_hdr = complete_queue + (hisi_hba->hw->complete_hdr_size * slot); return hisi_sas_show_row_32(s, slot, @@ -2711,8 +2711,8 @@ static int hisi_sas_dq_show_slot(struct seq_file *s, int slot, void *dq_ptr) struct hisi_sas_dq *dq = dq_ptr; struct hisi_hba *hisi_hba = dq->hisi_hba; void *cmd_queue = hisi_hba->debugfs_cmd_hdr[dq->id]; - void *cmd_hdr = cmd_queue + - hisi_hba->hw->complete_hdr_size * slot; + __le32 *cmd_hdr = cmd_queue + + sizeof(struct hisi_sas_cmd_hdr) * slot; return hisi_sas_show_row_32(s, slot, sizeof(struct hisi_sas_cmd_hdr), cmd_hdr); @@ -2748,10 +2748,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; }