Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965109AbbLOMsP (ORCPT ); Tue, 15 Dec 2015 07:48:15 -0500 Received: from unicorn.mansr.com ([81.2.72.234]:40546 "EHLO unicorn.mansr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964866AbbLOMsL convert rfc822-to-8bit (ORCPT ); Tue, 15 Dec 2015 07:48:11 -0500 From: =?iso-8859-1?Q?M=E5ns_Rullg=E5rd?= To: Wolfram Sang Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/3] i2c: xlr: fix extra read/write at end of rx transfer References: <1446429818-24155-1-git-send-email-mans@mansr.com> <1446429818-24155-2-git-send-email-mans@mansr.com> <20151215122119.GB1521@katana> Date: Tue, 15 Dec 2015 12:48:06 +0000 In-Reply-To: <20151215122119.GB1521@katana> (Wolfram Sang's message of "Tue, 15 Dec 2015 13:21:19 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1510 Lines: 39 Wolfram Sang writes: > On Mon, Nov 02, 2015 at 02:03:37AM +0000, Mans Rullgard wrote: >> The BYTECNT register holds the transfer size minus one. Setting it >> to the correct value requires a dummy read/write only for zero-length >> transfers as it is impossible to request one from the hardware. If a >> zero-length transfer is requested, changing the length to 1 and setting >> "buf" to a dummy location allows making the main loops less convoluted. >> >> In other words, this patch makes the driver transfer the number of bytes >> requested unless this is zero, which is not supported by the hardware, >> in which case one byte is transferred instead. > > Uh, this is wrong, zero byte should really not transfer anything. We > need to fix that and bail out, so probably something like > > if (!len) > return -EOPNOTSUPP; So the existing driver is wrong to allow it. Makes sense to drop that. > Also, the xlr_func() should mask out I2C_FUNC_SMBUS_QUICK. OK. > Other than that, the patch looks good to me. > > Out of curiosity, your first driver had the registers 32bit apart. Now > you can deal with 8bit. Is this configurable on this SoC? It's all 32 bits. The XLR driver uses a u32 * to access the registers. -- M?ns Rullg?rd -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/