*/
static int
keywest_xfer( struct i2c_adapter *adap,
- struct i2c_msg msgs[],
+ struct i2c_msg *msgs,
int num)
{
struct keywest_chan* chan = i2c_get_adapdata(adap);
u32 *psteps, *prate;
int rc;
+ if (np->n_intrs < 1 || np->n_addrs < 1) {
+ printk(KERN_ERR "%s: Missing interrupt or address !\n",
+ np->full_name);
+ return -ENODEV;
+ }
if (pmac_low_i2c_lock(np))
return -ENODEV;
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);
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;
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);