Commit 9103e0b4 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] i2c iomem annotations

Signed-off-by: default avatarAl Viro <viro@parcelfarce.linux.theplanet.co.uk>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent ecc5f0b8
......@@ -81,7 +81,7 @@ MODULE_PARM_DESC(iic_fast_poll, "Force fast mode (400 kHz)");
#if DBG_LEVEL > 2
static void dump_iic_regs(const char* header, struct ibm_iic_private* dev)
{
volatile struct iic_regs *iic = dev->vaddr;
volatile struct iic_regs __iomem *iic = dev->vaddr;
printk(KERN_DEBUG "ibm-iic%d: %s\n", dev->idx, header);
printk(KERN_DEBUG " cntl = 0x%02x, mdcntl = 0x%02x\n"
KERN_DEBUG " sts = 0x%02x, extsts = 0x%02x\n"
......@@ -132,7 +132,7 @@ static inline void iic_interrupt_mode(struct ibm_iic_private* dev, int enable)
*/
static void iic_dev_init(struct ibm_iic_private* dev)
{
volatile struct iic_regs *iic = dev->vaddr;
volatile struct iic_regs __iomem *iic = dev->vaddr;
DBG("%d: init\n", dev->idx);
......@@ -177,7 +177,7 @@ static void iic_dev_init(struct ibm_iic_private* dev)
*/
static void iic_dev_reset(struct ibm_iic_private* dev)
{
volatile struct iic_regs *iic = dev->vaddr;
volatile struct iic_regs __iomem *iic = dev->vaddr;
int i;
u8 dc;
......@@ -225,7 +225,7 @@ static void iic_dev_reset(struct ibm_iic_private* dev)
*/
/* Wait for SCL and/or SDA to be high */
static int iic_dc_wait(volatile struct iic_regs *iic, u8 mask)
static int iic_dc_wait(volatile struct iic_regs __iomem *iic, u8 mask)
{
unsigned long x = jiffies + HZ / 28 + 2;
while ((in_8(&iic->directcntl) & mask) != mask){
......@@ -238,7 +238,7 @@ static int iic_dc_wait(volatile struct iic_regs *iic, u8 mask)
static int iic_smbus_quick(struct ibm_iic_private* dev, const struct i2c_msg* p)
{
volatile struct iic_regs* iic = dev->vaddr;
volatile struct iic_regs __iomem *iic = dev->vaddr;
const struct i2c_timings* t = &timings[dev->fast_mode ? 1 : 0];
u8 mask, v, sda;
int i, res;
......@@ -324,7 +324,7 @@ static int iic_smbus_quick(struct ibm_iic_private* dev, const struct i2c_msg* p)
static irqreturn_t iic_handler(int irq, void *dev_id, struct pt_regs *regs)
{
struct ibm_iic_private* dev = (struct ibm_iic_private*)dev_id;
volatile struct iic_regs* iic = dev->vaddr;
volatile struct iic_regs __iomem *iic = dev->vaddr;
DBG2("%d: irq handler, STS = 0x%02x, EXTSTS = 0x%02x\n",
dev->idx, in_8(&iic->sts), in_8(&iic->extsts));
......@@ -342,7 +342,7 @@ static irqreturn_t iic_handler(int irq, void *dev_id, struct pt_regs *regs)
*/
static int iic_xfer_result(struct ibm_iic_private* dev)
{
volatile struct iic_regs *iic = dev->vaddr;
volatile struct iic_regs __iomem *iic = dev->vaddr;
if (unlikely(in_8(&iic->sts) & STS_ERR)){
DBG("%d: xfer error, EXTSTS = 0x%02x\n", dev->idx,
......@@ -375,7 +375,7 @@ static int iic_xfer_result(struct ibm_iic_private* dev)
*/
static void iic_abort_xfer(struct ibm_iic_private* dev)
{
volatile struct iic_regs *iic = dev->vaddr;
volatile struct iic_regs __iomem *iic = dev->vaddr;
unsigned long x;
DBG("%d: iic_abort_xfer\n", dev->idx);
......@@ -407,7 +407,7 @@ static void iic_abort_xfer(struct ibm_iic_private* dev)
*/
static int iic_wait_for_tc(struct ibm_iic_private* dev){
volatile struct iic_regs *iic = dev->vaddr;
volatile struct iic_regs __iomem *iic = dev->vaddr;
int ret = 0;
if (dev->irq >= 0){
......@@ -458,7 +458,7 @@ static int iic_wait_for_tc(struct ibm_iic_private* dev){
static int iic_xfer_bytes(struct ibm_iic_private* dev, struct i2c_msg* pm,
int combined_xfer)
{
volatile struct iic_regs *iic = dev->vaddr;
volatile struct iic_regs __iomem *iic = dev->vaddr;
char* buf = pm->buf;
int i, j, loops, ret = 0;
int len = pm->len;
......@@ -474,7 +474,7 @@ static int iic_xfer_bytes(struct ibm_iic_private* dev, struct i2c_msg* pm,
if (!(cntl & CNTL_RW))
for (j = 0; j < count; ++j)
out_8((volatile u8*)&iic->mdbuf, *buf++);
out_8((void __iomem *)&iic->mdbuf, *buf++);
if (i < loops - 1)
cmd |= CNTL_CHT;
......@@ -505,7 +505,7 @@ static int iic_xfer_bytes(struct ibm_iic_private* dev, struct i2c_msg* pm,
if (cntl & CNTL_RW)
for (j = 0; j < count; ++j)
*buf++ = in_8((volatile u8*)&iic->mdbuf);
*buf++ = in_8((void __iomem *)&iic->mdbuf);
}
return ret > 0 ? 0 : ret;
......@@ -516,7 +516,7 @@ static int iic_xfer_bytes(struct ibm_iic_private* dev, struct i2c_msg* pm,
*/
static inline void iic_address(struct ibm_iic_private* dev, struct i2c_msg* msg)
{
volatile struct iic_regs *iic = dev->vaddr;
volatile struct iic_regs __iomem *iic = dev->vaddr;
u16 addr = msg->addr;
DBG2("%d: iic_address, 0x%03x (%d-bit)\n", dev->idx,
......@@ -552,7 +552,7 @@ static inline int iic_address_neq(const struct i2c_msg* p1,
static int iic_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
{
struct ibm_iic_private* dev = (struct ibm_iic_private*)(i2c_get_adapdata(adap));
volatile struct iic_regs *iic = dev->vaddr;
volatile struct iic_regs __iomem *iic = dev->vaddr;
int i, ret = 0;
DBG2("%d: iic_xfer, %d msg(s)\n", dev->idx, num);
......@@ -755,9 +755,9 @@ static int __devinit iic_probe(struct ocp_device *ocp){
free_irq(dev->irq, dev);
}
iounmap((void*)dev->vaddr);
iounmap(dev->vaddr);
fail2:
ocp_set_drvdata(ocp, 0);
ocp_set_drvdata(ocp, NULL);
kfree(dev);
return ret;
}
......@@ -783,7 +783,7 @@ static void __devexit iic_remove(struct ocp_device *ocp)
iic_interrupt_mode(dev, 0);
free_irq(dev->irq, dev);
}
iounmap((void*)dev->vaddr);
iounmap(dev->vaddr);
kfree(dev);
}
}
......
......@@ -45,7 +45,7 @@ struct iic_regs {
struct ibm_iic_private {
struct i2c_adapter adap;
volatile struct iic_regs *vaddr;
volatile struct iic_regs __iomem *vaddr;
wait_queue_head_t wq;
int idx;
int irq;
......
......@@ -552,9 +552,9 @@ create_iface(struct device_node *np, struct device *dev)
iface->irq = np->intrs[0].line;
iface->channels = (struct keywest_chan *)
(((unsigned long)(iface + 1) + 3UL) & ~3UL);
iface->base = (unsigned long)ioremap(np->addrs[0].address + addroffset,
iface->base = ioremap(np->addrs[0].address + addroffset,
np->addrs[0].size);
if (iface->base == 0) {
if (!iface->base) {
printk(KERN_ERR "i2c-keywest: can't map inteface !\n");
kfree(iface);
pmac_low_i2c_unlock(np);
......@@ -600,7 +600,7 @@ create_iface(struct device_node *np, struct device *dev)
rc = request_irq(iface->irq, keywest_irq, SA_INTERRUPT, "keywest i2c", iface);
if (rc) {
printk(KERN_ERR "i2c-keywest: can't get IRQ %d !\n", iface->irq);
iounmap((void *)iface->base);
iounmap(iface->base);
kfree(iface);
pmac_low_i2c_unlock(np);
return -ENODEV;
......@@ -685,7 +685,7 @@ dispose_iface(struct device *dev)
if (rc)
printk("i2c-keywest.c: i2c_del_adapter failed, that's bad !\n");
}
iounmap((void *)iface->base);
iounmap(iface->base);
dev_set_drvdata(dev, NULL);
of_node_put(iface->node);
kfree(iface);
......
......@@ -52,7 +52,7 @@ typedef enum {
struct keywest_iface
{
struct device_node *node;
unsigned long base;
void __iomem * base;
unsigned bsteps;
int irq;
spinlock_t lock;
......@@ -89,13 +89,13 @@ struct keywest_chan
static inline u8 __read_reg(struct keywest_iface *iface, reg_t reg)
{
return in_8(((volatile u8 *)iface->base)
return in_8(iface->base
+ (((unsigned)reg) << iface->bsteps));
}
static inline void __write_reg(struct keywest_iface *iface, reg_t reg, u8 val)
{
out_8(((volatile u8 *)iface->base)
out_8(iface->base
+ (((unsigned)reg) << iface->bsteps), val);
(void)__read_reg(iface, reg_subaddr);
}
......
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