From: Robert Foss <robert.foss@linaro.org>
To: Xin Ji <xji@analogixsemi.com>
Cc: Hsin-Yi Wang <hsinyi@chromium.org>,
Andrzej Hajda <andrzej.hajda@intel.com>,
Neil Armstrong <narmstrong@baylibre.com>,
Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
Jonas Karlman <jonas@kwiboo.se>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
Sam Ravnborg <sam@ravnborg.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
Maxime Ripard <maxime@cerno.tech>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/4] drm/bridge: anx7625: Convert to devm_i2c_new_dummy_device()
Date: Wed, 6 Jul 2022 14:31:21 +0200 [thread overview]
Message-ID: <CAG3jFyu2KObuc5CiFFK=NzkE1LOTSFVoA3mNyY6r1aKs2SU3ow@mail.gmail.com> (raw)
In-Reply-To: <20220706022926.GA2357796@anxtwsw-Precision-3640-Tower>
Hey Hsin-Yi,
On Wed, 6 Jul 2022 at 04:29, Xin Ji <xji@analogixsemi.com> wrote:
>
> Hi Hsin-Yi, thanks for your patch, looks good to me.
>
> Reviewed-by: Xin Ji <xji@analogixsemi.com>
>
> On Thu, Jun 30, 2022 at 12:05:47AM +0800, Hsin-Yi Wang wrote:
> > Simplify the resource management.
> >
> > Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
> > ---
> > drivers/gpu/drm/bridge/analogix/anx7625.c | 96 +++++++----------------
> > 1 file changed, 27 insertions(+), 69 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c
> > index 3710fa9ee0acd..f89e8151475f7 100644
> > --- a/drivers/gpu/drm/bridge/analogix/anx7625.c
> > +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c
> > @@ -2436,82 +2436,44 @@ static const struct drm_bridge_funcs anx7625_bridge_funcs = {
> > static int anx7625_register_i2c_dummy_clients(struct anx7625_data *ctx,
> > struct i2c_client *client)
> > {
> > - int err = 0;
> > + struct device *dev = &ctx->client->dev;
> >
> > - ctx->i2c.tx_p0_client = i2c_new_dummy_device(client->adapter,
> > - TX_P0_ADDR >> 1);
> > + ctx->i2c.tx_p0_client = devm_i2c_new_dummy_device(dev, client->adapter,
> > + TX_P0_ADDR >> 1);
> > if (IS_ERR(ctx->i2c.tx_p0_client))
> > return PTR_ERR(ctx->i2c.tx_p0_client);
> >
> > - ctx->i2c.tx_p1_client = i2c_new_dummy_device(client->adapter,
> > - TX_P1_ADDR >> 1);
> > - if (IS_ERR(ctx->i2c.tx_p1_client)) {
> > - err = PTR_ERR(ctx->i2c.tx_p1_client);
> > - goto free_tx_p0;
> > - }
> > + ctx->i2c.tx_p1_client = devm_i2c_new_dummy_device(dev, client->adapter,
> > + TX_P1_ADDR >> 1);
> > + if (IS_ERR(ctx->i2c.tx_p1_client))
> > + return PTR_ERR(ctx->i2c.tx_p1_client);
> >
> > - ctx->i2c.tx_p2_client = i2c_new_dummy_device(client->adapter,
> > - TX_P2_ADDR >> 1);
> > - if (IS_ERR(ctx->i2c.tx_p2_client)) {
> > - err = PTR_ERR(ctx->i2c.tx_p2_client);
> > - goto free_tx_p1;
> > - }
> > + ctx->i2c.tx_p2_client = devm_i2c_new_dummy_device(dev, client->adapter,
> > + TX_P2_ADDR >> 1);
> > + if (IS_ERR(ctx->i2c.tx_p2_client))
> > + return PTR_ERR(ctx->i2c.tx_p2_client);
> >
> > - ctx->i2c.rx_p0_client = i2c_new_dummy_device(client->adapter,
> > - RX_P0_ADDR >> 1);
> > - if (IS_ERR(ctx->i2c.rx_p0_client)) {
> > - err = PTR_ERR(ctx->i2c.rx_p0_client);
> > - goto free_tx_p2;
> > - }
> > + ctx->i2c.rx_p0_client = devm_i2c_new_dummy_device(dev, client->adapter,
> > + RX_P0_ADDR >> 1);
> > + if (IS_ERR(ctx->i2c.rx_p0_client))
> > + return PTR_ERR(ctx->i2c.rx_p0_client);
> >
> > - ctx->i2c.rx_p1_client = i2c_new_dummy_device(client->adapter,
> > - RX_P1_ADDR >> 1);
> > - if (IS_ERR(ctx->i2c.rx_p1_client)) {
> > - err = PTR_ERR(ctx->i2c.rx_p1_client);
> > - goto free_rx_p0;
> > - }
> > + ctx->i2c.rx_p1_client = devm_i2c_new_dummy_device(dev, client->adapter,
> > + RX_P1_ADDR >> 1);
> > + if (IS_ERR(ctx->i2c.rx_p1_client))
> > + return PTR_ERR(ctx->i2c.rx_p1_client);
> >
> > - ctx->i2c.rx_p2_client = i2c_new_dummy_device(client->adapter,
> > - RX_P2_ADDR >> 1);
> > - if (IS_ERR(ctx->i2c.rx_p2_client)) {
> > - err = PTR_ERR(ctx->i2c.rx_p2_client);
> > - goto free_rx_p1;
> > - }
> > + ctx->i2c.rx_p2_client = devm_i2c_new_dummy_device(dev, client->adapter,
> > + RX_P2_ADDR >> 1);
> > + if (IS_ERR(ctx->i2c.rx_p2_client))
> > + return PTR_ERR(ctx->i2c.rx_p2_client);
> >
> > - ctx->i2c.tcpc_client = i2c_new_dummy_device(client->adapter,
> > - TCPC_INTERFACE_ADDR >> 1);
> > - if (IS_ERR(ctx->i2c.tcpc_client)) {
> > - err = PTR_ERR(ctx->i2c.tcpc_client);
> > - goto free_rx_p2;
> > - }
> > + ctx->i2c.tcpc_client = devm_i2c_new_dummy_device(dev, client->adapter,
> > + TCPC_INTERFACE_ADDR >> 1);
> > + if (IS_ERR(ctx->i2c.tcpc_client))
> > + return PTR_ERR(ctx->i2c.tcpc_client);
> >
> > return 0;
> > -
> > -free_rx_p2:
> > - i2c_unregister_device(ctx->i2c.rx_p2_client);
> > -free_rx_p1:
> > - i2c_unregister_device(ctx->i2c.rx_p1_client);
> > -free_rx_p0:
> > - i2c_unregister_device(ctx->i2c.rx_p0_client);
> > -free_tx_p2:
> > - i2c_unregister_device(ctx->i2c.tx_p2_client);
> > -free_tx_p1:
> > - i2c_unregister_device(ctx->i2c.tx_p1_client);
> > -free_tx_p0:
> > - i2c_unregister_device(ctx->i2c.tx_p0_client);
> > -
> > - return err;
> > -}
> > -
> > -static void anx7625_unregister_i2c_dummy_clients(struct anx7625_data *ctx)
> > -{
> > - i2c_unregister_device(ctx->i2c.tx_p0_client);
> > - i2c_unregister_device(ctx->i2c.tx_p1_client);
> > - i2c_unregister_device(ctx->i2c.tx_p2_client);
> > - i2c_unregister_device(ctx->i2c.rx_p0_client);
> > - i2c_unregister_device(ctx->i2c.rx_p1_client);
> > - i2c_unregister_device(ctx->i2c.rx_p2_client);
> > - i2c_unregister_device(ctx->i2c.tcpc_client);
> > }
> >
> > static int __maybe_unused anx7625_runtime_pm_suspend(struct device *dev)
> > @@ -2723,8 +2685,6 @@ static int anx7625_i2c_probe(struct i2c_client *client,
> > if (!platform->pdata.low_power_mode)
> > pm_runtime_put_sync_suspend(&client->dev);
> >
> > - anx7625_unregister_i2c_dummy_clients(platform);
> > -
> > free_wq:
> > if (platform->workqueue)
> > destroy_workqueue(platform->workqueue);
> > @@ -2754,8 +2714,6 @@ static int anx7625_i2c_remove(struct i2c_client *client)
> > if (!platform->pdata.low_power_mode)
> > pm_runtime_put_sync_suspend(&client->dev);
> >
> > - anx7625_unregister_i2c_dummy_clients(platform);
> > -
> > if (platform->pdata.audio_en)
> > anx7625_unregister_audio(platform);
> >
> > --
> > 2.37.0.rc0.161.g10f37bed90-goog
Can you fix the checkpatch --strict warnings and formatting issues in
this series?
next prev parent reply other threads:[~2022-07-06 12:31 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-29 16:05 [PATCH 0/4] anx7625: Cleanup, fixes, and implement wait_hpd_asserted Hsin-Yi Wang
2022-06-29 16:05 ` [PATCH 1/4] drm/bridge: anx7625: Convert to devm_i2c_new_dummy_device() Hsin-Yi Wang
2022-07-06 2:29 ` Xin Ji
2022-07-06 12:31 ` Robert Foss [this message]
2022-07-06 12:55 ` Hsin-Yi Wang
2022-06-29 16:05 ` [PATCH 2/4] drm/bridge: anx7625: Use pm_runtime_force_suspend(resume) Hsin-Yi Wang
2022-07-06 2:30 ` Xin Ji
2022-06-29 16:05 ` [PATCH 3/4] drm/bridge: anx7625: Fix NULL pointer crash when using edp-panel Hsin-Yi Wang
2022-07-06 2:31 ` Xin Ji
2022-06-29 16:05 ` [PATCH 4/4] drm/bridge: anx7625: Add wait_hpd_asserted() callback Hsin-Yi Wang
2022-07-06 2:32 ` Xin Ji
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAG3jFyu2KObuc5CiFFK=NzkE1LOTSFVoA3mNyY6r1aKs2SU3ow@mail.gmail.com' \
--to=robert.foss@linaro.org \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=airlied@linux.ie \
--cc=andrzej.hajda@intel.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=hsinyi@chromium.org \
--cc=jernej.skrabec@gmail.com \
--cc=jonas@kwiboo.se \
--cc=linux-kernel@vger.kernel.org \
--cc=maxime@cerno.tech \
--cc=narmstrong@baylibre.com \
--cc=sam@ravnborg.org \
--cc=tzimmermann@suse.de \
--cc=xji@analogixsemi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).