Received: by 10.223.176.46 with SMTP id f43csp1102175wra; Wed, 24 Jan 2018 10:38:57 -0800 (PST) X-Google-Smtp-Source: AH8x227YKZRM2ah3h3ICXUKmUsYegUTaGB8sZ3YcVtPYbsWSzGU2vnKLp9Y6KTlzJGbZwgEjzqOw X-Received: by 2002:a17:902:694a:: with SMTP id k10-v6mr8486194plt.301.1516819137513; Wed, 24 Jan 2018 10:38:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516819137; cv=none; d=google.com; s=arc-20160816; b=LfkfzLoq/zOuiojXSbMbTIJnYlTfbrs9InqPPpSf0/y3VAAZCqJ2iwgLxF4oOZm4mv QebZqdSkJU6LmrGesa4Shk8Us5p/PDoZ3G0fAcy/m8tn8pKVmDHrxxPa+UFfXDZYjTav 8DETdGt2FHNIIA92P140UHhKwX7sf6lLHrdp0MXFKykfw8y7Y+9xa+18I6qpYMgnUFV8 /+OaFVHkeGybWD6lwrdR+JvRN2KxGNULbfPYO4wqF+725xL9qI3s7wpwph6+eGjFyaCF vPuuMoFAjR22arrq1GfJrADl9dWU4UM06TzQ1DWmpyQK2pAugAp7udtvhPENHZwcw7kA MpWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=h4iqnVsXlO1jwFOCE16GJHlhE7sJKkAOk0eAXpvuFnQ=; b=wRtNorHr+RPzxpbsDw3QssNBLXr68M1oYLoI9hQCCgcTBq9eWg57QiEIrPFxMYf7Wo rsAaIc+A9hBVkWxnz3pTEjPM7ZfoiOE7Le3spviGtL06dyiQ8yApjqPhN0lFaNZmprb6 zg3YjypdLzl5bDDipgrY1WaylqPugQJmrK5sLhHgpz+faQbtuSRMa/ZplkH+YLWvaIHG onlatAhgHKPC9WXMBBfjo7CyWKbYvEhlEQdwNCtz6G1qqVLQFjePxcot0ZM956TXJGGX FUgZV4ecM5TysVkG+Z4WP6stZsGBZKTSs42YqLKPAUntfhAeu7NIiuy2ESOvbII2phRI ybvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=W9Renp2d; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b7si448062pgq.275.2018.01.24.10.38.43; Wed, 24 Jan 2018 10:38:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=W9Renp2d; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965213AbeAXShy (ORCPT + 99 others); Wed, 24 Jan 2018 13:37:54 -0500 Received: from mail-pf0-f194.google.com ([209.85.192.194]:39572 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964989AbeAXShw (ORCPT ); Wed, 24 Jan 2018 13:37:52 -0500 Received: by mail-pf0-f194.google.com with SMTP id e11so3770583pff.6 for ; Wed, 24 Jan 2018 10:37:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=h4iqnVsXlO1jwFOCE16GJHlhE7sJKkAOk0eAXpvuFnQ=; b=W9Renp2dTqacIrBJ+3Xpl8jiRCCzruyzitmc2UseLax08Lk6s7DPyFYvfLLPpuyaJY VZ8IEvd+dP6LP0SR4oTheP+s2Ww7Hqfm9I4YJvJLYbhOg2nqYRZ+byNg67oPwqi4Ovq9 L27n6y1oXLy2ZvAcuQC9/9GgEVbIPSDt7lL/c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=h4iqnVsXlO1jwFOCE16GJHlhE7sJKkAOk0eAXpvuFnQ=; b=ZbcJ8od5Ka7Efw6Q4hq6ygdUI6hBoG3+hyfAJPgZPIyUB/T3+SYG6cWsPfL5Umhwez pW226SzepkLammZE2P7vTh445kOtuRrMbIFPpqDnKjS25URvlHk8y5ME0QuGaFhe2UbZ hUPk15UpS+ajdi6UzdkjD9S2tJUpjYGYpLZB77Jb98it/NOPrsgA5IzxnbfJgp5cA+FX mwAMq37Ik9wufcmUh5wVBq1y4vhOT8FSvMcjOcoZNVtVv7gmUjylKa4AFCU8zipjhBXi UQu7EAWETYv4dskdFjUoZOPluoHdEysdUaZStu5kE5OzAw1/fibzB2Wkg63sf36MJ2ra 7PDA== X-Gm-Message-State: AKwxytedo9bFoBIaeQAU5SO+SpbNFVZhoEefIKjZ8xBW3oOSnXRg6H89 JjCK4uX9zUe4uQLXz79Fqo+6Mg== X-Received: by 10.98.67.82 with SMTP id q79mr13569447pfa.144.1516819071477; Wed, 24 Jan 2018 10:37:51 -0800 (PST) Received: from ban.mtv.corp.google.com ([172.22.113.17]) by smtp.gmail.com with ESMTPSA id d22sm11991821pfl.135.2018.01.24.10.37.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Jan 2018 10:37:50 -0800 (PST) Date: Wed, 24 Jan 2018 10:37:49 -0800 From: Brian Norris To: Philippe CORNU Cc: "linux-arm-kernel@lists.infradead.org" , Maxime Coquelin , "open list:ARM/Rockchip SoC..." , David Airlie , Linux Kernel , "dri-devel@lists.freedesktop.org" , Yannick FERTRE , Laurent Pinchart , Ludovic BARRE , Mickael REULIER , Vincent ABRIOU , Bhumika Goyal , Alexandre TORGUE Subject: Re: [PATCH v1 1/2] drm/bridge/synopsys: dsi: Fix dsi_host_transfer() return value Message-ID: <20180124183748.l5iqoiyqxy4o2pyk@ban.mtv.corp.google.com> References: <20180123142618.28384-1-philippe.cornu@st.com> <20180123142618.28384-2-philippe.cornu@st.com> <4a1b0208-3187-2f08-69fe-ca3b77ee88a8@st.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4a1b0208-3187-2f08-69fe-ca3b77ee88a8@st.com> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Philippe, On Wed, Jan 24, 2018 at 01:33:54PM +0000, Philippe CORNU wrote: > On 01/23/2018 10:38 PM, Brian Norris wrote: > > Hi Philippe, > > > > On Tue, Jan 23, 2018 at 6:26 AM, Philippe Cornu wrote: > >> The dw_mipi_dsi_host_transfer() must return the number of > >> bytes transmitted/received on success instead of 0. > > > > I'm a little confused. As of the latest drm-misc-next I'm looking at, > > this still has conflicting documentation. > > > > For ->transfer(): > > > > On success it shall return the number of bytes > > * transmitted for write packets or the number of bytes received for read > > * packets. > > > > While mipi_dsi_generic_read() says: > > > > * Return: The number of bytes successfully read or a negative error code on > > * failure. > > > > But it just returns the value that ->transfer() returns. > > > > Not sure to follow you here: mipi_dsi_generic_read() will trig a dsi > generic read so it has to return "the number of bytes received for read > packets" as explained for the ->transfer() function... so it looks > "coherent"... > > But maybe you want to point out something different? Actually, reading back what I wrote, I'm not sure it made sense. I think *I* was confusing "supporting TX only" with "supporting TX and RX". I believe the documentation isn't conflicting, but your current patch is a little misleading. With your current patch, you're returning the 'mipi_dsi_packet::size', which is the sum of both TX and RX. Since we only support TX right now, I suppose that actually is fine (because 'rx_len == 0'). But if we start supporting RX too, then this field is not the right one to return. Anyway, maybe this patch was fine as it was. But when you get RX support, this will have to be something like: if (msg->rx_len) return msg->rx_len; else return packet.size; BTW, does anyone actually care about seeing the number of TX bytes returned? That seems weird, because I wouldn't expect you'd get a good result from a partial TX (dunno about partial RX). And I also see that there are other drivers that get this all wrong too. See mtk_dsi_host_transfer(), which only returns 0 for TX and 'recv_cnt' for RX. So all-in-all, maybe my problem isn't that the documentation is conflicting, exactly, but that the requirements are somewhat odd, such that either implementations get it wrong (2 of 3 that I've looked at!), or they have to write somewhat odd special-casing. > > So I'm not sure whether the documentation is still wrong, or if the > > implementation is. > > > > Anyway, I guess maybe that isn't super-critical to *this* patch, since > > we don't have RX support yet... > > > > The main reason why I want to "fix" this is because I do not want to > explain to our customers (writing dsi panel drivers) why we have a > different returned value compare to other platforms : ) Brian