diff options
author | Roland Dreier <roland@purestorage.com> | 2013-07-08 13:52:28 -0400 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2013-07-08 13:52:28 -0400 |
commit | 582c016e68dc5dfea4d3582512157f165a428149 (patch) | |
tree | 3c2a36544dd8125d6b224c91c326bacf30660e4f | |
parent | ad32b95f8281ac5a292da83ff27616aceee4b770 (diff) |
mlx5_core: Fixes for sparse warnings
- use be32_to_cpu() instead of cpu_to_be32() where appropriate.
- use proper accessors for pointers marked __iomem.
Signed-off-by: Roland Dreier <roland@purestorage.com>
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/debugfs.c | 4 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/health.c | 28 |
2 files changed, 21 insertions, 11 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/debugfs.c b/drivers/net/ethernet/mellanox/mlx5/core/debugfs.c index 5e9cf2b9aaf7..a550a8ef94a1 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/debugfs.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/debugfs.c | |||
@@ -323,11 +323,11 @@ static u64 qp_read_field(struct mlx5_core_dev *dev, struct mlx5_core_qp *qp, | |||
323 | param = 0; | 323 | param = 0; |
324 | break; | 324 | break; |
325 | case QP_LOG_PG_SZ: | 325 | case QP_LOG_PG_SZ: |
326 | param = ((cpu_to_be32(ctx->log_pg_sz_remote_qpn) >> 24) & 0x1f); | 326 | param = (be32_to_cpu(ctx->log_pg_sz_remote_qpn) >> 24) & 0x1f; |
327 | param += 12; | 327 | param += 12; |
328 | break; | 328 | break; |
329 | case QP_RQPN: | 329 | case QP_RQPN: |
330 | param = cpu_to_be32(ctx->log_pg_sz_remote_qpn) & 0xffffff; | 330 | param = be32_to_cpu(ctx->log_pg_sz_remote_qpn) & 0xffffff; |
331 | break; | 331 | break; |
332 | } | 332 | } |
333 | 333 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/health.c b/drivers/net/ethernet/mellanox/mlx5/core/health.c index ea4b9bca6d4a..748f10a155c4 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/health.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/health.c | |||
@@ -132,6 +132,16 @@ static const char *hsynd_str(u8 synd) | |||
132 | } | 132 | } |
133 | } | 133 | } |
134 | 134 | ||
135 | static u16 read_be16(__be16 __iomem *p) | ||
136 | { | ||
137 | return swab16(readl((__force u16 __iomem *) p)); | ||
138 | } | ||
139 | |||
140 | static u32 read_be32(__be32 __iomem *p) | ||
141 | { | ||
142 | return swab32(readl((__force u32 __iomem *) p)); | ||
143 | } | ||
144 | |||
135 | static void print_health_info(struct mlx5_core_dev *dev) | 145 | static void print_health_info(struct mlx5_core_dev *dev) |
136 | { | 146 | { |
137 | struct mlx5_core_health *health = &dev->priv.health; | 147 | struct mlx5_core_health *health = &dev->priv.health; |
@@ -139,15 +149,15 @@ static void print_health_info(struct mlx5_core_dev *dev) | |||
139 | int i; | 149 | int i; |
140 | 150 | ||
141 | for (i = 0; i < ARRAY_SIZE(h->assert_var); i++) | 151 | for (i = 0; i < ARRAY_SIZE(h->assert_var); i++) |
142 | pr_info("assert_var[%d] 0x%08x\n", i, be32_to_cpu(h->assert_var[i])); | 152 | pr_info("assert_var[%d] 0x%08x\n", i, read_be32(h->assert_var + i)); |
143 | 153 | ||
144 | pr_info("assert_exit_ptr 0x%08x\n", be32_to_cpu(h->assert_exit_ptr)); | 154 | pr_info("assert_exit_ptr 0x%08x\n", read_be32(&h->assert_exit_ptr)); |
145 | pr_info("assert_callra 0x%08x\n", be32_to_cpu(h->assert_callra)); | 155 | pr_info("assert_callra 0x%08x\n", read_be32(&h->assert_callra)); |
146 | pr_info("fw_ver 0x%08x\n", be32_to_cpu(h->fw_ver)); | 156 | pr_info("fw_ver 0x%08x\n", read_be32(&h->fw_ver)); |
147 | pr_info("hw_id 0x%08x\n", be32_to_cpu(h->hw_id)); | 157 | pr_info("hw_id 0x%08x\n", read_be32(&h->hw_id)); |
148 | pr_info("irisc_index %d\n", h->irisc_index); | 158 | pr_info("irisc_index %d\n", readb(&h->irisc_index)); |
149 | pr_info("synd 0x%x: %s\n", h->synd, hsynd_str(h->synd)); | 159 | pr_info("synd 0x%x: %s\n", readb(&h->synd), hsynd_str(readb(&h->synd))); |
150 | pr_info("ext_sync 0x%04x\n", be16_to_cpu(h->ext_sync)); | 160 | pr_info("ext_sync 0x%04x\n", read_be16(&h->ext_sync)); |
151 | } | 161 | } |
152 | 162 | ||
153 | static void poll_health(unsigned long data) | 163 | static void poll_health(unsigned long data) |