Received: by 10.223.185.116 with SMTP id b49csp563656wrg; Wed, 14 Feb 2018 03:33:50 -0800 (PST) X-Google-Smtp-Source: AH8x224SDOSfDhZ6puBbha4SiIecsyGsu06RbZe3+VdDOpQK0J1uReZVFBVl36GdqrDFEl5A3qOg X-Received: by 10.101.80.130 with SMTP id r2mr3613124pgp.107.1518608030258; Wed, 14 Feb 2018 03:33:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518608030; cv=none; d=google.com; s=arc-20160816; b=YGLpVCQspIJn/n9cfh3Bgy2tB1k8kBLR1kZ7+t8EoNV0fAwVgljwHztll8F1st5Yt4 i5Ip97ujNtdMG7duuS6br4ivQS0Zd6zNFJf1mDV961T6UG/Ft3MwePPOZdraXw91Ri6S aqrKEG+chOMDs6GqrZl5hyf+BbJluya3DSTzfZFTe+j7DLwwFILZnlJkSkgLclGwVqDZ I05uPjbDSoOgl4mf/49VWK2aDLYcfL5Gx4hq5HwqLSvfriqXUAZgZ6yx8/2Cp2dySLzM h3F920tdRTAEVLqU76oIFbCA6c1p2oLuPgNEW2bCeTAdoP5J6gxVzEM9zMIS5JxJSJ6x LlqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=fmU1cak/Xj98XC1m2uq8BzBNva6X5MH2ot97Fn4d79Q=; b=XEnjZOwudfeyOvtgY//VPz2uqDAh2CiItfj5mai1aKiPBNzg8UY3F2srwe1NgX6ucP evebbrAbMch9yK0wcfNRFw1MSJhfyxyirtOoBwXqbDcBeX6BEih5nMAasrxyL0QO3Q5d DXQklO1m8gUq6BEVfG2pAPO1wxr9MyYHetFwRbEixzmabWgi0F6m5teY1r6WH1WB5GP1 gmu3InKNmQQQUn6yr14uYlnhcb4zj4shBUFuFgRWDfIrm7mOwzD0+FQI8PcDIgqG8Eh6 QNBhMqrjvPyHypMgR1GtJsbJCvetFpm0G4lkUFPwtDWSFsTd6/9JcKGp12ZzfNupmVLz I3KA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Y3FYi97P; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h10si3210156pgq.28.2018.02.14.03.33.34; Wed, 14 Feb 2018 03:33:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Y3FYi97P; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967454AbeBNLcc (ORCPT + 99 others); Wed, 14 Feb 2018 06:32:32 -0500 Received: from mail-qk0-f180.google.com ([209.85.220.180]:36323 "EHLO mail-qk0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967342AbeBNLc3 (ORCPT ); Wed, 14 Feb 2018 06:32:29 -0500 Received: by mail-qk0-f180.google.com with SMTP id 15so26214852qkl.3 for ; Wed, 14 Feb 2018 03:32:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=fmU1cak/Xj98XC1m2uq8BzBNva6X5MH2ot97Fn4d79Q=; b=Y3FYi97PUy6KZsK80uL1jqOymRtltLGfDzws+ZopL/2zva3F/Jn4uOO2I+g9ubRviV yyJ/5d3+nWPYEjKsa2/sg62x0Tl5bYaGZG8+3/hKOdhzlIIzC+c0rst/NzDyGcSPIslT r9HCoqIqXYN8rMBaFSHIn2jJ+/TW5QMhJeHtSYvse6XYBTSj/ujMhs3TruOBuqlKKjW6 qpX1i1lda13m1lovfzjxCZhvoSVZzq/tVMDCU+dTIPfKaUIn61U0wLOp37P5zJt1efQl htdh1li6IlzPHoB/lpVfW7VAMWhyGBCt5eqtZOPmspf6s4jAFxP26n22YH+v+8gzcHmX lMDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=fmU1cak/Xj98XC1m2uq8BzBNva6X5MH2ot97Fn4d79Q=; b=hBSpscuZMvz73jdUaspgtLhH2fGtLguuo01/bDsIp+uVAhmuHJfKl8V09RuAyYD6FO WMCQMKVDufnt89BjW1E7iPeyrmJxqCp4F5nE4BXrxydWyAAcFjgWEKF3XjR7WHsBcpqE QoYeV63GMNU4dPkZR54+t3ifMEezDhytbkiU/l3a7aPttN553fuSB5GVRpJGWbMvdR4V TiXjmVscYkN+r39pH234nq27nlW5FRWpQ9G8ahN971YxMsArQj83O2UXBZOLeKo1zdm+ pPJTCo6Kp4bG/bPMoUBUg0BRcK5weeJcrBbSULrk2KJ2EFhIIG72hV2ID74my+RQL0e8 w8Ww== X-Gm-Message-State: APf1xPCX6hF9AH0t5hnS4rbiuLhMmr7asoEx0FpP1JoEU4CVLgWglMqu 5T7ac110CT9i4AO2EDU4h4cS2xJHsYL+hb0w3O3qBI3Z X-Received: by 10.55.136.131 with SMTP id k125mr6812431qkd.319.1518607947954; Wed, 14 Feb 2018 03:32:27 -0800 (PST) MIME-Version: 1.0 Received: by 10.12.195.82 with HTTP; Wed, 14 Feb 2018 03:32:26 -0800 (PST) In-Reply-To: References: <20180213183946.1662-1-brgl@bgdev.pl> From: Andy Shevchenko Date: Wed, 14 Feb 2018 13:32:26 +0200 Message-ID: Subject: Re: [PATCH v2] reset: add support for non-DT systems To: Bartosz Golaszewski Cc: Philipp Zabel , Linux Kernel Mailing List , Bartosz Golaszewski , Sekhar Nori , Kevin Hilman , David Lechner Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 14, 2018 at 10:59 AM, Bartosz Golaszewski wrote: > 2018-02-13 20:17 GMT+01:00 Andy Shevchenko : >> On Tue, Feb 13, 2018 at 8:39 PM, Bartosz Golaszewski wrote: >>> + for (index = 0; lookup->dev; index++, lookup++) { >>> + if (strcmp(dev_id, lookup->dev)) >>> + continue; >>> + >>> + if ((!id && !lookup->id) || >>> + (id && lookup->id && !strcmp(id, lookup->id))) { >>> + rstc = __reset_control_get_internal(rcdev, >>> + index, shared); >>> + break; >>> + } >> >> Wouldn't be slightly more readable >> >> if (id && lookup->id) { >> if (strcmp(id, lookup->id)) >> continue; >> } else if (id || lookup->id) { >> continue; >> } >> >> rstc = __reset_control_get_internal(rcdev, index, shared); >> break; >> > > You'd get less indentations, yes but I wanted to emphasize the > condition on which we want to stop in this line. It doesn't matter (indentation) here, esp. taking into consideration that you already have another condition by which you continue the loop. My proposal adds consistency and from my point of view makes easier to parse. You check all false conditions in a row, end up with a true one. >>> + if (!rstc) >>> + return optional ? NULL : ERR_PTR(-ENOENT); >> >> Isn't simpler >> >> if (!optional && !rstc) // or other way around, depending which might >> be more offten >> return ERR_PTR(...); >> > > IMO it's just a matter of taste. I think in my proposal it's more straight forward. Easier to parse by reader. -- With Best Regards, Andy Shevchenko