Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3420780imm; Mon, 8 Oct 2018 03:52:08 -0700 (PDT) X-Google-Smtp-Source: ACcGV62GIo3pot29Q8AdiZggO+hcOVN52iTAVnU74LtznyrkeUZECkBTAmlEccHYWK64f6Ou4b0g X-Received: by 2002:a63:f110:: with SMTP id f16-v6mr20703369pgi.236.1538995928384; Mon, 08 Oct 2018 03:52:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538995928; cv=none; d=google.com; s=arc-20160816; b=jo59vvIzGERGhyHRicExj1YcErpOpX/uUEo9X4nuHtpbmzWr7cA4KMOtciur6PrcTT Em7hg9ZtU2skvsd01UNdDsmQKxrk4mdRmx16wNccOa/Cwb5oiLWX7mZ9HPV19duiJeee JJyGdyyUqGOoLNiaOXS696lvTFFa6QeJHW996T9/dS/GHRGKrNv96raKUKetDI8AbPzA RpQhLjB1uxLKhk7yCpqmGBrosQPisYjRRF2ma/ndtI9Y+PmHTyTjg4MsN6AUDy5oMxEv AcJHGXMHNFROheK1a/5Wu8dKBUhcISQWEC4e1al+V5rhULDQOrbqiRgWQJmM37JVsyRk EvOA== 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 :in-reply-to:references:mime-version; bh=sp1Rt77FbE0VElAV0LDzuDpOt6j+idfasg4Y/aRM7S0=; b=eRL2vYs3M4w0whXhtzcSfO/njGaj8IZ181i5VltCl4xRpDX36O019pV3ufINXnAQTH ObnTxDqT/fSpd0VH0n9vRv9mxrbfaWLEyTiF+3xZvNglkSN8HMF8YhCJiT6/ABzgaxgP nQbymvqVLk4Y4KP7HDTNc42LZ3qlqbn8EJdeqG444UhVz80tb2n9ZryR7M67NhNkPkv2 JjICOO5UN20YLp1F5IE5dBXjPdILfpMuscoLEPMmnbzwqjF239A9Dij5UxaMPoOvvdvK LjsZPW/j5bZTy84zOHnIRnZvLXi3H1im+f/OkW46k3Ahj9GSpc8+kLRXnuBEG/g5jhKe nNtw== 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 w24-v6si17096132plp.110.2018.10.08.03.51.53; Mon, 08 Oct 2018 03:52:08 -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 S1727675AbeJHSCH (ORCPT + 99 others); Mon, 8 Oct 2018 14:02:07 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:43441 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726511AbeJHSCG (ORCPT ); Mon, 8 Oct 2018 14:02:06 -0400 Received: by mail-ed1-f65.google.com with SMTP id y20-v6so10509566eds.10; Mon, 08 Oct 2018 03:50:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=sp1Rt77FbE0VElAV0LDzuDpOt6j+idfasg4Y/aRM7S0=; b=CMDq7R/SvgWQ3N2gIn/2vi9otq9O983CdvYDvz7CK6NpR0r2upZOPIDoKQMsXRW2fB uG2ghjP647tlfOcEIUQJX1Vp40Ww2yjpluoCLjv9BHfBS0cg6X+Nviulya0LjOSQ8NIy KHrYKL9KcfddvySdHmHBM7SoPRnPAPhYeQYEHtWG4eiozvhcDm65vn6qEUe8Hh4O4Krj I8FB6euZXqVNMkLinPnXO/qsfr64pD5/wsQgb335wp1eXODZFzKiCUazjQKHylfSDVWq uHk9A2hQEiARkkmRmb0QrXY8zqiLg5qWiDj5zmO+1g0gKWzI1TReeOLOqalHPFhQHSA7 6Yiw== X-Gm-Message-State: ABuFfoixVsQ1OIwB+IY4ZEgFu7VWFd0v4TfUaEaQm+PWKc90khqBOiWW hW6t52CP+Gd8Zyh4FEz2iCdf0xE0yH0= X-Received: by 2002:a17:906:70c3:: with SMTP id g3-v6mr22367610ejk.194.1538995857175; Mon, 08 Oct 2018 03:50:57 -0700 (PDT) Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com. [209.85.128.50]) by smtp.gmail.com with ESMTPSA id e38-v6sm5597250eda.67.2018.10.08.03.50.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Oct 2018 03:50:56 -0700 (PDT) Received: by mail-wm1-f50.google.com with SMTP id 189-v6so7666881wmw.2; Mon, 08 Oct 2018 03:50:56 -0700 (PDT) X-Received: by 2002:a1c:e717:: with SMTP id e23-v6mr4168295wmh.145.1538995856186; Mon, 08 Oct 2018 03:50:56 -0700 (PDT) MIME-Version: 1.0 References: <20181007093905.11253-1-jernej.skrabec@siol.net> <20181007093905.11253-26-jernej.skrabec@siol.net> <20181008085112.mejpwvl3dpu7sopy@flea> <20181008102021.ox34mqbw65euvsb4@flea> In-Reply-To: <20181008102021.ox34mqbw65euvsb4@flea> From: Chen-Yu Tsai Date: Mon, 8 Oct 2018 18:50:44 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 25/29] drm: sun4i: add quirks for TCON TOP To: Maxime Ripard Cc: Jernej Skrabec , Rob Herring , Stephen Boyd , David Airlie , Archit Taneja , Andrzej Hajda , Laurent Pinchart , devicetree , linux-arm-kernel , linux-kernel , linux-clk , dri-devel , linux-sunxi , Icenowy Zheng 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 Mon, Oct 8, 2018 at 6:20 PM Maxime Ripard wrote: > > On Mon, Oct 08, 2018 at 05:06:45PM +0800, Chen-Yu Tsai wrote: > > On Mon, Oct 8, 2018 at 4:51 PM Maxime Ripard wrote: > > > > > > On Sun, Oct 07, 2018 at 11:39:01AM +0200, Jernej Skrabec wrote: > > > > From: Icenowy Zheng > > > > > > > > Some SoCs, such as H6, doesn't have a full-featured TCON TOP. > > > > > > > > Add quirks support for TCON TOP. > > > > > > > > Currently the presence of TCON_TV1 and DSI is controlled via the quirks > > > > structure. > > > > > > > > Signed-off-by: Icenowy Zheng > > > > --- > > > > drivers/gpu/drm/sun4i/sun8i_tcon_top.c | 43 ++++++++++++++++++++------ > > > > 1 file changed, 34 insertions(+), 9 deletions(-) > > > > > > > > diff --git a/drivers/gpu/drm/sun4i/sun8i_tcon_top.c b/drivers/gpu/drm/sun4i/sun8i_tcon_top.c > > > > index 37158548b447..ed13233cad88 100644 > > > > --- a/drivers/gpu/drm/sun4i/sun8i_tcon_top.c > > > > +++ b/drivers/gpu/drm/sun4i/sun8i_tcon_top.c > > > > @@ -9,11 +9,17 @@ > > > > #include > > > > #include > > > > #include > > > > +#include > > > > #include > > > > #include > > > > > > > > #include "sun8i_tcon_top.h" > > > > > > > > +struct sun8i_tcon_top_quirks { > > > > + bool has_tcon_tv1; > > > > + bool has_dsi; > > > > +}; > > > > + > > > > static bool sun8i_tcon_top_node_is_tcon_top(struct device_node *node) > > > > { > > > > return !!of_match_node(sun8i_tcon_top_of_table, node); > > > > @@ -121,10 +127,13 @@ static int sun8i_tcon_top_bind(struct device *dev, struct device *master, > > > > struct platform_device *pdev = to_platform_device(dev); > > > > struct clk_hw_onecell_data *clk_data; > > > > struct sun8i_tcon_top *tcon_top; > > > > + const struct sun8i_tcon_top_quirks *quirks; > > > > struct resource *res; > > > > void __iomem *regs; > > > > int ret, i; > > > > > > > > + quirks = of_device_get_match_data(&pdev->dev); > > > > + > > > > tcon_top = devm_kzalloc(dev, sizeof(*tcon_top), GFP_KERNEL); > > > > if (!tcon_top) > > > > return -ENOMEM; > > > > @@ -187,15 +196,23 @@ static int sun8i_tcon_top_bind(struct device *dev, struct device *master, > > > > &tcon_top->reg_lock, > > > > TCON_TOP_TCON_TV0_GATE, 0); > > > > > > > > - clk_data->hws[CLK_TCON_TOP_TV1] = > > > > - sun8i_tcon_top_register_gate(dev, "tcon-tv1", regs, > > > > - &tcon_top->reg_lock, > > > > - TCON_TOP_TCON_TV1_GATE, 1); > > > > + if (quirks->has_tcon_tv1) { > > > > + clk_data->hws[CLK_TCON_TOP_TV1] = > > > > + sun8i_tcon_top_register_gate(dev, "tcon-tv1", regs, > > > > + &tcon_top->reg_lock, > > > > + TCON_TOP_TCON_TV1_GATE, 1); > > > > + } else { > > > > + clk_data->hws[CLK_TCON_TOP_TV1] = NULL; > > > > + } > > > > > > > > - clk_data->hws[CLK_TCON_TOP_DSI] = > > > > - sun8i_tcon_top_register_gate(dev, "dsi", regs, > > > > - &tcon_top->reg_lock, > > > > - TCON_TOP_TCON_DSI_GATE, 2); > > > > + if (quirks->has_dsi) { > > > > + clk_data->hws[CLK_TCON_TOP_DSI] = > > > > + sun8i_tcon_top_register_gate(dev, "dsi", regs, > > > > + &tcon_top->reg_lock, > > > > + TCON_TOP_TCON_DSI_GATE, 2); > > > > + } else { > > > > + clk_data->hws[CLK_TCON_TOP_DSI] = NULL; > > > > > > clk_data has been kzalloc'd so its content is already NULL. > > > > > > And you shouldn't have brackets for single line blocks. > > > > > > with that fixed, > > > > FYI checkpatch.pl complains if you use brackets for the if block > > but not for the else block. They should be matching. > > Checkpatch might not warn on this, but > https://www.kernel.org/doc/Documentation/process/coding-style.rst, > section 3 is pretty clear on whether we should use them or not. Right. What I'm pointing out what checkpatch.pl complains about is shown in the second last example in section 3: This does not apply if only one branch of a conditional statement is a single statement; in the latter case use braces in both branches: Which is where I think your comment on "shouldn't have brackets for single line blocks" is pointing in the opposite direction. ChenYu