i2c: ocores: checkpatch fixes
Miscellaneous style fixes from checkpatch Signed-off-by: Federico Vaga <federico.vaga@cern.ch> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
This commit is contained in:
parent
2c7e4928b3
commit
fac9c29fc7
@ -179,8 +179,9 @@ static void ocores_process(struct ocores_i2c *i2c, u8 stat)
|
|||||||
oc_setreg(i2c, OCI2C_CMD, OCI2C_CMD_STOP);
|
oc_setreg(i2c, OCI2C_CMD, OCI2C_CMD_STOP);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
msg->buf[i2c->pos++] = oc_getreg(i2c, OCI2C_DATA);
|
msg->buf[i2c->pos++] = oc_getreg(i2c, OCI2C_DATA);
|
||||||
|
}
|
||||||
|
|
||||||
/* end of msg? */
|
/* end of msg? */
|
||||||
if (i2c->pos == msg->len) {
|
if (i2c->pos == msg->len) {
|
||||||
@ -199,7 +200,7 @@ static void ocores_process(struct ocores_i2c *i2c, u8 stat)
|
|||||||
oc_setreg(i2c, OCI2C_DATA, addr);
|
oc_setreg(i2c, OCI2C_DATA, addr);
|
||||||
oc_setreg(i2c, OCI2C_CMD, OCI2C_CMD_START);
|
oc_setreg(i2c, OCI2C_CMD, OCI2C_CMD_START);
|
||||||
goto out;
|
goto out;
|
||||||
} else
|
}
|
||||||
i2c->state = (msg->flags & I2C_M_RD)
|
i2c->state = (msg->flags & I2C_M_RD)
|
||||||
? STATE_READ : STATE_WRITE;
|
? STATE_READ : STATE_WRITE;
|
||||||
} else {
|
} else {
|
||||||
@ -461,13 +462,16 @@ static const struct of_device_id ocores_i2c_match[] = {
|
|||||||
MODULE_DEVICE_TABLE(of, ocores_i2c_match);
|
MODULE_DEVICE_TABLE(of, ocores_i2c_match);
|
||||||
|
|
||||||
#ifdef CONFIG_OF
|
#ifdef CONFIG_OF
|
||||||
/* Read and write functions for the GRLIB port of the controller. Registers are
|
/*
|
||||||
|
* Read and write functions for the GRLIB port of the controller. Registers are
|
||||||
* 32-bit big endian and the PRELOW and PREHIGH registers are merged into one
|
* 32-bit big endian and the PRELOW and PREHIGH registers are merged into one
|
||||||
* register. The subsequent registers has their offset decreased accordingly. */
|
* register. The subsequent registers have their offsets decreased accordingly.
|
||||||
|
*/
|
||||||
static u8 oc_getreg_grlib(struct ocores_i2c *i2c, int reg)
|
static u8 oc_getreg_grlib(struct ocores_i2c *i2c, int reg)
|
||||||
{
|
{
|
||||||
u32 rd;
|
u32 rd;
|
||||||
int rreg = reg;
|
int rreg = reg;
|
||||||
|
|
||||||
if (reg != OCI2C_PRELOW)
|
if (reg != OCI2C_PRELOW)
|
||||||
rreg--;
|
rreg--;
|
||||||
rd = ioread32be(i2c->base + (rreg << i2c->reg_shift));
|
rd = ioread32be(i2c->base + (rreg << i2c->reg_shift));
|
||||||
@ -481,6 +485,7 @@ static void oc_setreg_grlib(struct ocores_i2c *i2c, int reg, u8 value)
|
|||||||
{
|
{
|
||||||
u32 curr, wr;
|
u32 curr, wr;
|
||||||
int rreg = reg;
|
int rreg = reg;
|
||||||
|
|
||||||
if (reg != OCI2C_PRELOW)
|
if (reg != OCI2C_PRELOW)
|
||||||
rreg--;
|
rreg--;
|
||||||
if (reg == OCI2C_PRELOW || reg == OCI2C_PREHIGH) {
|
if (reg == OCI2C_PRELOW || reg == OCI2C_PREHIGH) {
|
||||||
@ -686,10 +691,11 @@ err_clk:
|
|||||||
static int ocores_i2c_remove(struct platform_device *pdev)
|
static int ocores_i2c_remove(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct ocores_i2c *i2c = platform_get_drvdata(pdev);
|
struct ocores_i2c *i2c = platform_get_drvdata(pdev);
|
||||||
|
u8 ctrl = oc_getreg(i2c, OCI2C_CONTROL);
|
||||||
|
|
||||||
/* disable i2c logic */
|
/* disable i2c logic */
|
||||||
oc_setreg(i2c, OCI2C_CONTROL, oc_getreg(i2c, OCI2C_CONTROL)
|
ctrl &= ~(OCI2C_CTRL_EN | OCI2C_CTRL_IEN);
|
||||||
& ~(OCI2C_CTRL_EN|OCI2C_CTRL_IEN));
|
oc_setreg(i2c, OCI2C_CONTROL, ctrl);
|
||||||
|
|
||||||
/* remove adapter & data */
|
/* remove adapter & data */
|
||||||
i2c_del_adapter(&i2c->adap);
|
i2c_del_adapter(&i2c->adap);
|
||||||
@ -707,7 +713,8 @@ static int ocores_i2c_suspend(struct device *dev)
|
|||||||
u8 ctrl = oc_getreg(i2c, OCI2C_CONTROL);
|
u8 ctrl = oc_getreg(i2c, OCI2C_CONTROL);
|
||||||
|
|
||||||
/* make sure the device is disabled */
|
/* make sure the device is disabled */
|
||||||
oc_setreg(i2c, OCI2C_CONTROL, ctrl & ~(OCI2C_CTRL_EN|OCI2C_CTRL_IEN));
|
ctrl &= ~(OCI2C_CTRL_EN | OCI2C_CTRL_IEN);
|
||||||
|
oc_setreg(i2c, OCI2C_CONTROL, ctrl);
|
||||||
|
|
||||||
if (!IS_ERR(i2c->clk))
|
if (!IS_ERR(i2c->clk))
|
||||||
clk_disable_unprepare(i2c->clk);
|
clk_disable_unprepare(i2c->clk);
|
||||||
|
Loading…
Reference in New Issue
Block a user