Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2778406pxu; Mon, 14 Dec 2020 10:38:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJy43PetGTrY6jxdsmpemc2ad696l0Ht0THO0KeupT+Cc8pas/cpHr396J3XBq8T18+420qL X-Received: by 2002:a17:906:144e:: with SMTP id q14mr23125549ejc.150.1607971126012; Mon, 14 Dec 2020 10:38:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607971126; cv=none; d=google.com; s=arc-20160816; b=deVMmGuVUeUPaMqIKsehX0XUikAZ8T1bc8lP+KsHIz9RrtNtH0hDKcDTqOCOUC9inm 3mgi6mcxYf6Y4jYxrJ5TOpK0g/lD6tIX/3bUrJ8ePslrgP3GZMhJ7in3dq6yViT5fky8 pgFCTfB37LqmppO60tvNwVLQB3dygjNDaDW724u/pheO4e4CLFl5sGbZzvLyC9pKeZKR v1xDUkXbe2cDF7YdGaqD3zQoNzswIr+1hZGm2rKdAyAMwUqbh1zXm2x7N0yVkieSdV9y 4M4IJk20xEOKxU/6mvGBU85La/UhqAZD+VLPncum2HBgRkTr1TLQDqDmU0pVSaBm8n87 1vmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from :dkim-signature:date; bh=MBVj4MB7KuRJHqJ3952d8tcXZq5Yv9h9+S6p/tmd57Q=; b=qgcb4amUXY6XSf008TJVq7ALkClkU7RPxwcndj8qEEKIKc4R0od5795Gt+mqV1R2Nz BNSPy+RDN/j5/Bl/f5NfEfqG+4KTXdP5cwRUFpvR8ia/l/QIms9kfb++VduQBs2OnCRT 3s18AIDmQlbtzOqmUTCyNOHZ54uYeO+Dn7pukm2QN/HKYGXOVmKop+dPdeHd9LgSKuMt 4I5GPrsO4iVOzFyCkFWRDtASmMr9u5iE/QTTdFM3yav38/NxtCOXvsmyfJghFVWINUfa U98Z0kSRq/w02q58gBZfA9hJ78DMhrDWHOcJ0n0dQOtpdapnhpQsroP4hTKwrb8FfLza 0suw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WNmmvYml; 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 c8si11585979edq.432.2020.12.14.10.38.22; Mon, 14 Dec 2020 10:38:46 -0800 (PST) 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=k20201202 header.b=WNmmvYml; 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 S2439698AbgLNRtb (ORCPT + 99 others); Mon, 14 Dec 2020 12:49:31 -0500 Received: from mail.kernel.org ([198.145.29.99]:53970 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2408828AbgLNRtO (ORCPT ); Mon, 14 Dec 2020 12:49:14 -0500 Date: Mon, 14 Dec 2020 17:48:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1607968113; bh=NcqAS0fdk9ddPfR571pdN63Yp0bFOzwqCtafAiwa0Mg=; h=From:To:Cc:Subject:References:In-Reply-To:From; b=WNmmvYml2MNGeb+1OLX1V7rfTCqp5bNGLdXL9oMr05FR+lJujOeYbEmWg9/mppLgl FlojAqt/+wgn8kqstqSP3qkMN2Gh3Vw8s96yfhv318MKroqChPYhbmhDKuyQlGkLn7 5ruqWFfAqbbS2AHYS8vbC05m2iEuWid38KGnX/EvP51Y81RLV46q+xx0hLy+ByNrFd UyhCCLPd9eTn0Pgf/GQmwpq0VpxdIO8Rbubjazqg7CRQQWlmp9prYxLca7YJ4O9t5V DptZ9BBWPHCEQBp7XE+gZiHKnw+URjzsA306qZdttBijySBmrl1KVJY9//X6/3wQLJ Sd/mEfWCXjS1g== From: Mark Brown To: Qing Zhang Cc: Rob Herring , Thomas Bogendoerfer , linux-spi@vger.kernel.org, Huacai Chen , Jiaxun Yang , devicetree@vger.kernel.org, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Juxin Gao Subject: Re: [PATCH v3 1/4] spi: LS7A: Add Loongson LS7A SPI controller driver support Message-ID: <20201214174822.GC4880@sirena.org.uk> References: <1607925534-8312-1-git-send-email-zhangqing@loongson.cn> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="f0KYrhQ4vYSV2aJu" Content-Disposition: inline In-Reply-To: <1607925534-8312-1-git-send-email-zhangqing@loongson.cn> X-Cookie: Everything you know is wrong! User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --f0KYrhQ4vYSV2aJu Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Dec 14, 2020 at 01:58:51PM +0800, Qing Zhang wrote: > +static int ls7a_spi_do_transfer(struct ls7a_spi *ls7a_spi, > + struct spi_device *spi, > + struct spi_transfer *t) This does a lot of configuration, as far as I can see only the clock rate can actually vary per transfer though? The mode configuration looks like it should be moved to prepare instead, the divider settings can be done with a read/modify/write. It's also not clear to me why spcr and sper are being stored in the driver data, we never read the values outside of this function. > +static int ls7a_spi_transfer_one(struct spi_master *master, > + struct spi_device *spi, > + struct spi_transfer *t) > +{ > + struct ls7a_spi *ls7a_spi; > + int status; > + > + ls7a_spi = spi_master_get_devdata(master); > + > + status = ls7a_spi_do_transfer(ls7a_spi, spi, t); > + if (status < 0) > + return status; > + > + ls7a_spi_write_read(spi, t); This is kind of confusing - _do_transfer() doesn't actually do the transfer so far as I can see, write_read() does the transfer? Probably both functions should be renamed, or even just inlined here - it's really configuring the clocks and transferring the data. Otherwise this looks good. --f0KYrhQ4vYSV2aJu Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAl/XpWYACgkQJNaLcl1U h9BzHAf/Rwxgo7t4Z5IvsSKHACOvItQQHanhkcSmK862aYJBHTRvoVpnQQzEtqU6 Wodl6E4dZFq15FhWH12EsOBDv2LPsm4XiaYWbUljPip0ZEfbJNpoOUg43UZZSHri cjThPcPGG2UEQEDjyWivFKyip8ws8PJw9o2+2Wm5KygxoIsXX6sIIKQRpzgxcdqw k8774KI3eR1lKc6lWstuI442xqfUMGbBPfor59NB6iRkXlG1FlOo2grXwWhrwC4+ Yvk45cnZDLQvrK5E72VLMVjK9JeA+K0Tkkkg0UGzR5m8YsgDCrWxW4rjCYEIdxpY tcpeQhGyu80pqDTE8b8y8k/ldAAC8g== =U/sN -----END PGP SIGNATURE----- --f0KYrhQ4vYSV2aJu--