dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Vincent Whitchurch <vincent.whitchurch@axis.com>
To: Andrzej Hajda <a.hajda@samsung.com>
Cc: "jernej.skrabec@siol.net" <jernej.skrabec@siol.net>,
	"jonas@kwiboo.se" <jonas@kwiboo.se>,
	"narmstrong@baylibre.com" <narmstrong@baylibre.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"hverkuil@xs4all.nl" <hverkuil@xs4all.nl>,
	kernel <kernel@axis.com>,
	"Laurent.pinchart@ideasonboard.com"
	<Laurent.pinchart@ideasonboard.com>
Subject: Re: [PATCH v3] drm/bridge: adv7511: Fix cec clock EPROBE_DEFER handling
Date: Tue, 14 Jul 2020 10:24:37 +0200	[thread overview]
Message-ID: <20200714082437.fvxkruwxgthnjn55@axis.com> (raw)
In-Reply-To: <3d908cbc-f892-9c3f-06a7-93f03c7c177b@samsung.com>

On Thu, Jul 02, 2020 at 04:22:34PM +0200, Andrzej Hajda wrote:
> On 14.05.2020 13:30, Vincent Whitchurch wrote:
> > diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_cec.c b/drivers/gpu/drm/bridge/adv7511/adv7511_cec.c
> > index a20a45c0b353..ee0ed4fb67c1 100644
> > --- a/drivers/gpu/drm/bridge/adv7511/adv7511_cec.c
> > +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_cec.c
> > @@ -286,28 +286,17 @@ static const struct cec_adap_ops adv7511_cec_adap_ops = {
> >   	.adap_transmit = adv7511_cec_adap_transmit,
> >   };
> >   
> > -static int adv7511_cec_parse_dt(struct device *dev, struct adv7511 *adv7511)
> > -{
> > -	adv7511->cec_clk = devm_clk_get(dev, "cec");
> > -	if (IS_ERR(adv7511->cec_clk)) {
> > -		int ret = PTR_ERR(adv7511->cec_clk);
> > -
> > -		adv7511->cec_clk = NULL;
> > -		return ret;
> > -	}
> > -	clk_prepare_enable(adv7511->cec_clk);
> > -	adv7511->cec_clk_freq = clk_get_rate(adv7511->cec_clk);
> > -	return 0;
> > -}
> > -
> > -int adv7511_cec_init(struct device *dev, struct adv7511 *adv7511)
> > +void adv7511_cec_init(struct device *dev, struct adv7511 *adv7511)
> >   {
> >   	unsigned int offset = adv7511->type == ADV7533 ?
> >   						ADV7533_REG_CEC_OFFSET : 0;
> > -	int ret = adv7511_cec_parse_dt(dev, adv7511);
> > +	int ret;
> >   
> > -	if (ret)
> > -		goto err_cec_parse_dt;
> > +	if (!adv7511->cec_clk)
> > +		goto err_cec_no_clock;
> > +
> > +	clk_prepare_enable(adv7511->cec_clk);
> > +	adv7511->cec_clk_freq = clk_get_rate(adv7511->cec_clk);
> >   
> >   	adv7511->cec_adap = cec_allocate_adapter(&adv7511_cec_adap_ops,
> >   		adv7511, dev_name(dev), CEC_CAP_DEFAULTS, ADV7511_MAX_ADDRS);
> > @@ -334,7 +323,7 @@ int adv7511_cec_init(struct device *dev, struct adv7511 *adv7511)
> >   	ret = cec_register_adapter(adv7511->cec_adap, dev);
> >   	if (ret)
> >   		goto err_cec_register;
> > -	return 0;
> > +	return;
> >   
> >   err_cec_register:
> >   	cec_delete_adapter(adv7511->cec_adap);
> > @@ -342,8 +331,11 @@ int adv7511_cec_init(struct device *dev, struct adv7511 *adv7511)
> >   err_cec_alloc:
> >   	dev_info(dev, "Initializing CEC failed with error %d, disabling CEC\n",
> >   		 ret);
> > -err_cec_parse_dt:
> > +	clk_disable_unprepare(adv7511->cec_clk);
> > +	devm_clk_put(dev, adv7511->cec_clk);
> > +	/* Ensure that adv7511_remove() doesn't attempt to disable it again. */
> > +	adv7511->cec_clk = NULL;
> 
> Are you sure these three lines above are necessary? devm mechanism 
> should free the clock and with failed probe remove should not be called.

This driver ignores all failures in CEC registration/initialisation and
does not fail the probe for them.  I find that odd, but it seems to be
done like this on purpose (see commit 1b6fba458c0a2e8513 "drm/bridge:
adv7511/33: Fix adv7511_cec_init() failure handling") and my patch
preserves that behaviour.
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

      reply	other threads:[~2020-07-15  7:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20200515065426eucas1p259c666b8e182a12c87e4e0b575b397d0@eucas1p2.samsung.com>
2020-05-14 11:30 ` [PATCH v3] drm/bridge: adv7511: Fix cec clock EPROBE_DEFER handling Vincent Whitchurch
2020-07-02 14:22   ` Andrzej Hajda
2020-07-14  8:24     ` Vincent Whitchurch [this message]

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=20200714082437.fvxkruwxgthnjn55@axis.com \
    --to=vincent.whitchurch@axis.com \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=a.hajda@samsung.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hverkuil@xs4all.nl \
    --cc=jernej.skrabec@siol.net \
    --cc=jonas@kwiboo.se \
    --cc=kernel@axis.com \
    --cc=narmstrong@baylibre.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