blob: 8905f745a5ce9efd5859e480f019ba334c2cd08b [file] [log] [blame]
Brad Bishopbec4ebc2022-08-03 09:55:16 -04001From 1c75e7d566e29258e9daf7b1548f2d681efb4aea Mon Sep 17 00:00:00 2001
2From: Viresh Kumar <viresh.kumar@linaro.org>
3Date: Wed, 30 Dec 2020 10:12:04 +0530
4Subject: [PATCH 05/22] mailbox: arm_mhuv2: Fix sparse warnings
5
6This patch fixes a bunch of sparse warnings in the newly added arm_mhuv2
7driver.
8
9drivers/mailbox/arm_mhuv2.c:506:24: warning: incorrect type in argument 1 (different address spaces)
10drivers/mailbox/arm_mhuv2.c:506:24: expected void const volatile [noderef] __iomem *addr
11drivers/mailbox/arm_mhuv2.c:506:24: got unsigned int [usertype] *
12drivers/mailbox/arm_mhuv2.c:547:42: warning: incorrect type in argument 2 (different address spaces)
13drivers/mailbox/arm_mhuv2.c:547:42: expected unsigned int [usertype] *reg
14drivers/mailbox/arm_mhuv2.c:547:42: got unsigned int [noderef] __iomem *
15drivers/mailbox/arm_mhuv2.c:625:42: warning: incorrect type in argument 2 (different address spaces)
16drivers/mailbox/arm_mhuv2.c:625:42: expected unsigned int [usertype] *reg
17drivers/mailbox/arm_mhuv2.c:625:42: got unsigned int [noderef] __iomem *
18drivers/mailbox/arm_mhuv2.c:972:24: warning: dereference of noderef expression
19drivers/mailbox/arm_mhuv2.c:973:22: warning: dereference of noderef expression
20drivers/mailbox/arm_mhuv2.c:993:25: warning: dereference of noderef expression
21drivers/mailbox/arm_mhuv2.c:1026:24: warning: dereference of noderef expression
22drivers/mailbox/arm_mhuv2.c:1027:22: warning: dereference of noderef expression
23drivers/mailbox/arm_mhuv2.c:1048:17: warning: dereference of noderef expression
24
25Reported-by: kernel test robot <lkp@intel.com>
26Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
27Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
28
29Upstream-Status: Backport [https://lkml.org/lkml/2021/2/9/428]
30Signed-off-by: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
31---
32 drivers/mailbox/arm_mhuv2.c | 22 +++++++++++-----------
33 1 file changed, 11 insertions(+), 11 deletions(-)
34
35diff --git a/drivers/mailbox/arm_mhuv2.c b/drivers/mailbox/arm_mhuv2.c
36index 67fb10885bb4..8223c1005254 100644
37--- a/drivers/mailbox/arm_mhuv2.c
38+++ b/drivers/mailbox/arm_mhuv2.c
39@@ -238,19 +238,19 @@ struct mhuv2_mbox_chan_priv {
40 };
41
42 /* Macro for reading a bitfield within a physically mapped packed struct */
43-#define readl_relaxed_bitfield(_regptr, _field) \
44+#define readl_relaxed_bitfield(_regptr, _type, _field) \
45 ({ \
46 u32 _regval; \
47 _regval = readl_relaxed((_regptr)); \
48- (*(typeof((_regptr)))(&_regval))._field; \
49+ (*(_type *)(&_regval))._field; \
50 })
51
52 /* Macro for writing a bitfield within a physically mapped packed struct */
53-#define writel_relaxed_bitfield(_value, _regptr, _field) \
54+#define writel_relaxed_bitfield(_value, _regptr, _type, _field) \
55 ({ \
56 u32 _regval; \
57 _regval = readl_relaxed(_regptr); \
58- (*(typeof(_regptr))(&_regval))._field = _value; \
59+ (*(_type *)(&_regval))._field = _value; \
60 writel_relaxed(_regval, _regptr); \
61 })
62
63@@ -496,7 +496,7 @@ static const struct mhuv2_protocol_ops mhuv2_data_transfer_ops = {
64
65 /* Interrupt handlers */
66
67-static struct mbox_chan *get_irq_chan_comb(struct mhuv2 *mhu, u32 *reg)
68+static struct mbox_chan *get_irq_chan_comb(struct mhuv2 *mhu, u32 __iomem *reg)
69 {
70 struct mbox_chan *chans = mhu->mbox.chans;
71 int channel = 0, i, offset = 0, windows, protocol, ch_wn;
72@@ -969,8 +969,8 @@ static int mhuv2_tx_init(struct amba_device *adev, struct mhuv2 *mhu,
73 mhu->mbox.ops = &mhuv2_sender_ops;
74 mhu->send = reg;
75
76- mhu->windows = readl_relaxed_bitfield(&mhu->send->mhu_cfg, num_ch);
77- mhu->minor = readl_relaxed_bitfield(&mhu->send->aidr, arch_minor_rev);
78+ mhu->windows = readl_relaxed_bitfield(&mhu->send->mhu_cfg, struct mhu_cfg_t, num_ch);
79+ mhu->minor = readl_relaxed_bitfield(&mhu->send->aidr, struct aidr_t, arch_minor_rev);
80
81 spin_lock_init(&mhu->doorbell_pending_lock);
82
83@@ -990,7 +990,7 @@ static int mhuv2_tx_init(struct amba_device *adev, struct mhuv2 *mhu,
84 mhu->mbox.txdone_poll = false;
85 mhu->irq = adev->irq[0];
86
87- writel_relaxed_bitfield(1, &mhu->send->int_en, chcomb);
88+ writel_relaxed_bitfield(1, &mhu->send->int_en, struct int_en_t, chcomb);
89
90 /* Disable all channel interrupts */
91 for (i = 0; i < mhu->windows; i++)
92@@ -1023,8 +1023,8 @@ static int mhuv2_rx_init(struct amba_device *adev, struct mhuv2 *mhu,
93 mhu->mbox.ops = &mhuv2_receiver_ops;
94 mhu->recv = reg;
95
96- mhu->windows = readl_relaxed_bitfield(&mhu->recv->mhu_cfg, num_ch);
97- mhu->minor = readl_relaxed_bitfield(&mhu->recv->aidr, arch_minor_rev);
98+ mhu->windows = readl_relaxed_bitfield(&mhu->recv->mhu_cfg, struct mhu_cfg_t, num_ch);
99+ mhu->minor = readl_relaxed_bitfield(&mhu->recv->aidr, struct aidr_t, arch_minor_rev);
100
101 mhu->irq = adev->irq[0];
102 if (!mhu->irq) {
103@@ -1045,7 +1045,7 @@ static int mhuv2_rx_init(struct amba_device *adev, struct mhuv2 *mhu,
104 writel_relaxed(0xFFFFFFFF, &mhu->recv->ch_wn[i].mask_set);
105
106 if (mhu->minor)
107- writel_relaxed_bitfield(1, &mhu->recv->int_en, chcomb);
108+ writel_relaxed_bitfield(1, &mhu->recv->int_en, struct int_en_t, chcomb);
109
110 return 0;
111 }
112--
1132.17.1
114