Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp36924955rwd; Tue, 11 Jul 2023 07:22:34 -0700 (PDT) X-Google-Smtp-Source: APBJJlF4KyTbLo94vto7T0kweielH5lgBvL+8EyjCWuhAQVAoCsev1U5OW3sq1L+bMyn2HYw8p8P X-Received: by 2002:a17:906:297:b0:982:c8d0:683f with SMTP id 23-20020a170906029700b00982c8d0683fmr15419949ejf.18.1689085353391; Tue, 11 Jul 2023 07:22:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689085353; cv=none; d=google.com; s=arc-20160816; b=ywmtyZX/qxMdFCnOIrcDJl4vzQV+nwmFCVGYQ/YoRdjVf4ymAFupVsSwidWj4kbovi ha2grBk0n1bO2GTlEWpVfM78pBB2e/J54KuqknZWHp3D4EA5tgVBVjzccKZrqrs93y91 urlRA+hMZwuTyzD0GTuR+dJ/Vv2ulKYTfTf654gbN3yTGYvG2TYxxAHAFkuOtHN8AWXw 83xQfDFJzSoPbKAUIjHWjWO4VCB5bR9+NErniClSQwzesbv7xmRk+u8n2UkUnTFpb90o jWRjI66xedG90USZEYeAj94lsuFgkNB5XfEl0EZuDACvdBs6NSH30e+Yb+P8LFjjqmyS uinw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=oh7rBgcmwD5i2+sHz/C8x/B6Q/NH9QR35BxmMwAAMa4=; fh=FR1TuMeeSkO8NrfcwD6Pn+GCDkn3IwyNRlohVX/xlRU=; b=Lq4iO/f/Vd9h2lS+S9OfaPkbuI4pUXE5bNDESCocUqT6aoyBXz1TOPJg0TFzYpZO+j lrgWDriqUeduN4ra+RbzJDoD6KZhxhonl06fRKv9yQc1FyNaoMhT293rlT/SaUsRA7hx 2OV5eFauF0ea2iGVjrjGTUbIB6KeaxBl673X+RwnLn0EBs2+sLxdl9QkkiG0dcSimZTk ibqdU1VCVgqAMxlLeaKC1m8P9J0fsHfaqPJFg/Qxv24IFF+WFMqLZ5mjJV97X41uUQDE C6n/rgvnxRn0Y04Yx01KnnPV9WgirC77NRr9WaKU+Ucinj7/COWnAA7rtRbrC1uxW6Rw 5buw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KwXQpO0J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id zo13-20020a170906ff4d00b0099318060d40si2053744ejb.459.2023.07.11.07.22.08; Tue, 11 Jul 2023 07:22:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KwXQpO0J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233434AbjGKOPQ (ORCPT + 99 others); Tue, 11 Jul 2023 10:15:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232422AbjGKOPO (ORCPT ); Tue, 11 Jul 2023 10:15:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7B31E69; Tue, 11 Jul 2023 07:15:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7D3066150D; Tue, 11 Jul 2023 14:15:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 209CBC433C9; Tue, 11 Jul 2023 14:14:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689084907; bh=A+lgFSqWg8vRgir1XqFzY9nIE1Cw0dwqFBu8P2BdZBc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=KwXQpO0JwJwS2tync5AfGpO9HXb9u4mgZfpWRxyxjmWV7o23oHa66oSgLBUqWen2D ZlOHsSEyXpzrsEeWWEmLhLLitAzI15911I18ub63ARZldiwGDK6EeLi3B34Qy+IEG4 waxyA6VmnpE80hBohYtayTpWfyRhiz5yBCu2xfPCie7wDB1OJGO5pfFeIe7TmhLaf6 2F7TtEpspxDmIAOKWfQt4n5/QaTo60Dymh5zBKNq1hnkXPOMFNsHXFu721qfrAekf9 KAql0ORVXuf2YxOmwhPq6tE1iNaCTZM61qgKsPoZvWs0hppRNFtMcBrTT4RcCr66z6 VpMXSzxRgleHw== Date: Tue, 11 Jul 2023 15:14:54 +0100 From: Mark Brown To: Andy Shevchenko Cc: Cristian Ciocaltea , Yang Yingliang , Amit Kumar Mahapatra via Alsa-devel , Neil Armstrong , Tharun Kumar P , Vijaya Krishna Nivarthi , Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-riscv@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-trace-kernel@vger.kernel.org, netdev@vger.kernel.org, Sanjay R Mehta , Radu Pirea , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Tudor Ambarus , Serge Semin , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Matthias Brugger , AngeloGioacchino Del Regno , Andy Gross , Bjorn Andersson , Konrad Dybcio , Heiko Stuebner , Palmer Dabbelt , Paul Walmsley , Orson Zhai , Baolin Wang , Chunyan Zhang , Alain Volmat , Maxime Coquelin , Alexandre Torgue , Max Filippov , Steven Rostedt , Masami Hiramatsu , Richard Cochran Subject: Re: [PATCH v2 04/15] spi: Replace open coded spi_controller_xfer_timeout() Message-ID: <5959b123-09e3-474b-9ab0-68d71cfdd9a2@sirena.org.uk> References: <20230710154932.68377-1-andriy.shevchenko@linux.intel.com> <20230710154932.68377-5-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="MZrPSMfLUzZVYlnE" Content-Disposition: inline In-Reply-To: X-Cookie: marriage, n.: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --MZrPSMfLUzZVYlnE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Jul 11, 2023 at 02:01:13PM +0300, Andy Shevchenko wrote: > On Mon, Jul 10, 2023 at 06:30:32PM +0100, Mark Brown wrote: > > On Mon, Jul 10, 2023 at 06:49:21PM +0300, Andy Shevchenko wrote: > > > + * Assume speed to be 100 kHz if it's not defined at the time of invocation. > > You didn't mention this bit in the changelog, and I'm not 100% convinced > > it was the best idea in the first place. It's going to result in some > > very big timeouts if it goes off, and we really should be doing > > validation much earlier in the process. > Okay, let's drop this change. Like I say we *should* be fine with the refactoring without this, or at least if it's an issue we should improve the validation. > > > + u32 speed_hz = xfer->speed_hz ?: 100000; > > Not only the ternery operator, but the version without the second > > argument for extra clarity! > Elvis can be interpreted as "A _or_ B (if A is false/0)". > Some pieces related to SPI use Elvis already IIRC. I understand what it means, I just don't find it's adding clarity most of the times it's used (there's a few places where it is useful like pasting in strings in formats). There are some examples that I'd complain about in the code, most of them predating me working on SPI too much, but I'm not a fan. --MZrPSMfLUzZVYlnE Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmStY90ACgkQJNaLcl1U h9DeQQf+MxpgOv6egcsQtreuAtaq7Ev7HPCaH6MbusHDNH2hElvH+GmEYjovkV6m h3LadU5OvktJBaXfjDQRjU71Cbf70/Nlo8I3WN5V4iRKzqWtfMV16ZStvy2+1Rx/ jHek+Aib8L8SiwlzvD6WB163yHCsSn5KBv2Pqp95DjGWamTl918onxXzSS6g2j5A ib1Mz8aOXWBsiIdaFTQ3NoK7Uvnykzp1X2uGcfrRZuPWQNVvpJs/wt5iOuTpuEws 6O2PEgJext+6CeKBCv8pCvpex2QsVtDKLnDVvmDX4Oa2impxsxSIjLyVbZfbJ480 4XviYIQ2LNlTFidlbAAqqEafOQrvRg== =WM20 -----END PGP SIGNATURE----- --MZrPSMfLUzZVYlnE--