Re: [RFC 1/1] drivers: i2c: omap: Add slave support

From: Manish Badarkhe
Date: Thu May 26 2016 - 12:07:28 EST


Hi Ravikumar

Some sanity comments, just good to have.

> +#ifdef CONFIG_I2C_SLAVE
> +static int omap_i2c_slave_irq(struct omap_i2c_dev *omap)
> +{
> + u16 stat_raw;
> + u16 stat;
> + u16 bits;
> + u8 value;
> +
> + stat_raw = omap_i2c_read_reg(omap, OMAP_I2C_IP_V2_IRQSTATUS_RAW);
> + bits = omap_i2c_read_reg(omap, OMAP_I2C_IE_REG);
> + stat_raw &= bits;
> +
> + if (stat_raw & OMAP_I2C_STAT_AAS) {
> + omap_i2c_ack_stat(omap, OMAP_I2C_STAT_AAS);
> + stat_raw &= ~OMAP_I2C_STAT_AAS;
> + }
> +
> +out:
> + return 0;
> +}
> +#endif

This function always return 0.

> +#ifdef CONFIG_I2C_SLAVE
> +static int omap_i2c_reg_slave(struct i2c_client *slave)
> +{
> + struct omap_i2c_dev *omap = i2c_get_adapdata(slave->adapter);
> + u16 reg;
> + int ret = 0;
> + /* Enable necessary interrupts */
> + omap_i2c_write_reg(omap, OMAP_I2C_IE_REG, omap->iestate);
> +
> + return 0;
> +
> +}

Better to return "ret" here as already been initialized to 0

> +
> +static int omap_i2c_unreg_slave(struct i2c_client *slave)
> +{
> + struct omap_i2c_dev *omap = i2c_get_adapdata(slave->adapter);
> + u16 reg;
> +
> + pm_runtime_put(omap->dev);
> + return 0;
> +}
> +#endif

This function always return 0


Regards
Manish Badarkhe