Received: by 10.213.65.68 with SMTP id h4csp1157002imn; Wed, 14 Mar 2018 11:14:41 -0700 (PDT) X-Google-Smtp-Source: AG47ELuvwPhf24uiW4s//RGH+hiOfYtMTvACPGqjPkU2J4jzBE12jiek6KYOU5S6ClHYOIns6Vt3 X-Received: by 10.98.31.155 with SMTP id l27mr5217479pfj.176.1521051281072; Wed, 14 Mar 2018 11:14:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521051281; cv=none; d=google.com; s=arc-20160816; b=Rmvtn2Eehzas91E/tAzq96GIoSEsS8hsLmDnMim8U150AJhMpopVBhY+AsbmCOarb8 vPjfIhjLITkzk+rZGUs6CYoHNPvYI1AridBxbt42FMrAsI0OB0db7qXSMcvhEPcdilrb 0AwdeyCTeE01mbF0SbeXoyp82TKuNwoFtr/GGrtjNpEJMPCxekNmPlN/QnejiiNK1T5y gfxJkdSO+w+hpFE0PyYJVrwAw0MeAmOF6Z3rXEes8k3WkAOihRpw2lQT4vtmm1KhjS1a K/VyAEyTTBWyf9hpaxX57E6DBR63YVkJ0+S5A22u0HqG4DNC2fFfCyljHiOMzu5bc/Yh K3hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=DmsnmAyReT2YQ7nF5vzD96EVygJjdDP+VQ68aNyAM1Y=; b=A68XY+72M6MPh1uHWO6t1/nvchIQm6DzbvyXOSUXWD1d8UpC6Mo5yZX2ksCpw0V1jR xce96cZ3i7Vdt0uWv1jieUaBYphMvwNFIuLn1q4LJsGoLwC0bti50EX/HzdzuufQTE8H zfP+OfTHDm0gQhSIrHUdTYM76B72f9cbqW7Q/TMb/8irK/8sULxOQUvIWN97fuexmyO9 e6RnjoEEP1SSN3JijlmbhijW7pB47NfSJt29H5wO/Zmv1D4IwnWCMEJqn/iGBSokE5+B +h80dR9zjLmh6Wg8qhhbxsVjZujZ9W2sBr5rzkuK8gbfCkqmGkG8WfLTQXIarsO1jqpj o9SQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 33-v6si2349352plu.426.2018.03.14.11.13.56; Wed, 14 Mar 2018 11:14:41 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752455AbeCNSKN (ORCPT + 99 others); Wed, 14 Mar 2018 14:10:13 -0400 Received: from relay0.mail.gandi.net ([217.70.178.220]:58987 "EHLO relay0-d.mail.gandi.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752301AbeCNSKK (ORCPT ); Wed, 14 Mar 2018 14:10:10 -0400 X-Originating-IP: 2.224.242.101 Received: from w540 (unknown [2.224.242.101]) (Authenticated sender: jacopo@jmondi.org) by relay0-d.mail.gandi.net (Postfix) with ESMTPSA id 62E1840047; Wed, 14 Mar 2018 19:04:39 +0100 (CET) Date: Wed, 14 Mar 2018 19:04:38 +0100 From: jacopo mondi To: Sergei Shtylyov Cc: Jacopo Mondi , architt@codeaurora.org, a.hajda@samsung.com, Laurent.pinchart@ideasonboard.com, airlied@linux.ie, horms@verge.net.au, magnus.damm@gmail.com, geert@linux-m68k.org, niklas.soderlund@ragnatech.se, robh+dt@kernel.org, mark.rutland@arm.com, dri-devel@lists.freedesktop.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 2/3] drm: bridge: Add thc63lvd1024 LVDS decoder driver Message-ID: <20180314180438.GD16424@w540> References: <1520951425-13843-1-git-send-email-jacopo+renesas@jmondi.org> <1520951425-13843-3-git-send-email-jacopo+renesas@jmondi.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="EY/WZ/HvNxOox07X" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --EY/WZ/HvNxOox07X Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Hi Sergei, thanks for review On Wed, Mar 14, 2018 at 08:09:52PM +0300, Sergei Shtylyov wrote: > On 03/13/2018 05:30 PM, Jacopo Mondi wrote: > > > Add DRM bridge driver for Thine THC63LVD1024 LVDS to digital parallel > > output decoder. > > > > Signed-off-by: Jacopo Mondi > [...] > > diff --git a/drivers/gpu/drm/bridge/thc63lvd1024.c b/drivers/gpu/drm/bridge/thc63lvd1024.c > > new file mode 100644 > > index 0000000..4b059c0 > > --- /dev/null > > +++ b/drivers/gpu/drm/bridge/thc63lvd1024.c > > @@ -0,0 +1,241 @@ > > +// SPDX-License-Identifier: GPL-2.0 > > +/* > > + * THC63LVD1024 LVDS to parallel data DRM bridge driver. > > + * > > + * Copyright (C) 2018 Jacopo Mondi > > + */ > > + > > +#include > > +#include > > +#include > > + > > +#include > > +#include > > +#include > > + > > +static const char * const thc63_reg_names[] = { > > + "vcc", "lvcc", "pvcc", "cvcc", }; > > Your bracing style is pretty strange -- neither here nor there. Please place }; > on the next line... Yeah, I had doubt about this.. The most common style I found around is static const char * const foo[] = { "bar", "baz", "...", }; But seems really too many lines for a bunch of 4 character strings... > > [...] > > +static void thc63_enable(struct drm_bridge *bridge) > > +{ > > + struct thc63_dev *thc63 = to_thc63(bridge); > > + struct regulator *vcc; > > + unsigned int i; > > + int ret; > > + > > + for (i = 0; i < ARRAY_SIZE(thc63->vccs); i++) { > > + vcc = thc63->vccs[i]; > > + if (vcc) { > > + ret = regulator_enable(vcc); > > + if (ret) > > You hardly need this variable, could do a call right in this *if*. > > [...] > > +error_vcc_enable: > > + dev_err(thc63->dev, "Failed to enable regulator %u\n", i); > > +} > > + > > Why not do this instead of *goto* before? Well, goto breaks the loop, if I only print out the error message, the enable sequence will go on and enable the other regulators. I can print out and break, but I don't see that much benefit One thing I could do instead, is not only print out the error message, but disable the already enabled regulators if one fails to start. > > > +static void thc63_disable(struct drm_bridge *bridge) > > +{ > > + struct thc63_dev *thc63 = to_thc63(bridge); > > + struct regulator *vcc; > > + unsigned int i; > > + int ret; > > + > > + for (i = 0; i < ARRAY_SIZE(thc63->vccs); i++) { > > + vcc = thc63->vccs[i]; > > + if (vcc) { > > + ret = regulator_disable(vcc); > > + if (ret) > > Again, no need for 'ret' whatsoever... > > > + goto error_vcc_disable; > > + } > > + } > > + > > + if (thc63->pwdn) > > + gpiod_set_value(thc63->pwdn, 1); > > + > > + if (thc63->oe) > > + gpiod_set_value(thc63->oe, 0); > > + > > + return; > > + > > +error_vcc_disable: > > + dev_err(thc63->dev, "Failed to disable regulator %u\n", i); > > Again, why not do it instead of *goto*? ditto > > [...] > > +static int thc63_gpio_init(struct thc63_dev *thc63) > > +{ > > + thc63->pwdn = devm_gpiod_get_optional(thc63->dev, "pwdn", > > + GPIOD_OUT_LOW); > > + if (IS_ERR(thc63->pwdn)) { > > + dev_err(thc63->dev, "Unable to get GPIO \"pwdn\"\n"); > > "pwdn-gpios" maybe? > > > + return PTR_ERR(thc63->pwdn); > > + } > > + > > + thc63->oe = devm_gpiod_get_optional(thc63->dev, "oe", GPIOD_OUT_LOW); > > + if (IS_ERR(thc63->oe)) { > > + dev_err(thc63->dev, "Unable to get GPIO \"oe\"\n"); > > "oe-gpios" maybe? Are you referring to the error message? I can change this, but again, I see no standards around. Thanks j > > [...] > > MBR, Sergei --EY/WZ/HvNxOox07X Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJaqWQ2AAoJEHI0Bo8WoVY8LpUQAKIyRMcMRnIzIsyHbHxNh2V8 tUIGieL84JcuSgN7hXLFt1sUoW+fQTu69G8LOSZKRV5idnEKMatmkuUnqIatuXXz IkfqwfTdOHO1YoEWpsNvGUDa5UQBJO5ZK4PnrwNvGLfIddk+pdISmYvkvRzA7MG5 4ETsY/iE0XIhxPIxA+y/aiWwtdJ1fd5AwEPawAwDsKykWbgFTy6ZOdULr/bnQHmJ 1QqvwJV09JxXHUl7eGq9TsLhXBFj/ukWTX5gmbaqI7EBImQtgqf6ShqPBcr/ypLJ pC7IHosNnVKF8Nk7IM0GVQjc5PIE+arHQAupEt98SpfezJluLkeDBfQmCjihzEAI XRanoQJJONS5pv2SVFNql1W37p3ofeJDAbSEApdtcCn9r/wXZ0uQKnL6q68md73o 1s2jRXXKSjjePZ8QX/umlKkVjD1GYV4d/L1KJU0ejzaYKtutGHcZhzzkh5PwWQjA mLsWv+lZu0+apeef9lJ8Ev8dHZTYp1X7JlKWVL6f68bVSd4k235T9ynflIkKfPkp GOTIuZ90A6Oe7Zr6d67tumLpn0xXr6fEMTl1jl0SVwkGUAtI30TNmoqKQlb9Ezu6 SUUvPY4oEIEg9vTi9N1hPMqqyGkXeyCV2KGH2upNKWDH4gVtr7f3JwvwwUfP0Ip5 q7/f9gha5CKFVewZ/Q42 =Sba9 -----END PGP SIGNATURE----- --EY/WZ/HvNxOox07X--