From patchwork Fri Dec 4 15:11:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 338494 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA930C4361A for ; Fri, 4 Dec 2020 15:12:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 963CF22B42 for ; Fri, 4 Dec 2020 15:12:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727075AbgLDPMw (ORCPT ); Fri, 4 Dec 2020 10:12:52 -0500 Received: from new4-smtp.messagingengine.com ([66.111.4.230]:49173 "EHLO new4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728048AbgLDPMv (ORCPT ); Fri, 4 Dec 2020 10:12:51 -0500 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id B90F5580155; Fri, 4 Dec 2020 10:11:45 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Fri, 04 Dec 2020 10:11:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=loawgpLmPbgA3 nCb+XpvKFd/3RaTfAsWsg5X+JboVzE=; b=dZWM+so3GBnxjy0vtjNG8gvn/X/GJ xREok1DL8mwEBn/sj42TQlzbBgj8q7Ykx5GXzqrywfcZy62tUZR3iEouEfcpZUG8 G/kOgX+tWPktpQvKalqTdaermI/xdsJjWNyVV6APvGZxjydT46YezMEOO5FPYfNg yyZNbONzj3hrELLXSM+iHjJKSjEWqp1mVBl4e48WvFipRrvs5c0QQFFlzK7mseca XKZFSNDjbzvhdciI8M5/sVC0fuaqHHBCF/kH688qiXAfU9SraDmSkpbYtLCoc6G1 F4eQ8f/lXilPTVpCiPd+aJtCExv9oeJev0OFQaENHbkODpJu6iDhZGCzw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=loawgpLmPbgA3nCb+XpvKFd/3RaTfAsWsg5X+JboVzE=; b=j3vZmqVC 1JwRWdIA1PDPRWiCjo4Ffq9W+ssAn8dbBxGUsCoO152/UsZvRBGoFpP7+c4VeAF5 uyUTIaG5qxf+SwubUNHvTo5R4D3GnMxh4XuGqsp2Op+jlIjPGMpD6I2GYmoVwjsw Vb25NB8CaH3Qgl0YIpInR7MZBH6AyYTBAz627k3F9DtBUHuEQzmpE7urcl4fl2X7 HCJ3UVGh55FIj0v0Q2iBtCahV75LuGC65I0SSOEWdl9Elxo7rJYHd5y8VZBqGyMg HNvxE/qhRZt/vultrDVDFYh5eGk4DG9y4vle0JRHuUNFhZBHkGOIIF9LzTQ+rbjD iUGYwiDEYLN2Jg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrudeikedgjeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeforgigihhm vgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrfgrth htvghrnhepvdekleevfeffkeejhfffueelteelfeduieefheduudfggffhhfffheevveeh hedvnecukfhppeeltddrkeelrdeikedrjeeinecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomhepmhgrgihimhgvsegtvghrnhhordhtvggthh X-ME-Proxy: Received: from localhost (lfbn-tou-1-1502-76.w90-89.abo.wanadoo.fr [90.89.68.76]) by mail.messagingengine.com (Postfix) with ESMTPA id 6579424005A; Fri, 4 Dec 2020 10:11:45 -0500 (EST) From: Maxime Ripard To: Daniel Vetter , David Airlie , Maarten Lankhorst , Thomas Zimmermann , Maxime Ripard , Mark Rutland , Rob Herring , Frank Rowand , Eric Anholt Cc: devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, bcm-kernel-feedback-list@broadcom.com, Tim Gover , Dave Stevenson , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, Phil Elwell Subject: [PATCH v2 3/7] drm/vc4: Simplify a bit the global atomic_check Date: Fri, 4 Dec 2020 16:11:34 +0100 Message-Id: <20201204151138.1739736-4-maxime@cerno.tech> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201204151138.1739736-1-maxime@cerno.tech> References: <20201204151138.1739736-1-maxime@cerno.tech> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org When we can't allocate a new channel, we can simply return instead of having to handle both cases, and that simplifies a bit the code. Reviewed-by: Thomas Zimmermann Signed-off-by: Maxime Ripard --- drivers/gpu/drm/vc4/vc4_kms.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c index ba310c0ab5f6..8937eb0b751d 100644 --- a/drivers/gpu/drm/vc4/vc4_kms.c +++ b/drivers/gpu/drm/vc4/vc4_kms.c @@ -794,6 +794,7 @@ static int vc4_pv_muxing_atomic_check(struct drm_device *dev, to_vc4_crtc_state(new_crtc_state); struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc); unsigned int matching_channels; + unsigned int channel; /* Nothing to do here, let's skip it */ if (old_crtc_state->enable == new_crtc_state->enable) @@ -834,14 +835,12 @@ static int vc4_pv_muxing_atomic_check(struct drm_device *dev, * but it works so far. */ matching_channels = hvs_new_state->unassigned_channels & vc4_crtc->data->hvs_available_channels; - if (matching_channels) { - unsigned int channel = ffs(matching_channels) - 1; - - new_vc4_crtc_state->assigned_channel = channel; - hvs_new_state->unassigned_channels &= ~BIT(channel); - } else { + if (!matching_channels) return -EINVAL; - } + + channel = ffs(matching_channels) - 1; + new_vc4_crtc_state->assigned_channel = channel; + hvs_new_state->unassigned_channels &= ~BIT(channel); } return 0;