Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp6011502pxb; Mon, 14 Feb 2022 13:05:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJzVLljpSgpveSqkpjOCGqauDhNYKiF1xu/nzmOVqlSPI5amOUnagtQWI+FGLr5HvSNXmVn9 X-Received: by 2002:a65:47c5:: with SMTP id f5mr785482pgs.112.1644872747190; Mon, 14 Feb 2022 13:05:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644872747; cv=none; d=google.com; s=arc-20160816; b=QEMHGFLCeXmBYRZGGWU6rYD1/wyslft7qCNMjINhTc80REoBxeTpezoXI9JqOyG7Z4 uLbLr/4WPGUOrsvMZdtvvCIcDBVnfVHC1anZZ3ov5jqqfeQd+jvYOYvHgE50RtX0818m v0XbHTl0crWNyD4jnGWmHSAnZoPkbyj3htfGTaGpR4lEuiE2a9kQleuE5w1KcQC8BwBc vmTpiIqmR4BEG0ot+/fb1C+/yMFS69SvoOYu2mubhBTLci5vI59hghYsKQEJbC9LkTT9 wTO0Hrv3SJCkpGRwnWaC6yVndX4fJNEwEaHXFyuSvxT64u+/E0hd4xDs/252BExEzlw6 eaBg== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=FelffNcLJN503vx3ynp0KJSW+/OHC6EeqYX0rFBQ2/c=; b=DfPLIAd341Ugxou3f0kpwD6HMcWmB1eFitrv2AomzUUHxMF5lOOSQB1LwADnVKhyjn 5MPO32SRcffZ9nMILF1sb9nuiAd7l8sG5/Xl4/67c3ZPJDBL89X7p4xFWUP11iPVetag gfpG9ctYTVDqJl3R6sGgFvnOO9oKsDfsG5LbruAReErskIfK32IlgiN5eEiq41HxRPvm WdFec3VnsYjS3fRtU594d1g3inzpUREqraE9JF0krJ3zMbmibdIe+7vzQs2vIgxsfViS c0k6Y5bbiN+TbKk4HOWNG9bkru8o9HqVAvq7qIx/EOBHOztFHNIPDm57Bdotm0SPZ5sQ taSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fwnRiMLd; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id m12si32112164pfh.279.2022.02.14.13.05.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Feb 2022 13:05:47 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fwnRiMLd; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B77361897D1; Mon, 14 Feb 2022 12:26:54 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353907AbiBNNHX (ORCPT + 99 others); Mon, 14 Feb 2022 08:07:23 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:54428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233705AbiBNNHW (ORCPT ); Mon, 14 Feb 2022 08:07:22 -0500 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 463AE4BFDF; Mon, 14 Feb 2022 05:07:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1644844029; x=1676380029; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=cmRpyW5YxpRg0c6HVe02t3+JA7Epz3P6WvJ1r9gZPiM=; b=fwnRiMLdnK/rmaMb7i6Y8iHrmqfh05bm8jOVB+xUxzKzpjVXqo6YXCAM tP2aebyqD3f2Kov0sU36MQ6VugzMbpZiEMB24R4mQW5D4p6Q4bxn3GfDp nscKJRZ23130KaUivYRP5tWZ5Ya3gjKJbO06iV02TBtuUkfd73tGMQ+m3 UE1S1Asn0wFByk6osL1SwBfOOsjt/0GE9JsNRzY7vQipL6fH+9+VsVxm5 zaQ1QiDvgw5UHTQDJPk2ni2hKttiGdMi4A4mojvmuPoZ54Qx2pL93pLm0 25Ax/qAYIcc37W5kR3/VqctpXpcsJcOJhHnVVQCFRhrwMbITXA7s6Qf3q A==; X-IronPort-AV: E=McAfee;i="6200,9189,10257"; a="230721425" X-IronPort-AV: E=Sophos;i="5.88,367,1635231600"; d="scan'208";a="230721425" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Feb 2022 05:07:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,367,1635231600"; d="scan'208";a="543555384" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.151]) by orsmga008.jf.intel.com with SMTP; 14 Feb 2022 05:07:04 -0800 Received: by stinkbox (sSMTP sendmail emulation); Mon, 14 Feb 2022 15:07:03 +0200 Date: Mon, 14 Feb 2022 15:07:03 +0200 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= To: Thomas Zimmermann Cc: linux-fbdev@vger.kernel.org, David Airlie , Daniel Vetter , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Noralf =?iso-8859-1?Q?Tr=F8nnes?= , Geert Uytterhoeven , Maxime Ripard , Andy Shevchenko , Sam Ravnborg Subject: Re: [PATCH v4 1/6] drm/format-helper: Add drm_fb_xrgb8888_to_gray8_line() Message-ID: References: <4fa465d9-4fac-4199-9a04-d8e09d164308@redhat.com> <7560cd10-0a7c-3fda-da83-9008833e3901@suse.de> <87pmnt7gm3.fsf@intel.com> <5ee24960-7843-827a-2c47-b93a4b4798e3@suse.de> <65010c63-ef8a-4fff-00e4-73a9b6fd05b8@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <65010c63-ef8a-4fff-00e4-73a9b6fd05b8@suse.de> X-Patchwork-Hint: comment X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 On Mon, Feb 14, 2022 at 01:54:59PM +0100, Thomas Zimmermann wrote: > Hi > > Am 14.02.22 um 13:47 schrieb Ville Syrj?l?: > > On Mon, Feb 14, 2022 at 01:12:48PM +0100, Thomas Zimmermann wrote: > >> Hi > >> > >> Am 14.02.22 um 11:38 schrieb Andy Shevchenko: > >>> On Mon, Feb 14, 2022 at 10:03:53AM +0100, Thomas Zimmermann wrote: > >>>> Am 11.02.22 um 16:41 schrieb Andy Shevchenko: > >>> > >>> ... > >>> > >>>>>> IMO *always* prefer a for loop over while or do-while. > >>>>>> > >>>>>> The for (i = 0; i < N; i++) is such a strong paradigm in C. You > >>>>>> instantly know how many times you're going to loop, at a glance. Not so > >>>>>> with with the alternatives, which should be used sparingly. > >>>>> > >>>>> while () {} _is_ a paradigm, for-loop is syntax sugar on top of it. > >>>> > >>>> Naw, that's not true. > >>> > >>> In the section 3.5 "Loops - While and For" in "The C Programming > >>> Language" 2nd by K&R, the authors said: > >> > >> Year of publication: 1988 . It's not the most up-to-date reference for C > >> programming. > >> > >>> > >>> The for statement ... is equivalent to ... while..." > >>> > >>> They said that for is equivalent to while, and not otherwise. > >> > >> Even leaving readability aside, it's not equivalent. You can declare > >> variables as part of the for statement. (I know it's not the kernel's > >> style.) Also, 'continue' statements are not well-suited in for loops, > >> because it's non-obvious if the loop's update statement is being > >> executed. (It isn't.) > > > > It is. > > > > 'continue' is just shorthand for 'goto end_of_loop_body'. > > Well, indeed. lol > > Fun fact: I actually had to look this up and still got it wrong. Let me > just count it under proving-my-point: continue in a for statement is a > bad idea and for isn't equivalent to while. Nah. We use 'continue' a *lot* in for loops in kms/atomic code. I'd be surprised if you can find many loops without a 'continue'. Looking at the loc stats I was a bit surprised to see more 'break' but then I realized switch() is bloating up those numbers quite a bit. -- Ville Syrj?l? Intel