From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
To: Russell King - ARM Linux admin <linux@armlinux.org.uk>,
Dariusz Marcinkiewicz <darekm@google.com>
Cc: dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org,
David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
Hans Verkuil <hverkuil@xs4all.nl>,
Kate Stewart <kstewart@linuxfoundation.org>,
Allison Randal <allison@lohutok.net>,
Thomas Gleixner <tglx@linutronix.de>,
Kees Cook <keescook@chromium.org>,
Colin Ian King <colin.king@canonical.com>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v6 3/8] tda9950: use cec_notifier_cec_adap_(un)register
Date: Tue, 13 Aug 2019 13:44:28 +0200 [thread overview]
Message-ID: <49f41f61-2094-f372-5ae8-c923e03d055f@xs4all.nl> (raw)
In-Reply-To: <20190813113209.GF13294@shell.armlinux.org.uk>
On 8/13/19 1:32 PM, Russell King - ARM Linux admin wrote:
> On Tue, Aug 13, 2019 at 01:02:35PM +0200, 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>
>> Tested-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
>> ---
>> drivers/gpu/drm/i2c/tda9950.c | 12 ++++++------
>> 1 file changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i2c/tda9950.c b/drivers/gpu/drm/i2c/tda9950.c
>> index 8039fc0d83db4..a5a75bdeb7a5f 100644
>> --- a/drivers/gpu/drm/i2c/tda9950.c
>> +++ b/drivers/gpu/drm/i2c/tda9950.c
>> @@ -420,7 +420,8 @@ static int tda9950_probe(struct i2c_client *client,
>> priv->hdmi = glue->parent;
>>
>> priv->adap = cec_allocate_adapter(&tda9950_cec_ops, priv, "tda9950",
>> - CEC_CAP_DEFAULTS,
>> + CEC_CAP_DEFAULTS |
>> + CEC_CAP_CONNECTOR_INFO,
>> CEC_MAX_LOG_ADDRS);
>> if (IS_ERR(priv->adap))
>> return PTR_ERR(priv->adap);
>> @@ -457,13 +458,14 @@ static int tda9950_probe(struct i2c_client *client,
>> if (ret < 0)
>> return ret;
>>
>> - priv->notify = cec_notifier_get(priv->hdmi);
>> + priv->notify = cec_notifier_cec_adap_register(priv->hdmi, NULL,
>> + priv->adap);
>> if (!priv->notify)
>> return -ENOMEM;
>>
>> ret = cec_register_adapter(priv->adap, priv->hdmi);
>> if (ret < 0) {
>> - cec_notifier_put(priv->notify);
>> + cec_notifier_cec_adap_unregister(priv->notify);
>> return ret;
>> }
>>
>> @@ -473,8 +475,6 @@ static int tda9950_probe(struct i2c_client *client,
>> */
>> devm_remove_action(dev, tda9950_cec_del, priv);
>>
>> - cec_register_cec_notifier(priv->adap, priv->notify);
>> -
>> return 0;
>> }
>>
>> @@ -482,8 +482,8 @@ static int tda9950_remove(struct i2c_client *client)
>> {
>> struct tda9950_priv *priv = i2c_get_clientdata(client);
>>
>> + cec_notifier_cec_adap_unregister(priv->notify);
>> cec_unregister_adapter(priv->adap);
>> - cec_notifier_put(priv->notify);
>
> It looks weird to have an unexpectedly different ordering of
> unregistration from the registration path - normally, unregistration
> is the reverse order of initialisation.
>
> In the initialisation path, it seems that we register the notifier
> and _then_ the adapter. Here, we unregister the notifier and then
> the adapter rather than what would normally be expected. Why is
> this? I suspect there will be drivers created that do this the
> "normal" way round, so if this is a requirement, it needs to be made
> plainly obvious.
It's not a requirement, it just feels better to do it in this order
since cec_unregister_adapter will in general also delete the adapter
(unless an application keeps the cec device open).
So the order is actually: allocate_adapter, then register notifier
and: unregister notifier, then unregister (and typically delete) adapter
Regards,
Hans
>
>>
>> return 0;
>> }
>> --
>> 2.23.0.rc1.153.gdeed80330f-goog
>>
>>
>
next prev parent reply other threads:[~2019-08-13 11:44 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-13 11:02 [PATCH v6 0/8] drm: cec: convert DRM drivers to the new notifier API Dariusz Marcinkiewicz
2019-08-13 11:02 ` [PATCH v6 1/8] drm/i915/intel_hdmi: use cec_notifier_conn_(un)register Dariusz Marcinkiewicz
2019-08-13 11:02 ` [PATCH v6 2/8] dw-hdmi-cec: use cec_notifier_cec_adap_(un)register Dariusz Marcinkiewicz
2019-08-13 11:02 ` [PATCH v6 3/8] tda9950: " Dariusz Marcinkiewicz
2019-08-13 11:32 ` Russell King - ARM Linux admin
2019-08-13 11:44 ` Hans Verkuil [this message]
2019-08-13 11:02 ` [PATCH v6 4/8] drm: tda998x: use cec_notifier_conn_(un)register Dariusz Marcinkiewicz
2019-08-13 11:20 ` Russell King - ARM Linux admin
2019-08-14 10:52 ` Dariusz Marcinkiewicz
2019-08-13 11:02 ` [PATCH v6 5/8] drm: sti: " Dariusz Marcinkiewicz
2019-08-13 11:02 ` [PATCH v6 6/8] drm: tegra: " Dariusz Marcinkiewicz
2019-08-13 11:02 ` [PATCH v6 7/8] drm: dw-hdmi: " Dariusz Marcinkiewicz
2019-08-13 11:37 ` Hans Verkuil
2019-08-14 10:49 ` Dariusz Marcinkiewicz
2019-08-13 11:02 ` [PATCH v6 8/8] 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=49f41f61-2094-f372-5ae8-c923e03d055f@xs4all.nl \
--to=hverkuil-cisco@xs4all.nl \
--cc=airlied@linux.ie \
--cc=allison@lohutok.net \
--cc=colin.king@canonical.com \
--cc=daniel@ffwll.ch \
--cc=darekm@google.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=hverkuil@xs4all.nl \
--cc=keescook@chromium.org \
--cc=kstewart@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=tglx@linutronix.de \
/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).