[Intel-gfx] [PATCH 5/9] drm/i915: SHUTDOWN & Turn ON packets to be sent for both MIPI Ports in case of dual link Configuration

Jani Nikula jani.nikula at linux.intel.com
Thu Sep 25 15:39:02 CEST 2014


On Thu, 25 Sep 2014, Shobhit Kumar <shobhit.kumar at linux.intel.com> wrote:
> On Wednesday 24 September 2014 03:02 PM, Jani Nikula wrote:
>> On Wed, 24 Sep 2014, Gaurav K Singh <gaurav.k.singh at intel.com> 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



More information about the Intel-gfx mailing list