From: Ramalingam C <ramalingam.c@intel.com>
To: Anshuman Gupta <anshuman.gupta@intel.com>
Cc: igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t] tests/kms_content_protection: Fix uevent subtest
Date: Thu, 12 Dec 2019 16:06:08 +0530 [thread overview]
Message-ID: <20191212103608.GA10488@intel.com> (raw)
In-Reply-To: <20191211141054.21455-1-anshuman.gupta@intel.com>
On 2019-12-11 at 19:40:54 +0530, Anshuman Gupta wrote:
> uevent hdcp subtest was failing because hdcp_event()
> has been called with NULL udev_monitor, which was
> causing udev_monitor_receive_device() to return a
> NULL udev.
>
> Cc: Ramalingam C <ramalingam.c@intel.com>
> Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com>
> ---
> tests/kms_content_protection.c | 43 +++++++++++++---------------------
> 1 file changed, 16 insertions(+), 27 deletions(-)
>
> diff --git a/tests/kms_content_protection.c b/tests/kms_content_protection.c
> index e676b60b..a7dd786b 100644
> --- a/tests/kms_content_protection.c
> +++ b/tests/kms_content_protection.c
> @@ -165,10 +165,16 @@ static void hdcp_udev_fini(struct udev_monitor *uevent_monitor,
> udev_unref(udev);
> }
>
> -static int hdcp_udev_init(struct udev_monitor *uevent_monitor,
> - struct udev *udev)
As we discussed offline, we could take struct udev_monitor **, struct udev **
and int *udev_fd as parameter and fill them after successful init. Else
return the error code.
-Ram
> +#define MAX_EVENTS 10
> +static bool wait_for_hdcp_event(uint32_t conn_id, uint32_t prop_id,
> + uint32_t timeout_mSec)
> {
> - int ret = -EINVAL;
> + struct udev_monitor *uevent_monitor = NULL;
> + struct udev *udev = NULL;
> + int udev_fd, epoll_fd;
> + struct epoll_event event, events[MAX_EVENTS];
> + bool ret = false;
> + int err;
>
> udev = udev_new();
> if (!udev) {
> @@ -182,46 +188,29 @@ static int hdcp_udev_init(struct udev_monitor *uevent_monitor,
> goto out;
> }
>
> - ret = udev_monitor_filter_add_match_subsystem_devtype(uevent_monitor,
> + err = udev_monitor_filter_add_match_subsystem_devtype(uevent_monitor,
> "drm",
> "drm_minor");
> - if (ret < 0) {
> + if (err < 0) {
> igt_info("failed to filter for drm events\n");
> goto out;
> }
>
> - ret = udev_monitor_enable_receiving(uevent_monitor);
> - if (ret < 0) {
> + err = udev_monitor_enable_receiving(uevent_monitor);
> + if (err < 0) {
> igt_info("failed to enable udev event reception\n");
> goto out;
> }
>
> - return udev_monitor_get_fd(uevent_monitor);
> -
> -out:
> - hdcp_udev_fini(uevent_monitor, udev);
> - return ret;
> -}
> -
> -#define MAX_EVENTS 10
> -static bool wait_for_hdcp_event(uint32_t conn_id, uint32_t prop_id,
> - uint32_t timeout_mSec)
> -{
> + udev_fd = udev_monitor_get_fd(uevent_monitor);
>
> - struct udev_monitor *uevent_monitor = NULL;
> - struct udev *udev = NULL;
> - int udev_fd, epoll_fd;
> - struct epoll_event event, events[MAX_EVENTS];
> - bool ret = false;
> -
> - udev_fd = hdcp_udev_init(uevent_monitor, udev);
> if (udev_fd < 0)
> return false;
>
> epoll_fd = epoll_create1(0);
> if (epoll_fd == -1) {
> igt_info("Failed to create epoll fd. %d\n", epoll_fd);
> - goto out_ep_create;
> + goto out;
> }
>
> event.events = EPOLLIN | EPOLLERR;
> @@ -238,7 +227,7 @@ static bool wait_for_hdcp_event(uint32_t conn_id, uint32_t prop_id,
> out_ep_ctl:
> if (close(epoll_fd))
> igt_info("failed to close the epoll fd\n");
> -out_ep_create:
> +out:
> hdcp_udev_fini(uevent_monitor, udev);
> return ret;
> }
> --
> 2.24.0
>
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
prev parent reply other threads:[~2019-12-12 10:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-11 14:10 [igt-dev] [PATCH i-g-t] tests/kms_content_protection: Fix uevent subtest Anshuman Gupta
2019-12-11 18:02 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2019-12-12 3:46 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2019-12-12 10:36 ` Ramalingam C [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=20191212103608.GA10488@intel.com \
--to=ramalingam.c@intel.com \
--cc=anshuman.gupta@intel.com \
--cc=igt-dev@lists.freedesktop.org \
/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