linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
To: Dariusz Marcinkiewicz <darekm@google.com>,
	linux-media@vger.kernel.org, hverkuil@xs4all.nl
Subject: Re: [PATCH v3 3/9] dw-hdmi-cec: use cec_notifier_cec_adap_(un)register
Date: Tue, 16 Jul 2019 10:48:01 +0200	[thread overview]
Message-ID: <7055d5ca-95cd-2cae-9d88-fff16a51285c@xs4all.nl> (raw)
In-Reply-To: <20190716075820.260202-4-darekm@google.com>

On 7/16/19 9:58 AM, Dariusz Marcinkiewicz wrote:
> Use the new cec_notifier_cec_adap_(un)register() functions to
> (un)register the notifier for the CEC adapter.
> 
> Signed-off-by: Dariusz Marcinkiewicz <darekm@google.com>
> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
> ---
>  drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c
> index 6c323510f1288..6f7ecacb7d1fb 100644
> --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c
> +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c
> @@ -281,13 +281,14 @@ static int dw_hdmi_cec_probe(struct platform_device *pdev)
>  	if (ret < 0)
>  		return ret;
>  
> -	cec->notify = cec_notifier_get(pdev->dev.parent);
> +	cec->notify = cec_notifier_cec_adap_register(pdev->dev.parent,
> +						     NULL, cec->adap);
>  	if (!cec->notify)
>  		return -ENOMEM;
>  
>  	ret = cec_register_adapter(cec->adap, pdev->dev.parent);
>  	if (ret < 0) {
> -		cec_notifier_put(cec->notify);
> +		cec_notifier_cec_adap_unregister(cec->notify);
>  		return ret;
>  	}
>  
> @@ -297,8 +298,6 @@ static int dw_hdmi_cec_probe(struct platform_device *pdev)
>  	 */
>  	devm_remove_action(&pdev->dev, dw_hdmi_cec_del, cec);

I have to say that I find this remove action very confusing since it is
not obvious that this deletes the adapter on error. I would prefer that
the action is dropped and the normal 'goto' pattern is used for error
handling. Much easier to review.

What do you think?

Regards,

	Hans

>  
> -	cec_register_cec_notifier(cec->adap, cec->notify);
> -
>  	return 0;
>  }
>  
> @@ -306,8 +305,8 @@ static int dw_hdmi_cec_remove(struct platform_device *pdev)
>  {
>  	struct dw_hdmi_cec *cec = platform_get_drvdata(pdev);
>  
> +	cec_notifier_cec_adap_unregister(cec->notify);
>  	cec_unregister_adapter(cec->adap);
> -	cec_notifier_put(cec->notify);
>  
>  	return 0;
>  }
> 


  reply	other threads:[~2019-07-16  8:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-16  7:58 [PATCH v3 0/9] drm: cec: convert DRM drivers to the new notifier API Dariusz Marcinkiewicz
2019-07-16  7:58 ` [PATCH v3 1/9] drm_dp_cec: add connector info support Dariusz Marcinkiewicz
2019-07-16  7:58 ` [PATCH v3 2/9] drm/i915/intel_hdmi: use cec_notifier_conn_(un)register Dariusz Marcinkiewicz
2019-07-16  7:58 ` [PATCH v3 3/9] dw-hdmi-cec: use cec_notifier_cec_adap_(un)register Dariusz Marcinkiewicz
2019-07-16  8:48   ` Hans Verkuil [this message]
2019-07-16 12:38     ` Dariusz Marcinkiewicz
2019-07-16  8:50   ` Hans Verkuil
2019-07-16  7:58 ` [PATCH v3 4/9] tda9950: " Dariusz Marcinkiewicz
2019-07-16  7:58 ` [PATCH v3 5/9] drm: tda998x: use cec_notifier_conn_(un)register Dariusz Marcinkiewicz
2019-07-16  7:58 ` [PATCH v3 6/9] drm: sti: " Dariusz Marcinkiewicz
2019-07-16  7:58 ` [PATCH v3 7/9] drm: tegra: " Dariusz Marcinkiewicz
2019-07-16  7:58 ` [PATCH v3 8/9] drm: dw-hdmi: " Dariusz Marcinkiewicz
2019-07-16  7:58 ` [PATCH v3 9/9] drm: exynos: exynos_hdmi: " Dariusz Marcinkiewicz

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=7055d5ca-95cd-2cae-9d88-fff16a51285c@xs4all.nl \
    --to=hverkuil-cisco@xs4all.nl \
    --cc=darekm@google.com \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    --subject='Re: [PATCH v3 3/9] dw-hdmi-cec: use cec_notifier_cec_adap_(un)register' \
    /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

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).