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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56B5FC64EC4 for ; Fri, 3 Mar 2023 20:36:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231658AbjCCUgJ (ORCPT ); Fri, 3 Mar 2023 15:36:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230512AbjCCUgH (ORCPT ); Fri, 3 Mar 2023 15:36:07 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2059.outbound.protection.outlook.com [40.107.93.59]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EFFD5D881 for ; Fri, 3 Mar 2023 12:36:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bNxpzm03YXdg19AaczfG9iJ9zDyoOp8upQuIy3eI3W/AlkS75gAuAEQPFNgS0jlWSo4/rebbeafvbMmt2L1cceAHXINdUOi31XiQxGY6XNxCsDm+EU1wLbj8NJLvmwWgUx2p1kL/lsNoG298FVSOStT0hlX8bVAkTzV8FmsESod2N0svWXUmZG3RctF5ZHD/+c7PYkC5kgPMf64eZPixMuBTm+4tUbCyhcReFPZU7SbKf8bpYl86OGJzOQklVVXngiB/4+U9T6ZCL7svWphICGiR7/nERtJGy20l/ARoU3EGZ6MbpO1/8HxGj/lxK3NSNEAqWvtq17k8AK+VREvOFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=hwS9XM+Nm7QydglutoMe0oUAS5rzaMNA2aGdCbLgva0=; b=XYs4Bq8+KgwDYrt+aAcfZJCFfrMEpFo4nGAVhNhbEIGHcV2egILCtsKY0G8xAT7UbjKIjk2dFO0PhGC8YWEj+/foEiHNl/kc5oQXwUwCuEQxVrD3yToj/XYzA7GusQ6iea7ZIQaZKh+YgwUh23cxpRySN7rEdb86IRmNaOphZ6/7cb5a7meLh8CiwydoSrGzp7bIxKzyQlnJq4iEmhysSNzByfKoLI4Lz1EDsFQkZGSn4yG15PO30I51HvpH6YTqZlT4fqn6TWnwZACf6cW96NctWp1VNnJbIYegfCViq9fUiU67ORIpP6kUlpVFIhXnvLzl9oMxmmm55dzr41SNOQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hwS9XM+Nm7QydglutoMe0oUAS5rzaMNA2aGdCbLgva0=; b=ZnV0MVZg/+aNdg94Q8A24GMR+4CkCkmh/lu0RmAEXEWEPW8D10pvC4MYLbButfHjCLTMl9aYf4F5kxUssVclkubw6l6xLJf133CTbzQ9xhy1zjv3uXQ2IL7qdrQvYOZ7rOqkGJwWAZd7ib0EscpFwRv9GseuaQ24SKh105tMsBc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from CO6PR12MB5427.namprd12.prod.outlook.com (2603:10b6:5:358::13) by DM4PR12MB5844.namprd12.prod.outlook.com (2603:10b6:8:67::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.19; Fri, 3 Mar 2023 20:36:02 +0000 Received: from CO6PR12MB5427.namprd12.prod.outlook.com ([fe80::aa28:9378:593:868a]) by CO6PR12MB5427.namprd12.prod.outlook.com ([fe80::aa28:9378:593:868a%9]) with mapi id 15.20.6156.022; Fri, 3 Mar 2023 20:36:02 +0000 Message-ID: <4d670a5c-b680-ba76-a640-88b3d945c0b0@amd.com> Date: Fri, 3 Mar 2023 15:35:58 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH] drm/amd/display: Simplify same effect if/else blocks Content-Language: en-US From: Harry Wentland To: Deepak R Varma , Joe Perches , Rodrigo Siqueira , Alex Deucher , Aurabindo Pillai Cc: Leo Li , =?UTF-8?Q?Christian_K=c3=b6nig?= , "Pan, Xinhui" , David Airlie , Daniel Vetter , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Saurabh Singh Sengar , Praveen Kumar References: <33ecbe8971bb9c90d72c67d43ca740abac160908.camel@perches.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: YT4PR01CA0108.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:d7::7) To CO6PR12MB5427.namprd12.prod.outlook.com (2603:10b6:5:358::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO6PR12MB5427:EE_|DM4PR12MB5844:EE_ X-MS-Office365-Filtering-Correlation-Id: 796a42f5-67e9-4553-8686-08db1c26e74a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: U9RwHoZ39k/SD+8lLX5alQvg9lvNz2n/k2pWRqpZJe+ytSsGl6BBFEsiTdRh/2S1UpIAHQRkJKCDoLG4zTXWTCFgk/zNVbMLrWt4hpWg3elSm7BsL6zlc7y5xfVq7wlhnLwV/ri92nEAh/n0hVIliA57dDBzlAqMii6GmCEHZMaAFwsxvowvWfTdmWsZ+Ww0iq7kKQ68KssmqvKUEYxEKVO3CcxW1nx0HlDMTVpkpKhrLxcCtG+afIEd539nojKs7InoNG/B5CwakRW7SqGayRoDiwHKvQK/Oi7J/c3qjFGAE2ax+le8RdWkXyWbpElOLy90ez6To0eVXFN066GdPEpX4CBfhjRzJQsEsnHk4msMwoqpU/M6cCY7Rf6Nbi2dyNvKVtVFlRRFHvEpp957LNIwYRNscYz8UIvNSaDEjzSxe4KqJ0OuBOr0KA1x8TO9ISL/n2tBVd+R39XoEC2V1XQtK8/zYKvjXPnvnMw3Ze0uQTdAPd8hPlD5YnGVmoxv71Uelwr6TywWjLfZlH65xMJdtmyU2P/+EeUxGbC/HdACYubZVLS/QAsyBCh2jG/YOHLwFsLZ4FNIBY8DPGSjcS1wY/wlZjCpR/3XgUoq+G96H93yALHURRAgfnyq31iOMh2nTX2afHuZ0nc1/MvyNfWpM6U0YyVbWGKqv5mwGa0f2Eq+KAYTNg4oTHrWIvaw3GNeh9CEYAZSKeI55sF6Jr2ySraM6q5aDzAQUGnbpFo= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CO6PR12MB5427.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(39860400002)(346002)(396003)(136003)(376002)(366004)(451199018)(31696002)(86362001)(6512007)(36756003)(66556008)(8676002)(41300700001)(186003)(53546011)(66946007)(4326008)(8936002)(2616005)(6636002)(54906003)(110136005)(316002)(478600001)(66476007)(6666004)(6506007)(5660300002)(26005)(38100700002)(83380400001)(6486002)(2906002)(44832011)(31686004)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?QU5OMldnMm0rSWNLM3JVbGx6cDArVW9wYkxsUTRlcnVySnQ3VkxmcEg1RWdW?= =?utf-8?B?cXpRZERQcFQ2Z1gvekZoSV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B?TVRVVHd1WlVTSDY0K2gyS1IyejFSUjRZdHpJNzJEUEpyQ01kQ2JmckJEUmtx?= =?utf-8?B?bDJzbmp4WlQ4TWNTamdaNVF0dmxTY1BvNGx6bW96Uk1VZVRmMEpXbjlCQWVO?= =?utf-8?B?aFF1SVFqWk9lRmVwTWlaWkdJcDRRUmluZXc4ZitZeW94WCtTMXAzeGRJT2xx?= =?utf-8?B?OXJLM1NFbWdKUEluYjQ0RWtMcnBaNDFJZDd2R3prbCtUbmRpajArYkVRWHJ5?= =?utf-8?Q?FHLg+JPVSa4A0V4qbLnenBqsl?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 796a42f5-67e9-4553-8686-08db1c26e74a X-MS-Exchange-CrossTenant-AuthSource: CO6PR12MB5427.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Mar 2023 20:36:02.0133 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Q7EMzeqk/IL5JG40NY6G0WJnuMWMbu4c5Sp/MxXSBAACAoALG/YTs05KSLF231G1iTeUYEkWgEprFYq+dPZ08Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5844 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/2/23 11:37, Harry Wentland wrote: > > > On 3/1/23 15:21, Deepak R Varma wrote: >> On Mon, Jan 23, 2023 at 12:23:19AM +0530, Deepak R Varma wrote: >>> On Sun, Jan 15, 2023 at 12:52:10PM -0800, Joe Perches wrote: >>>> On Sun, 2023-01-15 at 15:30 +0530, Deepak R Varma wrote: >>>>> The if / else block code has same effect irrespective of the logical >>>>> evaluation. Hence, simply the implementation by removing the unnecessary >>>>> conditional evaluation. While at it, also fix the long line checkpatch >>>>> complaint. Issue identified using cond_no_effect.cocci Coccinelle >>>>> semantic patch script. >>>>> >>>>> Signed-off-by: Deepak R Varma >>>>> --- >>>>> Please note: The proposed change is compile tested only. If there are any >>>>> inbuilt test cases that I should run for further verification, I will appreciate >>>>> guidance about it. Thank you. >>>> >>>> Preface: I do not know the code. >>>> >>>> Perhaps Rodrigo Siqueira made a copy/paste error submitting the code for >>>> commit 9114b55fabae ("drm/amd/display: Fix SubVP control flow in the MPO context") >>>> as the code prior to this change is identical. >>>> >>>> Perhaps one of the false uses should be true or dependent on the >>>> interdependent_update_lock state. >>> >>> Thank you Joe for the recommendation. >>> >>> Hi Rodrigo, >>> Can you review and comment on if and what is wrong with your commit? >> >> Hello Rodrigo, Alex, >> Could you please suggest what would be the necessary fix for this typo error? >> > > It's not quite a "typo" error. When I look at this code in our internal repo I see > a couple missing lock calls here that differ between the two cases. I don't know why > this was never ported over and am surprised it doesn't lead to issues. > > I would prefer we keep the code as-is for now until this gets sorted. > Actually I was wrong. Too many similar-looking snippets in this function made me look at the wrong thing. This change is fine and Reviewed-by: Harry Wentland Harry > >> Thank you, >> Deepak. >> >>> >>> Thank you, >>> ./drv >>> >>>> >>>>> diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c >>>> [] >>>>> @@ -3470,14 +3470,9 @@ static void commit_planes_for_stream(struct dc *dc, >>>>> /* Since phantom pipe programming is moved to post_unlock_program_front_end, >>>>> * move the SubVP lock to after the phantom pipes have been setup >>>>> */ >>>>> - if (should_lock_all_pipes && dc->hwss.interdependent_update_lock) { >>>>> - if (dc->hwss.subvp_pipe_control_lock) >>>>> - dc->hwss.subvp_pipe_control_lock(dc, context, false, should_lock_all_pipes, NULL, subvp_prev_use); >>>>> - } else { >>>>> - if (dc->hwss.subvp_pipe_control_lock) >>>>> - dc->hwss.subvp_pipe_control_lock(dc, context, false, should_lock_all_pipes, NULL, subvp_prev_use); >>>>> - } >>>>> - >>>> >>>> Perhaps something like: >>>> >>>> if (dc->hwss.subvp_pipe_control_lock) >>>> dc->hwss.subvp_pipe_control_lock(dc, context, >>>> should_lock_all_pipes && >>>> dc->hwss.interdependent_update_lock, >>>> should_lock_all_pipes, NULL, subvp_prev_use); >>>> >>>>> + if (dc->hwss.subvp_pipe_control_lock) >>>>> + dc->hwss.subvp_pipe_control_lock(dc, context, false, should_lock_all_pipes, >>>>> + NULL, subvp_prev_use); >>>>> return; >>>>> } >>>>> >>>> >>> >>> >> >> >