lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 23 Nov 2023 13:25:06 +0800
From:   Sui Jingfeng <sui.jingfeng@...ux.dev>
To:     Dmitry Baryshkov <dmitry.baryshkov@...aro.org>
Cc:     Phong LE <ple@...libre.com>,
        Neil Armstrong <neil.armstrong@...aro.org>,
        Maxime Ripard <mripard@...nel.org>,
        Sui Jingfeng <suijingfeng@...ngson.cn>,
        linux-kernel@...r.kernel.org, dri-devel@...ts.freedesktop.org,
        Laurent Pinchart <Laurent.pinchart@...asonboard.com>,
        Thomas Zimmermann <tzimmermann@...e.de>
Subject: Re: [PATCH 4/8] drm/bridge: it66121: Add a helper function to get the
 next bridge

Hi,


On 2023/11/15 00:05, Dmitry Baryshkov wrote:
> On Tue, 14 Nov 2023 at 17:09, Sui Jingfeng <sui.jingfeng@...ux.dev> wrote:
>> From: Sui Jingfeng <suijingfeng@...ngson.cn>
>>
>> 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 <suijingfeng@...ngson.cn>
>> ---
>>   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
>>
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ