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)
if (alignment <= 0x10) {
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);
kfree (t);
return aligned_kmalloc (size, flags, alignment * 4);
......
......@@ -94,8 +94,8 @@ static int mwave_open(struct inode *inode, struct file *file)
unsigned int retval = 0;
PRINTK_3(TRACE_MWAVE,
"mwavedd::mwave_open, entry inode %x file %x\n",
(int) inode, (int) file);
"mwavedd::mwave_open, entry inode %p file %p\n",
inode, file);
PRINTK_2(TRACE_MWAVE,
"mwavedd::mwave_open, exit return retval %x\n", retval);
......@@ -107,8 +107,8 @@ static int mwave_close(struct inode *inode, struct file *file)
unsigned int retval = 0;
PRINTK_3(TRACE_MWAVE,
"mwavedd::mwave_close, entry inode %x file %x\n",
(int) inode, (int) file);
"mwavedd::mwave_close, entry inode %p file %p\n",
inode, file);
PRINTK_2(TRACE_MWAVE, "mwavedd::mwave_close, exit retval %x\n",
retval);
......@@ -124,8 +124,8 @@ static int mwave_ioctl(struct inode *inode, struct file *file,
void __user *arg = (void __user *)ioarg;
PRINTK_5(TRACE_MWAVE,
"mwavedd::mwave_ioctl, entry inode %x file %x cmd %x arg %x\n",
(int) inode, (int) file, iocmd, (int) ioarg);
"mwavedd::mwave_ioctl, entry inode %p file %p cmd %x arg %x\n",
inode, file, iocmd, (int) ioarg);
switch (iocmd) {
......
......@@ -99,7 +99,7 @@ static void EnableSRAM(THINKPAD_BD_DATA * pBDData)
static irqreturn_t UartInterrupt(int irq, void *dev_id, struct pt_regs *regs)
{
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;
}
......@@ -111,7 +111,7 @@ static irqreturn_t DspInterrupt(int irq, void *dev_id, struct pt_regs *regs)
unsigned short usIPCSource = 0, usIsolationMask, usPCNum;
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) {
PRINTK_2(TRACE_TP3780I,
......
......@@ -701,8 +701,8 @@ static void write_raw(struct BCState *bcs, u_int *buf, int cnt) {
}
bcs->hw.tiger.s_tot += s_cnt;
if (bcs->cs->debug & L1_DEB_HSCX)
debugl1(bcs->cs,"tiger write_raw: c%d %x-%x %d/%d %d %x", bcs->channel,
(u_int)buf, (u_int)p, s_cnt, cnt,
debugl1(bcs->cs,"tiger write_raw: c%d %p-%p %d/%d %d %x", bcs->channel,
buf, p, s_cnt, cnt,
bcs->hw.tiger.sendcnt, bcs->cs->hw.njet.irqstat0);
if (bcs->cs->debug & L1_DEB_HSCX_FIFO)
printframe(bcs->cs, bcs->hw.tiger.sp, s_cnt, "snd");
......@@ -931,8 +931,8 @@ inittiger(struct IsdnCardState *cs)
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));
debugl1(cs, "tiger: send buf %x - %x", (u_int)cs->bcs[0].hw.tiger.send,
(u_int)(cs->bcs[0].hw.tiger.send + NETJET_DMA_TXSIZE - 1));
debugl1(cs, "tiger: send buf %p - %p", cs->bcs[0].hw.tiger.send,
cs->bcs[0].hw.tiger.send + NETJET_DMA_TXSIZE - 1);
outl(virt_to_bus(cs->bcs[0].hw.tiger.send),
cs->hw.njet.base + NETJET_DMA_READ_START);
outl(virt_to_bus(cs->bcs[0].hw.tiger.s_irq),
......@@ -945,8 +945,8 @@ inittiger(struct IsdnCardState *cs)
"HiSax: No memory for tiger.rec\n");
return;
}
debugl1(cs, "tiger: rec buf %x - %x", (u_int)cs->bcs[0].hw.tiger.rec,
(u_int)(cs->bcs[0].hw.tiger.rec + NETJET_DMA_RXSIZE - 1));
debugl1(cs, "tiger: rec buf %p - %p", cs->bcs[0].hw.tiger.rec,
cs->bcs[0].hw.tiger.rec + NETJET_DMA_RXSIZE - 1);
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));
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) {
card->bar0 + TPAM_PAGE_REGISTER);
/* 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)
? -EFAULT : 0;
goto done;
case ATM_SETLOOP:
if (__ATM_LM_XTRMT((int) (long) buf) &&
__ATM_LM_XTLOC((int) (long) buf) >
__ATM_LM_XTRMT((int) (long) buf)) {
if (__ATM_LM_XTRMT((int) (unsigned long) buf) &&
__ATM_LM_XTLOC((int) (unsigned long) buf) >
__ATM_LM_XTRMT((int) (unsigned long) buf)) {
error = -EINVAL;
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