Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751955AbdFOTsU (ORCPT ); Thu, 15 Jun 2017 15:48:20 -0400 Received: from resqmta-po-12v.sys.comcast.net ([96.114.154.171]:56468 "EHLO resqmta-po-12v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750936AbdFOTsT (ORCPT ); Thu, 15 Jun 2017 15:48:19 -0400 Reply-To: shuah@kernel.org Subject: Re: [PATCH 4/4] i2c: rcar: check for DMA-capable buffers To: Wolfram Sang , Shuah Khan Cc: Wolfram Sang , linux-i2c@vger.kernel.org, linux-renesas-soc@vger.kernel.org, LKML , Shuah Khan References: <20170615183039.22925-1-wsa+renesas@sang-engineering.com> <20170615183039.22925-5-wsa+renesas@sang-engineering.com> <20170615191743.xdrvigy4h2gqk2kk@ninjato> From: Shuah Khan Message-ID: Date: Thu, 15 Jun 2017 13:48:17 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: <20170615191743.xdrvigy4h2gqk2kk@ninjato> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 8bit X-CMAE-Envelope: MS4wfLb5P9Tv8/wj7ryIVDGuGX9gEnKhk0tGNlDKlJCPowhohT1Xy4DL79RBRjY17QB89IHpUfYp+YMG7IoAhlQlolyLbgy3cF+CBCjqBB7tiFOgDNJ54pbU /OA7mBUdAWaDpM+bU5UrAbmc/jQfmKr6fIiJl5QRXOKVbscW2OKhJT6OGh977ZqBZAca+tSq90VPuyfnAJMUa8NdUfGNlREslHAqqvFWqkwsap9PVy6tysfm t1O3NekWCMofSwQzA5H36NPtZn6d/M/LL/9lD6N+LoBfaIE0DFBGoV6blxXLxTYyBfRlogTuEFat7AHnwNKpHXCuTjff9UvI1sl760W4bIMEjLrh56iDuTrr qHDW2TCqGa//1zp4E/c5EjDyEez8ALCS0GmMPGm1gJFEhUVlqBE= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1188 Lines: 37 On 06/15/2017 01:17 PM, Wolfram Sang wrote: > Hi, > >>> - /* Do not use DMA if it's not available or for messages < 8 bytes */ >>> - if (IS_ERR(chan) || msg->len < 8) >>> + if (IS_ERR(chan) || msg->len < RCAR_DMA_THRESHOLD || priv->flags & ID_P_NODMA) >> >> Might be more efficient to check for ID_P_NODMA first instead of msg->len. > > I think most of the I2C transfers are smaller (like reading/writing one > register) than the threshold, so this "should" be more efficient. Plus, > honestly, I also think this is a micro-optimization which is largely > depending on the use-case. Can we agree on that? Makes sense. > >>> - read = msg->flags & I2C_M_RD; >>> + /* we need to check here because we need the 'current' context */ >>> + if (i2c_check_msg_for_dma(msg, RCAR_DMA_THRESHOLD, NULL) == -EFAULT) { >>> + dev_dbg(dev, "skipping DMA for this whole transfer\n"); >> >> Adding reason for skipping will be helpful. > > The I2C core helper will immediately print before that the buffer is not > DMA capable. Do you think this together will do? That is sufficient. thanks, -- Shuah > > Thanks for your input, > > Wolfram >