[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZBsRBV9dw+mb5ZxZ@smile.fi.intel.com>
Date: Wed, 22 Mar 2023 16:30:29 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Pin-yen Lin <treapking@...omium.org>
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>, linux-kernel@...r.kernel.org,
Thomas Zimmermann <tzimmermann@...e.de>,
linux-acpi@...r.kernel.org,
Javier Martinez Canillas <javierm@...hat.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>,
Hsin-Yi Wang <hsinyi@...omium.org>,
Lyude Paul <lyude@...hat.com>,
NĂcolas F . R . A . Prado
<nfraprado@...labora.com>, Allen Chen <allen.chen@....com.tw>,
dri-devel@...ts.freedesktop.org, Marek Vasut <marex@...x.de>,
Stephen Boyd <swboyd@...omium.org>,
chrome-platform@...ts.linux.dev, devicetree@...r.kernel.org
Subject: Re: [PATCH v14 10/10] drm/bridge: it6505: Register Type C mode
switches
On Wed, Mar 22, 2023 at 06:46:39PM +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.
...
> + struct device_node *port_node = of_graph_get_port_by_id(dev->of_node, 1);
> + struct drm_dp_typec_switch_desc *switch_desc = &it6505->switch_desc;
> + int ret;
> + u32 dp_lanes[4];
> + unsigned int i, num_lanes;
> +
> + ret = drm_dp_register_typec_switches(dev, &port_node->fwnode,
> + &it6505->switch_desc, it6505,
> + it6505_typec_mux_set);
> + if (ret)
> + return ret;
> +
> + it6505->port_data = devm_kcalloc(dev, switch_desc->num_typec_switches,
> + sizeof(struct it6505_typec_port_data),
> + GFP_KERNEL);
> + if (!it6505->port_data) {
> + ret = -ENOMEM;
> + goto unregister_mux;
> + }
A couple of the similar comments as per previous similar patch.
...
> /* get extcon device from DTS */
> extcon = extcon_get_edev_by_phandle(dev, 0);
> - 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);
> + ret = PTR_ERR_OR_ZERO(extcon);
> + if (ret == -EPROBE_DEFER)
> + return ret;
> +
Unnecessary blank line.
> + if (ret) {
> + if (ret != -ENODEV)
> + dev_warn(dev, "Cannot get extcon device: %d\n", ret);
> +
> + it6505->extcon = NULL;
> + } else {
> + it6505->extcon = extcon;
...
> + ret = it6505_register_typec_switches(dev, it6505);
> + if (ret != -ENODEV)
> + dev_warn(dev, "Didn't register Type-C switches, err: %d\n", ret);
> +
Unnecessary blank line.
> + if (ret && !it6505->extcon) {
> + dev_err(dev, "Both extcon and Type-C switch are not registered.\n");
> + return -EINVAL;
Why not return ret here?
> + }
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists