From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C6D7EEB64D9 for ; Mon, 10 Jul 2023 17:09:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=aaen+ZYP22qHYaoGDGHsb264GTk0ChIo9v2DM/93Pqw=; b=dOakKuE+9R7oE7BjNRc6SkoKDh OjyJtbY8TTPWrw/dCYQWHg1zOGMsL5FGDTye+d1CRXwjpnNoh6KrBzXfjIcy5Opbt08+Q9RJjT370 Csdzee88mpt877ygxIv96z1m+TFU8oiLHZIBJnv06gBKFoue9oQba6OH1MjeKtG/o5NavDteYKtyT MEdlvQkZDM4nmTzwyYHpB/Jz5bfuCWsJYDB7Oh3ZjIOccg0aMSVz0D7p3NoazeiTJyLVrpa177o1P SiAjU3OfxzsVnfyK6DBk7Btt3bT/LYs11RbeFnSyeEm13l8G7vZ3cVbjs73TohBhRmafCPzrFYD46 s9A+cDtQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qIuNz-00CIX1-36; Mon, 10 Jul 2023 17:09:19 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qIuNx-00CIWG-0w; Mon, 10 Jul 2023 17:09:18 +0000 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 BC4FC61133; Mon, 10 Jul 2023 17:09:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 822D8C433C9; Mon, 10 Jul 2023 17:09:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689008956; bh=nKZycr1bbDIhX+7r/umilV/wuLHcsLLg8WWLjNqfVGw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Ks7RL3h40J9Gsg6+T5tGMhXUPebOkMtv2HYbINZYkE0HBcDFe3InO0uHvSLO6Ywfd z9dbScYbXDyBfN0KKzvhwsevIOZI2Wa4nTPSPcqSdIk9dVy3t4CwrMIhESNVB8EcTq DHcqHiLwexT4fjkOSD7WRFfWxwr4oLox+CN38zoYAqwcwq7DLt0YYhvaSCGjOeZdC6 /OMp7mPT/0W9iS9bRuPwjhjEgn3ZN4a3GPUVex+MO83a5hpzqpvTmLwha1tCaAJG7B IOQDzu3lMvKgzC08AKXIF8wSz30WvJ3WDseHtgBrUd0ZFYjZe2rdpVVbiRnkMjF1jV sbYhTW/HyF8mg== Date: Mon, 10 Jul 2023 18:09:00 +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 02/15] spi: Drop duplicate IDR allocation code in spi_register_controller() Message-ID: <97f3436a-78ca-4a94-a409-ef04bd3b593f@sirena.org.uk> References: <20230710154932.68377-1-andriy.shevchenko@linux.intel.com> <20230710154932.68377-3-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 In-Reply-To: <20230710154932.68377-3-andriy.shevchenko@linux.intel.com> X-Cookie: Do you have lysdexia? X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230710_100917_411680_23807A92 X-CRM114-Status: GOOD ( 15.65 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============5075195137266138106==" Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org --===============5075195137266138106== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="ugTz/0iIbXaMesMQ" Content-Disposition: inline --ugTz/0iIbXaMesMQ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Jul 10, 2023 at 06:49:19PM +0300, Andy Shevchenko wrote: > Refactor spi_register_controller() to drop duplicate IDR allocation. > Instead of if-else-if branching use two sequential if:s, which allows > to re-use the logic of IDR allocation in all cases. For legibility this should have been split into a separate factoring out of the shared code and rewriting of the logic, that'd make it trivial to review. > - mutex_lock(&board_lock); > - id = idr_alloc(&spi_master_idr, ctlr, first_dynamic, > - 0, GFP_KERNEL); > - mutex_unlock(&board_lock); > - if (WARN(id < 0, "couldn't get idr")) > - return id; > - ctlr->bus_num = id; > + status = spi_controller_id_alloc(ctlr, first_dynamic, 0); > + if (status) > + return status; The original does not do the remapping of return codes that the previous two copies do... --ugTz/0iIbXaMesMQ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmSsOysACgkQJNaLcl1U h9Bj2wf/eujSGQes7B4PBTQ3n1oBhkcL7Y24XQnkT5q6FXhb+PNy2gOUL7X4u8/s jewRdgc+ViUGaokkDON2TN26dLdi/+KEGq7rPGhgLMeyGSqKJx5uRaCQSSdKa2Y2 w1zSdEXhWd9SZsgsLa18k9bVMBbmyuylLjQYrLlHktiuD4/baW1HQ5SqKICkb1Bg /ZdcRGqcKDfgJWnVfK4loF7rFNMRBY0rXsSdOVE3yOKeZE2uS46s2BPPN+xc7UaA KTSUu8JjCacwP+V70yrm4VGRb5/c0NJ++iO44yiykKNRvcJWCDemwAYhj9zV1ja/ 5l/fUqxd3+5Kv3hbc1rSnyAywM7/4g== =1GBL -----END PGP SIGNATURE----- --ugTz/0iIbXaMesMQ-- --===============5075195137266138106== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic --===============5075195137266138106==--