Received: by 2002:a25:2c96:0:0:0:0:0 with SMTP id s144csp1068444ybs; Mon, 25 May 2020 06:30:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQwZo1F+nn2QQAN8AozS6ApPJDfhTRSYsEuw1jdOqbPe4xZdGCZ4HbQsyh7q+zH3RHh/sJ X-Received: by 2002:a05:6402:c11:: with SMTP id co17mr15492837edb.218.1590413448578; Mon, 25 May 2020 06:30:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590413448; cv=none; d=google.com; s=arc-20160816; b=bZAVvDPsHJy4+DkbVxA1LoXVvr5lbKeaKDYyevpKexZ0ldPDc5N73Cn6si7VdD6e1M PS27isfcHWFu1TxJPlyMuYnRJZz/0DNXmdr68A9cu/o/qx5WKSyOQgfduDxCMdI2xKbm 1MI8CM9GGYHCZ+ccL2vTW8xwkIngc25Q5E8LMTvFYih/Aui1m5jdLzsqaqwW7DXf5+rO dgliOCUHlWZmkyCejpQSpggwvA+l3pwBlSpGxq6hTOGO7yeWIv+Qu2jvbfW+0QqkRiNR nnLeRSVlluPdiLMJcQdNba/PJS7M4np/Dr01Z5DPajYWFnFW9yXK3coxp9y9cAX9SNfk sfew== 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; bh=YoFRZefk/Go4CvbhR0PvrdsFKUaehxtVPeSJ88VYCkk=; b=s5cbHIfFPxncBv9v4UqArxQQX1V0vRU5IdH03D8mRGAbpjl2s1raXeWFv/jcSEmLP2 TD00ppakfbu1QWDiJHho3lCpCYCDu5MypKjZffJUROcLdT+N6OoMC7SzkLJMf/eM2fq6 eyYqQOSQfe7nX6RG2AtJRQH8cL21ZsOPeTwFokSHK7Faw2mT1mWEyR+4ujZ+9sJ/yOYV u5tFIRq6fHWXmDyh0yVCStTeJZLDDLNGZCK9J2lBF0Ew9Yt0rfsOOosq+Su1xex9p+ga tTn9QfcCKy9QsKH6LoQKCKx3j58u9v8fRTX2r3nKKZ60//SL4phnL8V8bIEGYF7jIp+s dfTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="KANHk/u+"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gv23si9272219ejb.382.2020.05.25.06.30.23; Mon, 25 May 2020 06:30:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="KANHk/u+"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390771AbgEYN1j (ORCPT + 99 others); Mon, 25 May 2020 09:27:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:44036 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388737AbgEYN1j (ORCPT ); Mon, 25 May 2020 09:27:39 -0400 Received: from localhost (fw-tnat.cambridge.arm.com [217.140.96.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CAF7C2070A; Mon, 25 May 2020 13:27:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590413258; bh=YoFRZefk/Go4CvbhR0PvrdsFKUaehxtVPeSJ88VYCkk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=KANHk/u+jIlGhMLFQ+yII/qMvYi7vti+H/M4KF9DA5bh0W/kyj1A7fkcBNuu+CXe+ kHuX3qTRNMcmvE37Q3qoi4e27X0JL7JvL0jXdfO8SjSTGZwLPLJdiUNIcIEz1yG/mW mClhznzxcgVpzBIs2Bxz8zb4jH2K1w5V9Zv8Imt4= Date: Mon, 25 May 2020 14:27:35 +0100 From: Mark Brown To: Marc Kleine-Budde Cc: Tim Harvey , open list , linux-can@vger.kernel.org, Wolfgang Grandegger , Timo =?iso-8859-1?B?U2NobPzfbGVy?= , Andy Shevchenko , linux-spi@vger.kernel.org, Jan Glauber , Robert Richter Subject: Re: [PATCH] can: mcp251x: convert to half-duplex SPI Message-ID: <20200525132735.GG4544@sirena.org.uk> References: <0ac77abd-0df5-e437-ea46-f6c77f59b81c@pengutronix.de> <0b351fe3-8fe9-572f-fd85-e2aed22873e3@pengutronix.de> <7b85e098-b9a9-dd14-203f-100cdf2e703e@pengutronix.de> <20200525113106.GB4544@sirena.org.uk> <20200525125743.GF4544@sirena.org.uk> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="RDS4xtyBfx+7DiaI" Content-Disposition: inline In-Reply-To: X-Cookie: Help a swallow land at Capistrano. User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --RDS4xtyBfx+7DiaI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, May 25, 2020 at 03:12:05PM +0200, Marc Kleine-Budde wrote: > On 5/25/20 2:57 PM, Mark Brown wrote: > > On Mon, May 25, 2020 at 02:41:31PM +0200, Marc Kleine-Budde wrote: > >> On 5/25/20 1:31 PM, Mark Brown wrote: > >> The core could merge several half duplex transfers (until there's as c= s_change) > >> into a single full duplex transfer. > > Yes, that is what I am suggesting. > Where in the SPI stack do you see such a "merge" function? One point to c= larify > is when and where to allocate and free the memory for the contiguous full= duplex > buffers. My first thought would be about the same point as we're rewriting to handle MUST_TX and MUST_RX in map_msg() which does similar allocations and deallocations to insert dummy data for controllers that need them. > >> I think spi_write_then_read() can be extended to generate one full dup= lex > >> transfer instead on two half duplex ones it does a memcpy() anyways. > > This has the same problem as doing it in any other driver code - it > > causes a needless incompatibility with three wire and single duplex > > devices. =20 > What about the note "portable code should never use this for more than 32= bytes" > in spi_write_then_read()? The CAN driver in question may read more than 3= 2 bytes > of data. I think that comment is actually not valid any more - we used to use a fixed statically allocated buffer in write_then_read() but added the option to fall back onto allocating one dynamically if another user was running or the transfer was too big. --RDS4xtyBfx+7DiaI Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAl7Lx8YACgkQJNaLcl1U h9B5Dwf+Nb0Y72rxDJYz31zxtSePYg23wFswccy4280iAkIcWoMJkffzIpNnd6/k nn/tJvLg9vt7nnkCRv+a9RXBpLOHughiGTEojzSerkrqLkDEED21ZF+LmgQK4Qwr ORu3nHDWmW46BNo9/Syr7+vDUcPbx11A6LY7/W6f1LMXAXzKHZulq2gcykRgi21I 30jryinvYDsb2nrKRhzNBDASIgyLiNUkOpPGVsN0rXY1K8Avt7Gua8LzRR1ztACM r4I3zCdiR4lZ6UJ9ioEpvWd6jqGYsbcDBJGCDHjtUJSgNvqzwr7e9KerHz0IS2+P LLhgvEFtAZjQUJKkM2vkOezK0Ft0JQ== =Yw0T -----END PGP SIGNATURE----- --RDS4xtyBfx+7DiaI--