From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jani Nikula Subject: Re: [PATCH 5/9] drm/i915: SHUTDOWN & Turn ON packets to be sent for both MIPI Ports in case of dual link Configuration Date: Thu, 25 Sep 2014 16:39:02 +0300 Message-ID: <87tx3vvmyx.fsf@intel.com> References: <1411548418-26525-1-git-send-email-gaurav.k.singh@intel.com> <1411548418-26525-6-git-send-email-gaurav.k.singh@intel.com> <87a95pmkif.fsf@intel.com> <54241078.6040508@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id 56DE36E2F1 for ; Thu, 25 Sep 2014 06:39:10 -0700 (PDT) In-Reply-To: <54241078.6040508@linux.intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Shobhit Kumar , Gaurav K Singh , intel-gfx Cc: Shobhit Kumar List-Id: intel-gfx@lists.freedesktop.org On Thu, 25 Sep 2014, Shobhit Kumar wrote: > On Wednesday 24 September 2014 03:02 PM, Jani Nikula wrote: >> On Wed, 24 Sep 2014, Gaurav K Singh wrote: >>> + do { >> >> Please never use a do-while when a regular for loop will do. > > Hmm, ok but reasoning ? Point here is that anyway we have to do once for > first port and do..while helps maintain that simple flow Okay, this is subjective. It's my opinion that for doing things N times in C, the basic for (i = 0; i < N; i++) *is* the paradigm to use. A sub-second glance at that, and you know what it does. Not so with do { ... } while (--count > 0), particularly when the block has lots of stuff. So I'd go with something like: for (i = 0; i < intel_dsi->dual_link ? 2 : 1; i++) where it's immediately obvious that this stuff is done twice for dual link. Makes sense, right? BR, Jani. -- Jani Nikula, Intel Open Source Technology Center