Re: [PATCH v4 11/27] drm/bridge: ti-sn65dsi86: Add local var for "dev" to simplify probe

From: Bjorn Andersson
Date: Fri Apr 23 2021 - 10:38:15 EST


On Fri 16 Apr 17:39 CDT 2021, Douglas Anderson wrote:

> Tiny cleanup for probe so we don't keep having to specify
> "&client->dev" or "pdata->dev". No functional changes intended.
>

Nice

Reviewed-by: Bjorn Andersson <bjorn.andersson@xxxxxxxxxx>

Regards,
Bjorn

> Signed-off-by: Douglas Anderson <dianders@xxxxxxxxxxxx>
> ---
>
> (no changes since v1)
>
> drivers/gpu/drm/bridge/ti-sn65dsi86.c | 26 ++++++++++++--------------
> 1 file changed, 12 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c
> index 0c6aa99ddc99..2cbf619fbd27 100644
> --- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c
> +++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c
> @@ -1226,6 +1226,7 @@ static void ti_sn_bridge_parse_lanes(struct ti_sn65dsi86 *pdata,
> static int ti_sn65dsi86_probe(struct i2c_client *client,
> const struct i2c_device_id *id)
> {
> + struct device *dev = &client->dev;
> struct ti_sn65dsi86 *pdata;
> int ret;
>
> @@ -1234,8 +1235,7 @@ static int ti_sn65dsi86_probe(struct i2c_client *client,
> return -ENODEV;
> }
>
> - pdata = devm_kzalloc(&client->dev, sizeof(struct ti_sn65dsi86),
> - GFP_KERNEL);
> + pdata = devm_kzalloc(dev, sizeof(struct ti_sn65dsi86), GFP_KERNEL);
> if (!pdata)
> return -ENOMEM;
>
> @@ -1246,26 +1246,24 @@ static int ti_sn65dsi86_probe(struct i2c_client *client,
> return PTR_ERR(pdata->regmap);
> }
>
> - pdata->dev = &client->dev;
> + pdata->dev = dev;
>
> - ret = drm_of_find_panel_or_bridge(pdata->dev->of_node, 1, 0,
> - &pdata->panel, NULL);
> + ret = drm_of_find_panel_or_bridge(dev->of_node, 1, 0, &pdata->panel, NULL);
> if (ret) {
> DRM_ERROR("could not find any panel node\n");
> return ret;
> }
>
> - dev_set_drvdata(&client->dev, pdata);
> + dev_set_drvdata(dev, pdata);
>
> - pdata->enable_gpio = devm_gpiod_get(pdata->dev, "enable",
> - GPIOD_OUT_LOW);
> + pdata->enable_gpio = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW);
> if (IS_ERR(pdata->enable_gpio)) {
> DRM_ERROR("failed to get enable gpio from DT\n");
> ret = PTR_ERR(pdata->enable_gpio);
> return ret;
> }
>
> - ti_sn_bridge_parse_lanes(pdata, client->dev.of_node);
> + ti_sn_bridge_parse_lanes(pdata, dev->of_node);
>
> ret = ti_sn65dsi86_parse_regulators(pdata);
> if (ret) {
> @@ -1273,7 +1271,7 @@ static int ti_sn65dsi86_probe(struct i2c_client *client,
> return ret;
> }
>
> - pdata->refclk = devm_clk_get_optional(pdata->dev, "refclk");
> + pdata->refclk = devm_clk_get_optional(dev, "refclk");
> if (IS_ERR(pdata->refclk))
> return PTR_ERR(pdata->refclk);
>
> @@ -1281,23 +1279,23 @@ static int ti_sn65dsi86_probe(struct i2c_client *client,
> if (ret)
> return ret;
>
> - pm_runtime_enable(pdata->dev);
> + pm_runtime_enable(dev);
>
> ret = ti_sn_setup_gpio_controller(pdata);
> if (ret) {
> - pm_runtime_disable(pdata->dev);
> + pm_runtime_disable(dev);
> return ret;
> }
>
> i2c_set_clientdata(client, pdata);
>
> pdata->aux.name = "ti-sn65dsi86-aux";
> - pdata->aux.dev = pdata->dev;
> + pdata->aux.dev = dev;
> pdata->aux.transfer = ti_sn_aux_transfer;
> drm_dp_aux_init(&pdata->aux);
>
> pdata->bridge.funcs = &ti_sn_bridge_funcs;
> - pdata->bridge.of_node = client->dev.of_node;
> + pdata->bridge.of_node = dev->of_node;
>
> drm_bridge_add(&pdata->bridge);
>
> --
> 2.31.1.368.gbe11c130af-goog
>