Commit 5314355a authored by Wolfram Sang's avatar Wolfram Sang Committed by Wolfram Sang

i2c: stu300: use core to detect 'no zero length' quirk

And don't reimplement in the driver.
Signed-off-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
parent 22dda3e4
......@@ -673,12 +673,6 @@ static int stu300_xfer_msg(struct i2c_adapter *adap,
msg->addr, msg->len, msg->flags, stop);
}
/* Zero-length messages are not supported by this hardware */
if (msg->len == 0) {
ret = -EINVAL;
goto exit_disable;
}
/*
* For some reason, sending the address sometimes fails when running
* on the 13 MHz clock. No interrupt arrives. This is a work around,
......@@ -863,6 +857,10 @@ static const struct i2c_algorithm stu300_algo = {
.functionality = stu300_func,
};
static const struct i2c_adapter_quirks stu300_quirks = {
.flags = I2C_AQ_NO_ZERO_LEN,
};
static int stu300_probe(struct platform_device *pdev)
{
struct stu300_dev *dev;
......@@ -920,6 +918,8 @@ static int stu300_probe(struct platform_device *pdev)
adap->algo = &stu300_algo;
adap->dev.parent = &pdev->dev;
adap->dev.of_node = pdev->dev.of_node;
adap->quirks = &stu300_quirks;
i2c_set_adapdata(adap, dev);
/* i2c device drivers may be active on return from add_adapter() */
......
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