Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp118405rdh; Wed, 22 Nov 2023 21:25:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IFn+uJFdZxs5rm/1hAhpv+4FrxAqhyaMPPspf2//rZmvpxEnD2iOTYG9EaB2LksjNIJcYBc X-Received: by 2002:a17:902:c083:b0:1cf:7911:460f with SMTP id j3-20020a170902c08300b001cf7911460fmr4218097pld.51.1700717131173; Wed, 22 Nov 2023 21:25:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700717131; cv=none; d=google.com; s=arc-20160816; b=KVXoP9e6u8LjwWs3catZsWWZ365T77AFVjhQPjNBREbCtRcM/AqcQMOnlHT/99hhnV PWFV0thp79GY1O8ENTWzPGIHDFdSWjKsrQAZxxA/ZGLFq10/sMFE2FnHVqZQj5rEZTM+ E+plT1bdkF6k11PUwo+MVuLbS9wWAHGG1eivJnSL+SrLu4QYCCTswhDdki0/0W26Pj0G pnJSlFFDZMGfUtAkveLM0PoUJnJ6NzDuylxUjnLkqveM44YJSkgaFGecaS0+a/kFw7QM lm1WfE84vtpDkvgKQXzjzvvotMfSwScqKvrSWMWfVn2iYVi3KG4Je4ipj2pR5ibkwK3r wnJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:mime-version:date :dkim-signature:message-id; bh=wBhhyWhQXe9PftzJalTPt0fVqtNHiuvkFXOR/3zACow=; fh=L6MbuOTOK7FHgIF89LITj4O+NnVze0RQCyrYNOhkPmg=; b=rYjTyDkrWAvhpaLndqeTLcjzgrnm0P3FjTjeAJfcsErQHlpcyAgayDqqiZQ2cm7D+2 V0DVW1AfZSWJpX9RKr1QwfvFUsRGD/fWVtKKd7MWz9VlOHcQshX9gTO8VhpWcQsUhTDg 94uc78U3/byjOsxtdXdn2oFSDoaFiBNEEwNkB7evIcN4NvmjBqaM35gV9b5RhiE3d2uS EPlHj1K0Xazmilh6tsMtxgBvRMCaMElaVoUu7XHVJRLppGZ5zq6Qk2VNJFLoMPshRNhy F182/h/SFNzmik+RTg8tg7nuTpekfa/1S/oJya82T3s5zg4wN20S/YJgJpZCFZJ43iJg VICg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=v1OiRbRt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id j6-20020a170903024600b001cc7c079304si470874plh.97.2023.11.22.21.25.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 21:25:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=v1OiRbRt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 97419807AFF9; Wed, 22 Nov 2023 21:25:28 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232115AbjKWFZK (ORCPT + 99 others); Thu, 23 Nov 2023 00:25:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229994AbjKWFZI (ORCPT ); Thu, 23 Nov 2023 00:25:08 -0500 Received: from out-172.mta0.migadu.com (out-172.mta0.migadu.com [91.218.175.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A43B1AE for ; Wed, 22 Nov 2023 21:25:14 -0800 (PST) Message-ID: <1ea7e68d-7005-4f5b-92df-d2f7c56a49b2@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1700717112; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wBhhyWhQXe9PftzJalTPt0fVqtNHiuvkFXOR/3zACow=; b=v1OiRbRtIea2CS+rg0tQ8ZJe2jyQq1v/LYeS5X9Jgy0QI6ugTyq7ZKJKJESGLNEr9M6JgN M/hwo3PVyNczEDfcX2vI97cj5qmwITffUuN+O04o4Yej3sAOZdQJdgHnp7kH9kHRsMFWiK M8TW5pTzDnx2C2wOPkydAEOmSPwpoxg= Date: Thu, 23 Nov 2023 13:25:06 +0800 MIME-Version: 1.0 Subject: Re: [PATCH 4/8] drm/bridge: it66121: Add a helper function to get the next bridge Content-Language: en-US To: Dmitry Baryshkov Cc: Phong LE , Neil Armstrong , Maxime Ripard , Sui Jingfeng , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Laurent Pinchart , Thomas Zimmermann References: <20231114150130.497915-1-sui.jingfeng@linux.dev> <20231114150130.497915-5-sui.jingfeng@linux.dev> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Sui Jingfeng In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 22 Nov 2023 21:25:28 -0800 (PST) Hi, On 2023/11/15 00:05, Dmitry Baryshkov wrote: > On Tue, 14 Nov 2023 at 17:09, Sui Jingfeng wrote: >> From: Sui Jingfeng >> >> Group the code lines(which with the same functional) into one dedicated >> function, which reduce the weight of it66121_probe() function. Just trivial >> cleanuo, no functional change. >> >> Signed-off-by: Sui Jingfeng >> --- >> drivers/gpu/drm/bridge/ite-it66121.c | 53 ++++++++++++++++++---------- >> 1 file changed, 34 insertions(+), 19 deletions(-) >> >> diff --git a/drivers/gpu/drm/bridge/ite-it66121.c b/drivers/gpu/drm/bridge/ite-it66121.c >> index 0f78737adc83..7e473beefc79 100644 >> --- a/drivers/gpu/drm/bridge/ite-it66121.c >> +++ b/drivers/gpu/drm/bridge/ite-it66121.c >> @@ -340,6 +340,37 @@ static int it66121_of_read_bus_width(struct device *dev, u32 *bus_width) >> return 0; >> } >> >> +static int it66121_of_get_next_bridge(struct device *dev, >> + struct drm_bridge **next_bridge) > it already exists and it is called drm_of_find_panel_or_bridge(), > could you please use it instead? That function is too fat and tangled, and should be untangled. it66121 can not connect with a panel, this is a prior knowledge and is known at compile time. So this prior knowledge shouldn't be dropped. >> +{ >> + struct device_node *np; >> + struct drm_bridge *bridge; >> + >> + np = of_graph_get_remote_node(dev->of_node, 1, -1); >> + if (!np) { >> + dev_err(dev, "The endpoint is unconnected\n"); >> + return -EINVAL; >> + } >> + >> + if (!of_device_is_available(np)) { >> + of_node_put(np); >> + dev_err(dev, "The remote device is disabled\n"); >> + return -ENODEV; >> + } >> + >> + bridge = of_drm_find_bridge(np); >> + of_node_put(np); >> + >> + if (!bridge) { >> + dev_dbg(dev, "Next bridge not found, deferring probe\n"); >> + return -EPROBE_DEFER; >> + } >> + >> + *next_bridge = bridge; >> + >> + return 0; >> +} >> + >> static const struct regmap_range_cfg it66121_regmap_banks[] = { >> { >> .name = "it66121", >> @@ -1531,7 +1562,6 @@ static const char * const it66121_supplies[] = { >> static int it66121_probe(struct i2c_client *client) >> { >> u32 revision_id, vendor_ids[2] = { 0 }, device_ids[2] = { 0 }; >> - struct device_node *ep; >> int ret; >> struct it66121_ctx *ctx; >> struct device *dev = &client->dev; >> @@ -1553,24 +1583,9 @@ static int it66121_probe(struct i2c_client *client) >> if (ret) >> return ret; >> >> - ep = of_graph_get_remote_node(dev->of_node, 1, -1); >> - if (!ep) { >> - dev_err(dev, "The endpoint is unconnected\n"); >> - return -EINVAL; >> - } >> - >> - if (!of_device_is_available(ep)) { >> - of_node_put(ep); >> - dev_err(dev, "The remote device is disabled\n"); >> - return -ENODEV; >> - } >> - >> - ctx->next_bridge = of_drm_find_bridge(ep); >> - of_node_put(ep); >> - if (!ctx->next_bridge) { >> - dev_dbg(dev, "Next bridge not found, deferring probe\n"); >> - return -EPROBE_DEFER; >> - } >> + ret = it66121_of_get_next_bridge(dev, &ctx->next_bridge); >> + if (ret) >> + return ret; >> >> i2c_set_clientdata(client, ctx); >> mutex_init(&ctx->lock); >> -- >> 2.34.1 >> >