Commit f3cc4127 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] pointer-to-int conversion fixes

Assorted pointer-to-int fixes:
	a) some places want to take pointer modulo alignment or extract
integer that was cast to pointer (which is legitimate), but do that via
wrong cast, triggering sparse warnings.
	b) usual %x (int)ptr -> %p ptr fixes
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 246d79bf
...@@ -1380,7 +1380,7 @@ static void __devinit *aligned_kmalloc (int size, int flags, int alignment) ...@@ -1380,7 +1380,7 @@ static void __devinit *aligned_kmalloc (int size, int flags, int alignment)
if (alignment <= 0x10) { if (alignment <= 0x10) {
t = kmalloc (size, flags); t = kmalloc (size, flags);
if ((unsigned int)t & (alignment-1)) { if ((unsigned long)t & (alignment-1)) {
printk ("Kmalloc doesn't align things correctly! %p\n", t); printk ("Kmalloc doesn't align things correctly! %p\n", t);
kfree (t); kfree (t);
return aligned_kmalloc (size, flags, alignment * 4); return aligned_kmalloc (size, flags, alignment * 4);
......
...@@ -94,8 +94,8 @@ static int mwave_open(struct inode *inode, struct file *file) ...@@ -94,8 +94,8 @@ static int mwave_open(struct inode *inode, struct file *file)
unsigned int retval = 0; unsigned int retval = 0;
PRINTK_3(TRACE_MWAVE, PRINTK_3(TRACE_MWAVE,
"mwavedd::mwave_open, entry inode %x file %x\n", "mwavedd::mwave_open, entry inode %p file %p\n",
(int) inode, (int) file); inode, file);
PRINTK_2(TRACE_MWAVE, PRINTK_2(TRACE_MWAVE,
"mwavedd::mwave_open, exit return retval %x\n", retval); "mwavedd::mwave_open, exit return retval %x\n", retval);
...@@ -107,8 +107,8 @@ static int mwave_close(struct inode *inode, struct file *file) ...@@ -107,8 +107,8 @@ static int mwave_close(struct inode *inode, struct file *file)
unsigned int retval = 0; unsigned int retval = 0;
PRINTK_3(TRACE_MWAVE, PRINTK_3(TRACE_MWAVE,
"mwavedd::mwave_close, entry inode %x file %x\n", "mwavedd::mwave_close, entry inode %p file %p\n",
(int) inode, (int) file); inode, file);
PRINTK_2(TRACE_MWAVE, "mwavedd::mwave_close, exit retval %x\n", PRINTK_2(TRACE_MWAVE, "mwavedd::mwave_close, exit retval %x\n",
retval); retval);
...@@ -124,8 +124,8 @@ static int mwave_ioctl(struct inode *inode, struct file *file, ...@@ -124,8 +124,8 @@ static int mwave_ioctl(struct inode *inode, struct file *file,
void __user *arg = (void __user *)ioarg; void __user *arg = (void __user *)ioarg;
PRINTK_5(TRACE_MWAVE, PRINTK_5(TRACE_MWAVE,
"mwavedd::mwave_ioctl, entry inode %x file %x cmd %x arg %x\n", "mwavedd::mwave_ioctl, entry inode %p file %p cmd %x arg %x\n",
(int) inode, (int) file, iocmd, (int) ioarg); inode, file, iocmd, (int) ioarg);
switch (iocmd) { switch (iocmd) {
......
...@@ -99,7 +99,7 @@ static void EnableSRAM(THINKPAD_BD_DATA * pBDData) ...@@ -99,7 +99,7 @@ static void EnableSRAM(THINKPAD_BD_DATA * pBDData)
static irqreturn_t UartInterrupt(int irq, void *dev_id, struct pt_regs *regs) static irqreturn_t UartInterrupt(int irq, void *dev_id, struct pt_regs *regs)
{ {
PRINTK_3(TRACE_TP3780I, PRINTK_3(TRACE_TP3780I,
"tp3780i::UartInterrupt entry irq %x dev_id %x\n", irq, (int) dev_id); "tp3780i::UartInterrupt entry irq %x dev_id %p\n", irq, dev_id);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -111,7 +111,7 @@ static irqreturn_t DspInterrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -111,7 +111,7 @@ static irqreturn_t DspInterrupt(int irq, void *dev_id, struct pt_regs *regs)
unsigned short usIPCSource = 0, usIsolationMask, usPCNum; unsigned short usIPCSource = 0, usIsolationMask, usPCNum;
PRINTK_3(TRACE_TP3780I, PRINTK_3(TRACE_TP3780I,
"tp3780i::DspInterrupt entry irq %x dev_id %x\n", irq, (int) dev_id); "tp3780i::DspInterrupt entry irq %x dev_id %p\n", irq, dev_id);
if (dsp3780I_GetIPCSource(usDspBaseIO, &usIPCSource) == 0) { if (dsp3780I_GetIPCSource(usDspBaseIO, &usIPCSource) == 0) {
PRINTK_2(TRACE_TP3780I, PRINTK_2(TRACE_TP3780I,
......
...@@ -701,8 +701,8 @@ static void write_raw(struct BCState *bcs, u_int *buf, int cnt) { ...@@ -701,8 +701,8 @@ static void write_raw(struct BCState *bcs, u_int *buf, int cnt) {
} }
bcs->hw.tiger.s_tot += s_cnt; bcs->hw.tiger.s_tot += s_cnt;
if (bcs->cs->debug & L1_DEB_HSCX) if (bcs->cs->debug & L1_DEB_HSCX)
debugl1(bcs->cs,"tiger write_raw: c%d %x-%x %d/%d %d %x", bcs->channel, debugl1(bcs->cs,"tiger write_raw: c%d %p-%p %d/%d %d %x", bcs->channel,
(u_int)buf, (u_int)p, s_cnt, cnt, buf, p, s_cnt, cnt,
bcs->hw.tiger.sendcnt, bcs->cs->hw.njet.irqstat0); bcs->hw.tiger.sendcnt, bcs->cs->hw.njet.irqstat0);
if (bcs->cs->debug & L1_DEB_HSCX_FIFO) if (bcs->cs->debug & L1_DEB_HSCX_FIFO)
printframe(bcs->cs, bcs->hw.tiger.sp, s_cnt, "snd"); printframe(bcs->cs, bcs->hw.tiger.sp, s_cnt, "snd");
...@@ -931,8 +931,8 @@ inittiger(struct IsdnCardState *cs) ...@@ -931,8 +931,8 @@ inittiger(struct IsdnCardState *cs)
cs->bcs[1].hw.tiger.s_end = cs->bcs[0].hw.tiger.s_end; cs->bcs[1].hw.tiger.s_end = cs->bcs[0].hw.tiger.s_end;
memset(cs->bcs[0].hw.tiger.send, 0xff, NETJET_DMA_TXSIZE * sizeof(unsigned int)); memset(cs->bcs[0].hw.tiger.send, 0xff, NETJET_DMA_TXSIZE * sizeof(unsigned int));
debugl1(cs, "tiger: send buf %x - %x", (u_int)cs->bcs[0].hw.tiger.send, debugl1(cs, "tiger: send buf %p - %p", cs->bcs[0].hw.tiger.send,
(u_int)(cs->bcs[0].hw.tiger.send + NETJET_DMA_TXSIZE - 1)); cs->bcs[0].hw.tiger.send + NETJET_DMA_TXSIZE - 1);
outl(virt_to_bus(cs->bcs[0].hw.tiger.send), outl(virt_to_bus(cs->bcs[0].hw.tiger.send),
cs->hw.njet.base + NETJET_DMA_READ_START); cs->hw.njet.base + NETJET_DMA_READ_START);
outl(virt_to_bus(cs->bcs[0].hw.tiger.s_irq), outl(virt_to_bus(cs->bcs[0].hw.tiger.s_irq),
...@@ -945,8 +945,8 @@ inittiger(struct IsdnCardState *cs) ...@@ -945,8 +945,8 @@ inittiger(struct IsdnCardState *cs)
"HiSax: No memory for tiger.rec\n"); "HiSax: No memory for tiger.rec\n");
return; return;
} }
debugl1(cs, "tiger: rec buf %x - %x", (u_int)cs->bcs[0].hw.tiger.rec, debugl1(cs, "tiger: rec buf %p - %p", cs->bcs[0].hw.tiger.rec,
(u_int)(cs->bcs[0].hw.tiger.rec + NETJET_DMA_RXSIZE - 1)); cs->bcs[0].hw.tiger.rec + NETJET_DMA_RXSIZE - 1);
cs->bcs[1].hw.tiger.rec = cs->bcs[0].hw.tiger.rec; cs->bcs[1].hw.tiger.rec = cs->bcs[0].hw.tiger.rec;
memset(cs->bcs[0].hw.tiger.rec, 0xff, NETJET_DMA_RXSIZE * sizeof(unsigned int)); memset(cs->bcs[0].hw.tiger.rec, 0xff, NETJET_DMA_RXSIZE * sizeof(unsigned int));
outl(virt_to_bus(cs->bcs[0].hw.tiger.rec), outl(virt_to_bus(cs->bcs[0].hw.tiger.rec),
......
...@@ -30,7 +30,7 @@ void copy_to_pam_dword(tpam_card *card, const void *addr, u32 val) { ...@@ -30,7 +30,7 @@ void copy_to_pam_dword(tpam_card *card, const void *addr, u32 val) {
card->bar0 + TPAM_PAGE_REGISTER); card->bar0 + TPAM_PAGE_REGISTER);
/* write the value */ /* write the value */
writel(val, card->bar0 + (((u32)addr) & TPAM_PAGE_SIZE)); writel(val, card->bar0 + (((unsigned long)addr) & TPAM_PAGE_SIZE));
} }
/* /*
......
...@@ -356,9 +356,9 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg) ...@@ -356,9 +356,9 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg)
? -EFAULT : 0; ? -EFAULT : 0;
goto done; goto done;
case ATM_SETLOOP: case ATM_SETLOOP:
if (__ATM_LM_XTRMT((int) (long) buf) && if (__ATM_LM_XTRMT((int) (unsigned long) buf) &&
__ATM_LM_XTLOC((int) (long) buf) > __ATM_LM_XTLOC((int) (unsigned long) buf) >
__ATM_LM_XTRMT((int) (long) buf)) { __ATM_LM_XTRMT((int) (unsigned long) buf)) {
error = -EINVAL; error = -EINVAL;
goto done; goto done;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment