Skip to contentSkip to conversation

mISDN: fix sparse warnings

PATCH Superseded Hannes Eder 2 participants 3 messages Dec 10, 2008 – Dec 11, 2008 Kernel janitors

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 9/9 mISDN: fix sparse warnings

Impact: make use of the __iomem address space modifier

Fix more than 30 sparse warnings of this or similar type:

drivers/isdn/hardware/mISDN/hfcmulti.c:261:31: warning: incorrect type in argument 2 (different address spaces)
drivers/isdn/hardware/mISDN/hfcmulti.c:261:31: got unsigned char [usertype] *
drivers/isdn/hardware/mISDN/hfcmulti.c:261:31: expected void volatile [noderef] <asn:2>*addr

---
 drivers/isdn/hardware/mISDN/hfc_multi.h |    4 +-
 drivers/isdn/hardware/mISDN/hfcmulti.c  |   42 +++++++++++++++++--------------
 2 files changed, 25 insertions(+), 21 deletions(-)
drivers/isdn/hardware/mISDN/hfc_multi.h +2 -2
index a33d87a..5ae25b6 100644
@@ -162,8 +162,8 @@ struct hfc_multi {
 	void		(*write_fifo)(struct hfc_multi *hc, u_char *data,
 				int len);
 	u_long		pci_origmembase, plx_origmembase, dsp_origmembase;
-	u_char		*pci_membase; /* PCI memory (MUST BE BYTE POINTER) */
-	u_char		*plx_membase; /* PLX memory */
+	u_char __iomem	*pci_membase; /* PCI memory (MUST BE BYTE POINTER) */
+	u_char __iomem	*plx_membase; /* PLX memory */
 	u_char		*dsp_membase; /* DSP on PLX */
 	u_long		pci_iobase; /* PCI IO */
 	struct hfcm_hw	hw;	/* remember data of write-only-registers */
drivers/isdn/hardware/mISDN/hfcmulti.c +23 -19

151 lines not on this page · raw message

Signature · 1 line
1.5.6.3
#1 lore raw

drivers/isdn/hardware/mISDN/hfcmulti.c hfcmulti_resync(struct hfc_multi *locked, struct hfc_multi *newmaster, int rm) · line 922

Quoted 6 lines · Hannes Eder
drivers/isdn/hardware/mISDN/hfcmulti.c +1 -1
@@ -918,7 +919,7 @@ hfcmulti_resync(struct hfc_multi *locked, struct hfc_multi *newmaster, int rm)
 	/* Disable sync of all cards */
 	list_for_each_entry_safe(hc, next, &HFClist, list) {
 		if (test_bit(HFC_CHIP_PLXSD, &hc->chip)) {
-			plx_acc_32 = (u_int *)(hc->plx_membase+PLX_GPIOC);
+			plx_acc_32 = (u_int __iomem *)(hc->plx_membase+PLX_GPIOC);

It would be probably better to declare plx_membase __iomem too instead of so much casting.

-Andi

Signature · 1 line
[email protected]
#2 lore raw
Quoted 10 lines · Andi Kleen

drivers/isdn/hardware/mISDN/hfcmulti.c hfcmulti_resync(struct hfc_multi *locked, struct hfc_multi *newmaster, int rm) · line 922

Quoted 6 lines · Hannes Eder
drivers/isdn/hardware/mISDN/hfcmulti.c +1 -1
@@ -918,7 +919,7 @@ hfcmulti_resync(struct hfc_multi *locked, struct hfc_multi *newmaster, int rm)
      /* Disable sync of all cards */
      list_for_each_entry_safe(hc, next, &HFClist, list) {
              if (test_bit(HFC_CHIP_PLXSD, &hc->chip)) {
-                     plx_acc_32 = (u_int *)(hc->plx_membase+PLX_GPIOC);
+                     plx_acc_32 = (u_int __iomem *)(hc->plx_membase+PLX_GPIOC);

It would be probably better to declare plx_membase __iomem too instead of so much casting.

it is, but of type "u_char __iomem *" (after applying this patch):

+ u_char __iomem *pci_membase; /* PCI memory (MUST BE BYTE POINTER) */

so thats why we need the cast.

What if we declare plx_acc_32 of type "u_char __iomem *", or both as "void __iomem *"?
I slightly favor the later, against the LOUD comment.

If plx_membase is declared without __iomem the cast "(u_int __iomem*)" produces a warning "cast adds address space to expression"

-Hannes