linux-mips
[Top] [All Lists]

[RFC V2 08/12] i2c: dln2: make use of the new infrastructure for quirks

To: linux-i2c@vger.kernel.org
Subject: [RFC V2 08/12] i2c: dln2: make use of the new infrastructure for quirks
From: Wolfram Sang <wsa@the-dreams.de>
Date: Wed, 25 Feb 2015 17:01:59 +0100
Cc: linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-mips@linux-mips.org, Benjamin Herrenschmidt <benh@kernel.crashing.org>, Ludovic Desroches <ludovic.desroches@atmel.com>, Yingjoe Chen <yingjoe.chen@mediatek.com>, Eddie Huang <eddie.huang@mediatek.com>, Wolfram Sang <wsa@the-dreams.de>, linux-kernel@vger.kernel.org
In-reply-to: <1424880126-15047-1-git-send-email-wsa@the-dreams.de>
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <1424880126-15047-1-git-send-email-wsa@the-dreams.de>
Sender: linux-mips-bounce@linux-mips.org
From: Wolfram Sang <wsa+renesas@sang-engineering.com>

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/i2c/busses/i2c-dln2.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/i2c/busses/i2c-dln2.c b/drivers/i2c/busses/i2c-dln2.c
index b3fb86af4cbb14..b6f9ba7eb17564 100644
--- a/drivers/i2c/busses/i2c-dln2.c
+++ b/drivers/i2c/busses/i2c-dln2.c
@@ -144,7 +144,6 @@ static int dln2_i2c_xfer(struct i2c_adapter *adapter,
 {
        struct dln2_i2c *dln2 = i2c_get_adapdata(adapter);
        struct i2c_msg *pmsg;
-       struct device *dev = &dln2->adapter.dev;
        int i;
 
        for (i = 0; i < num; i++) {
@@ -152,11 +151,6 @@ static int dln2_i2c_xfer(struct i2c_adapter *adapter,
 
                pmsg = &msgs[i];
 
-               if (pmsg->len > DLN2_I2C_MAX_XFER_SIZE) {
-                       dev_warn(dev, "maximum transfer size exceeded\n");
-                       return -EOPNOTSUPP;
-               }
-
                if (pmsg->flags & I2C_M_RD) {
                        ret = dln2_i2c_read(dln2, pmsg->addr, pmsg->buf,
                                            pmsg->len);
@@ -187,6 +181,11 @@ static const struct i2c_algorithm dln2_i2c_usb_algorithm = 
{
        .functionality = dln2_i2c_func,
 };
 
+static struct i2c_adapter_quirks dln2_i2c_quirks = {
+       .max_read_len = DLN2_I2C_MAX_XFER_SIZE,
+       .max_write_len = DLN2_I2C_MAX_XFER_SIZE,
+};
+
 static int dln2_i2c_probe(struct platform_device *pdev)
 {
        int ret;
@@ -209,6 +208,7 @@ static int dln2_i2c_probe(struct platform_device *pdev)
        dln2->adapter.owner = THIS_MODULE;
        dln2->adapter.class = I2C_CLASS_HWMON;
        dln2->adapter.algo = &dln2_i2c_usb_algorithm;
+       dln2->adapter.quirks = &dln2_i2c_quirks;
        dln2->adapter.dev.parent = dev;
        i2c_set_adapdata(&dln2->adapter, dln2);
        snprintf(dln2->adapter.name, sizeof(dln2->adapter.name), "%s-%s-%d",
-- 
2.1.4


<Prev in Thread] Current Thread [Next in Thread>