[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEXTbpe=e1iA7cnzuTtcsyFxpG37YCWSK_SqZb2A8hxcyCnJBg@mail.gmail.com>
Date: Wed, 8 Mar 2023 21:51:19 +0800
From: Pin-yen Lin <treapking@...omium.org>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Andrzej Hajda <andrzej.hajda@...el.com>,
Neil Armstrong <neil.armstrong@...aro.org>,
Robert Foss <rfoss@...nel.org>,
Laurent Pinchart <Laurent.pinchart@...asonboard.com>,
Jonas Karlman <jonas@...boo.se>,
Jernej Skrabec <jernej.skrabec@...il.com>,
David Airlie <airlied@...il.com>,
Daniel Vetter <daniel@...ll.ch>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Daniel Scally <djrscally@...il.com>,
Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
Sakari Ailus <sakari.ailus@...ux.intel.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J . Wysocki" <rafael@...nel.org>,
Prashant Malani <pmalani@...omium.org>,
Benson Leung <bleung@...omium.org>,
Guenter Roeck <groeck@...omium.org>,
Xin Ji <xji@...logixsemi.com>,
Javier Martinez Canillas <javierm@...hat.com>,
Lyude Paul <lyude@...hat.com>, linux-kernel@...r.kernel.org,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>,
chrome-platform@...ts.linux.dev,
Nícolas F . R . A . Prado
<nfraprado@...labora.com>, Marek Vasut <marex@...x.de>,
Hsin-Yi Wang <hsinyi@...omium.org>, devicetree@...r.kernel.org,
Allen Chen <allen.chen@....com.tw>,
dri-devel@...ts.freedesktop.org,
Thomas Zimmermann <tzimmermann@...e.de>,
Stephen Boyd <swboyd@...omium.org>, linux-acpi@...r.kernel.org
Subject: Re: [PATCH v13 10/10] drm/bridge: it6505: Register Type C mode switches
Hi Andy,
Thanks for the review.
On Mon, Mar 6, 2023 at 8:03 PM Andy Shevchenko
<andriy.shevchenko@...ux.intel.com> wrote:
>
> On Fri, Mar 03, 2023 at 10:33:50PM +0800, Pin-yen Lin wrote:
> > Register USB Type-C mode switches when the "mode-switch" property and
> > relevant port are available in Device Tree. Configure the "lane_swap"
> > state based on the entered alternate mode for a specific Type-C
> > connector, which ends up updating the lane swap registers of the it6505
> > chip.
>
> ...
>
> > + it6505->port_data = devm_kcalloc(dev, switch_desc->num_typec_switches,
> > + sizeof(struct it6505_typec_port_data),
> > + GFP_KERNEL);
>
> > +
>
> Same, no need for a blank line here.
>
I'll fix this in the next version.
> > + if (!it6505->port_data) {
> > + ret = -ENOMEM;
> > + goto unregister_mux;
> > + }
>
> ...
>
> > + it6505->port_data[i].lane_swap = (dp_lanes[0] / 2 == 1);
>
> ' % 2 == 0' ?
>
Per another patch, I'll update this into `< 2`
> ...
>
> Wouldn't be better to have
>
> ret = PTR_ERR_OR_ZERO(extcon);
>
> here and amend the following accordingly?
>
> > if (PTR_ERR(extcon) == -EPROBE_DEFER)
> > return -EPROBE_DEFER;
> > if (IS_ERR(extcon)) {
> > - dev_err(dev, "can not get extcon device!");
> > - return PTR_ERR(extcon);
> > + if (PTR_ERR(extcon) != -ENODEV)
> > + dev_warn(dev, "Cannot get extcon device: %ld\n",
> > + PTR_ERR(extcon));
> > + it6505->extcon = NULL;
> > + } else {
> > + it6505->extcon = extcon;
> > }
> >
> > - it6505->extcon = extcon;
> > + init_completion(&it6505->mux_register);
> > + ret = it6505_register_typec_switches(dev, it6505);
> > + if (ret) {
> > + if (ret != -ENODEV)
> > + dev_warn(dev, "Didn't register Type-C switches, err: %d\n",
> > + ret);
> > + if (!it6505->extcon) {
> > + dev_err(dev, "Both extcon and typec-switch are not registered.\n");
> > + return -EINVAL;
> > + }
> > + }
>
>
> Perhaps
>
> if (ret != -ENODEV)
> dev_warn(dev, "Didn't register Type-C switches, err: %d\n", ret);
>
> if (ret && !it6505->extcon) {
> dev_err(dev, "Both extcon and typec-switch are not registered.\n");
> return ret;
> }
>
> ?
Thanks for the suggestion! I'll update this in v14.
>
> --
> With Best Regards,
> Andy Shevchenko
>
>
Best regards,
Pin-yen
Powered by blists - more mailing lists