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 08860C678D4 for ; Thu, 2 Mar 2023 16:38:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229620AbjCBQij (ORCPT ); Thu, 2 Mar 2023 11:38:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229537AbjCBQig (ORCPT ); Thu, 2 Mar 2023 11:38:36 -0500 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2063.outbound.protection.outlook.com [40.107.223.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25EA8AD28 for ; Thu, 2 Mar 2023 08:38:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EmA5jBHoNuqcLq9eii3nVe9tgwXGZpXcJ7yfI+oDwVIATn5N+xDSCUWDiYN7I6Ueo83ZhqrnFLKRlMP4ubQLONAE0XTbCfPF94EQPIipposuBN1tzbhhw4FlxU7n7uXH3/TCPPIOSQpFxfbPUcZi2UpJKAualSthYz86uBsTJ3w3HXA5zEz4FeL5T0IDLPY3peTpygBPqFqPWhCqeKOWCSV+J3j7ZQxsZEtg64ajqovfwZI+b9wK1C1xrAdZumK2UEA3GfgAKE9nQ/0njfiT7JXHlRyGQqxAGlQiDvoRQ9pAiM/xhuBAHotV/f1KGJI7Mh9Cd/rjLLfBxjaB5XrXYg== 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=WYqSOg0yXfuFGcbZrIclt6q/IKOnuVwHYkpwsz94jqQ=; b=lsgFupxhrZYNJ6JxjvoP8ssGn0GIDKuaV6t/HjfaL7my+g97q2A9GhiWSSOweBabjHW7e3RXthdmNfwjpKUkLUiydVMmUixj1RsY9a2aHgX2caA6/0eN7UYBxyW6Ri8K59bNKAqoFXLkcBXhXIQhBalWOLKPXz4FFINixeXq6OVUJJSfMZDDTqvXeNAyTLYQz1Oosov8/5W1mlKhc1Fd2h9xHhjTRrPzE1711kiiytOPTddcMaVOir9VkHKSrhLCdBdF2BP0Bjj1QqhKFSfRFu9c1eJHVIv74SYYTBmZ3JmfI3dKF4lVpPJdPH8H1AgMylVrtptzFw6qRoxFy/5k6A== 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=WYqSOg0yXfuFGcbZrIclt6q/IKOnuVwHYkpwsz94jqQ=; b=UP++Yn7GuVsP23LSonzCVKsGjb681zqeuUTTOeQLk1jth5g8fkh2HJSTGPijqwS8Rendj26vVcZeFYf31KwledPAndO7fsy82UvJ80hA9Ysg+70SMzGPFMUGAj7Gu001XqeHK6DudvtBMSu9tv6wOqZeartStAn4i7spCzKlBk4= 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 BL1PR12MB5948.namprd12.prod.outlook.com (2603:10b6:208:39b::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.19; Thu, 2 Mar 2023 16:37:34 +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.019; Thu, 2 Mar 2023 16:37:34 +0000 Message-ID: Date: Thu, 2 Mar 2023 11:37:30 -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 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> Content-Language: en-US From: Harry Wentland In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: YT4P288CA0010.CANP288.PROD.OUTLOOK.COM (2603:10b6:b01:d4::10) To CO6PR12MB5427.namprd12.prod.outlook.com (2603:10b6:5:358::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO6PR12MB5427:EE_|BL1PR12MB5948:EE_ X-MS-Office365-Filtering-Correlation-Id: 6959d28e-9c9a-4c68-e641-08db1b3c6cbf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BCZQ3hFBRb28lLC1nIKbqYxakyNl3irs+t9saG1YMdQzzZSJei57hIVn0nwbdtro3WEjWxS6eSvxqp1+qy55jztjwPWa9fD6dDhgo1GLwlXQ6s8pYbzhgRP2Le3Dws8AxdmzW8qbImoFu4EvRzSJRM+YgclEsGAU2slu+H6onKQ4yll692vZUL9GN2Cucy/S15Kt8r78xwrYPB4O6XOH+AaQyzDM3amcHlAHLJCZv/hNmQDw0ZggAMha+k8HTzrCl4o6bKyXYgdw411WoOhjB4Mhoy1ylPeF+9CsesjuoQJVsd31e03+VLx+unVB7TVqcQP18ArPDM8VxWcOtzHvyxbwISHIya/aYcl/3XJMPnR6aeJGXkwP6mK4VseFAm1LuF4aFEvajtMRWiSbiQmPE/BnJ2TQ4awGk+OXhG8e+vwK0MRwM2Iv4XqpNTEOhRyiZQa6LtJ1NIvPOnaQVCqqkxdGsMxGShPP/Eb5jEsEA9Vq9iJB3VhFsoRqBApy3gqeqQZD7KbnJzk/PxzjUdBAXWzWjdDnCJkPBX+/IStIOgrwkdiXM/SnuD/9t57aMUuDfRB+1vk8J9kCummdYOTh+FSK5pZ3UK0iSOWLhb7zAnFXuAtVuVi3UBtZtnWUzws0wnnXQD1rF3ba/pcyV0bWUjzyJdy25RHkoLpank2u5CpiHxMWLGjbOM2DQSKQm7UluknBzID/AGQVmO4YnAkrQ8Uil1hmZgmNrmJfAY8N+mE= 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)(376002)(39860400002)(396003)(136003)(366004)(346002)(451199018)(86362001)(31696002)(36756003)(2616005)(186003)(4326008)(53546011)(8676002)(66476007)(66946007)(6512007)(8936002)(41300700001)(6636002)(54906003)(66556008)(6486002)(110136005)(478600001)(6506007)(5660300002)(26005)(6666004)(316002)(38100700002)(83380400001)(44832011)(2906002)(31686004)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Zjh5bHBMU1BGSFlXU20yVVQremNrcDVxUmtUQStjai9aNERZQWRmZHdSVlla?= =?utf-8?B?YmxrSzNxVTdkZnc0Nzk1TlB5ZlpEZ3l4RFZyeWFUdFRyc2txUEZhNj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K2k5ZFFqYjgwNExsZTJzaCthUkhOL3kwejlN?= =?utf-8?B?TGxGSDVWeDJkV2RJV2NNcFJ6L2FLdjNwTFdTMDRScGw2VXFnYWJUTytmcUgx?= =?utf-8?B?THVmVGJTTHVyejhETlp1VDNEaGhlS1RKaVFEN3NkUTlrQytCOGNWbXZUSWFE?= =?utf-8?B?UVFjQi8rcmI5ajNzWWRHcVhyK3pPdXU0MDl0bHk1aWkvbTRJano1Q0Q2NDk4?= =?utf-8?Q?JR0zgtQ3w6g+BA4WjvaZudkes?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6959d28e-9c9a-4c68-e641-08db1b3c6cbf X-MS-Exchange-CrossTenant-AuthSource: CO6PR12MB5427.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2023 16:37:34.1592 (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: An7Gglp00PJt+iOslAvBZw95lM+ji012vCIblMEGBrRMOkItEG+KgplZFDqP9l6aFi8waRKndA+8S46aVbdTLQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5948 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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; >>>> } >>>> >>> >> >> > >