Commit af1ef32b authored by Ankit Nautiyal's avatar Ankit Nautiyal Committed by Ramalingam C

lib: Use generic names for APIs that handle uevents

The functions for handling uevents are named with "_hotplug" as suffix
such as igt_watch_hotplug(). Earlier hotplug was the only uevent that
was requested to be detected, but in fact, these APIs are generic and
can be used for detecting other uevents too.

Currently we have tests like kms_lease, kms_content_protection using
the uevent handling infrastructure for detecting uevents other than
hotplug.

This patch renames the functions and replace the "_hotplug" suffix
with "_uevents".

v2: Rebase
v3: Added changes in lib igt_chamelium.c, that was missed earlier.
Signed-off-by: Ankit Nautiyal's avatarAnkit Nautiyal <ankit.k.nautiyal@intel.com>
Suggested-by: Ramalingam C's avatarRamalingam C <ramalingam.c@intel.com>
Suggested-by: Arkadiusz Hiler's avatarHiler, Arkadiusz <arkadiusz.hiler@intel.com>
Reviewed-by: Ramalingam C's avatarRamalingam C <ramalingam.c@intel.com>
Acked-by: Arkadiusz Hiler's avatarArkadiusz Hiler <arkadiusz.hiler@intel.com>
parent 66e2683a
Pipeline #167861 passed with stages
in 11 minutes and 38 seconds
......@@ -330,7 +330,7 @@ static xmlrpc_value *__chamelium_rpc_va(struct chamelium *chamelium,
if (fsm_port) {
monitor_args.chamelium = chamelium;
monitor_args.port = fsm_port;
monitor_args.mon = igt_watch_hotplug();
monitor_args.mon = igt_watch_uevents();
pthread_create(&fsm_thread_id, NULL, chamelium_fsm_mon,
&monitor_args);
}
......@@ -358,7 +358,7 @@ static xmlrpc_value *__chamelium_rpc_va(struct chamelium *chamelium,
if (fsm_port) {
pthread_cancel(fsm_thread_id);
pthread_join(fsm_thread_id, NULL);
igt_cleanup_hotplug(monitor_args.mon);
igt_cleanup_uevents(monitor_args.mon);
}
return res;
......
......@@ -4156,13 +4156,13 @@ void igt_reset_connectors(void)
}
/**
* igt_watch_hotplug:
* igt_watch_uevents:
*
* Begin monitoring udev for sysfs hotplug events.
* Begin monitoring udev for sysfs uevents.
*
* Returns: a udev monitor for detecting hotplugs on
* Returns: a udev monitor for detecting uevents on
*/
struct udev_monitor *igt_watch_hotplug(void)
struct udev_monitor *igt_watch_uevents(void)
{
struct udev *udev;
struct udev_monitor *mon;
......@@ -4230,7 +4230,7 @@ bool event_detected(struct udev_monitor *mon, int timeout_secs,
/**
* igt_connector_event_detected:
* @mon: A udev monitor initialized with #igt_watch_hotplug
* @mon: A udev monitor initialized with #igt_watch_uevents
* @conn_id: Connector id of the Connector for which the property change is
* expected.
* @prop_id: Property id for which the change is expected.
......@@ -4252,7 +4252,7 @@ bool igt_connector_event_detected(struct udev_monitor *mon, uint32_t conn_id,
/**
* igt_hotplug_detected:
* @mon: A udev monitor initialized with #igt_watch_hotplug
* @mon: A udev monitor initialized with #igt_watch_uevents
* @timeout_secs: How long to wait for a hotplug event to occur.
*
* Detect if a hotplug event was received since we last checked the monitor.
......@@ -4270,7 +4270,7 @@ bool igt_hotplug_detected(struct udev_monitor *mon, int timeout_secs)
/**
* igt_lease_change_detected:
* @mon: A udev monitor initialized with #igt_watch_hotplug
* @mon: A udev monitor initialized with #igt_watch_uevents
* @timeout_secs: How long to wait for a lease change event to occur.
*
* Detect if a lease change event was received since we last checked the monitor.
......@@ -4287,12 +4287,12 @@ bool igt_lease_change_detected(struct udev_monitor *mon, int timeout_secs)
}
/**
* igt_flush_hotplugs:
* @mon: A udev monitor initialized with #igt_watch_hotplug
* igt_flush_uevents:
* @mon: A udev monitor initialized with #igt_watch_uevents
*
* Get rid of any pending hotplug events
* Get rid of any pending uevents
*/
void igt_flush_hotplugs(struct udev_monitor *mon)
void igt_flush_uevents(struct udev_monitor *mon)
{
struct udev_device *dev;
......@@ -4301,12 +4301,12 @@ void igt_flush_hotplugs(struct udev_monitor *mon)
}
/**
* igt_cleanup_hotplug:
* @mon: A udev monitor initialized with #igt_watch_hotplug
* igt_cleanup_uevents:
* @mon: A udev monitor initialized with #igt_watch_uevents
*
* Cleanup the resources allocated by #igt_watch_hotplug
* Cleanup the resources allocated by #igt_watch_uevents
*/
void igt_cleanup_hotplug(struct udev_monitor *mon)
void igt_cleanup_uevents(struct udev_monitor *mon)
{
struct udev *udev = udev_monitor_get_udev(mon);
......
......@@ -774,15 +774,15 @@ const struct edid *igt_kms_get_dp_audio_edid(void);
const struct edid *igt_kms_get_4k_edid(void);
const struct edid *igt_kms_get_3d_edid(void);
struct udev_monitor *igt_watch_hotplug(void);
struct udev_monitor *igt_watch_uevents(void);
bool igt_hotplug_detected(struct udev_monitor *mon,
int timeout_secs);
bool igt_lease_change_detected(struct udev_monitor *mon,
int timeout_secs);
bool igt_connector_event_detected(struct udev_monitor *mon, uint32_t conn_id,
uint32_t prop_id, int timeout_msecs);
void igt_flush_hotplugs(struct udev_monitor *mon);
void igt_cleanup_hotplug(struct udev_monitor *mon);
void igt_flush_uevents(struct udev_monitor *mon);
void igt_cleanup_uevents(struct udev_monitor *mon);
bool igt_display_has_format_mod(igt_display_t *display, uint32_t format, uint64_t modifier);
bool igt_plane_has_format_mod(igt_plane_t *plane, uint32_t format, uint64_t modifier);
......
......@@ -438,21 +438,21 @@ test_hotplug(data_t *data, struct chamelium_port *port, int toggle_count,
enum pipe pipe;
struct igt_fb fb = {0};
drmModeModeInfo mode;
struct udev_monitor *mon = igt_watch_hotplug();
struct udev_monitor *mon = igt_watch_uevents();
igt_output_t *output = get_output_for_port(data, port);
reset_state(data, NULL);
igt_hpd_storm_set_threshold(data->drm_fd, 0);
for (i = 0; i < toggle_count; i++) {
igt_flush_hotplugs(mon);
igt_flush_uevents(mon);
/* Check if we get a sysfs hotplug event */
chamelium_plug(data->chamelium, port);
wait_for_connector_after_hotplug(data, mon, port,
DRM_MODE_CONNECTED);
igt_flush_hotplugs(mon);
igt_flush_uevents(mon);
if (modeset_mode == TEST_MODESET_ON_OFF ||
(modeset_mode == TEST_MODESET_ON && i == 0 )) {
......@@ -473,7 +473,7 @@ test_hotplug(data_t *data, struct chamelium_port *port, int toggle_count,
wait_for_connector_after_hotplug(data, mon, port,
DRM_MODE_DISCONNECTED);
igt_flush_hotplugs(mon);
igt_flush_uevents(mon);
if (modeset_mode == TEST_MODESET_ON_OFF) {
igt_output_set_pipe(output, PIPE_NONE);
......@@ -481,7 +481,7 @@ test_hotplug(data_t *data, struct chamelium_port *port, int toggle_count,
}
}
igt_cleanup_hotplug(mon);
igt_cleanup_uevents(mon);
igt_hpd_storm_reset(data->drm_fd);
igt_remove_fb(data->drm_fd, &fb);
}
......@@ -540,7 +540,7 @@ try_suspend_resume_hpd(data_t *data, struct chamelium_port *port,
int delay;
int p;
igt_flush_hotplugs(mon);
igt_flush_uevents(mon);
delay = igt_get_autoresume_delay(state) * 1000 / 2;
......@@ -596,7 +596,7 @@ test_suspend_resume_hpd(data_t *data, struct chamelium_port *port,
enum igt_suspend_state state,
enum igt_suspend_test test)
{
struct udev_monitor *mon = igt_watch_hotplug();
struct udev_monitor *mon = igt_watch_uevents();
reset_state(data, port);
......@@ -606,7 +606,7 @@ test_suspend_resume_hpd(data_t *data, struct chamelium_port *port,
/* Now make sure we notice disconnected connectors after resuming */
try_suspend_resume_hpd(data, port, state, test, mon, true);
igt_cleanup_hotplug(mon);
igt_cleanup_uevents(mon);
}
static const char test_suspend_resume_hpd_common_desc[] =
......@@ -616,7 +616,7 @@ static void
test_suspend_resume_hpd_common(data_t *data, enum igt_suspend_state state,
enum igt_suspend_test test)
{
struct udev_monitor *mon = igt_watch_hotplug();
struct udev_monitor *mon = igt_watch_uevents();
struct chamelium_port *port;
int p;
......@@ -633,7 +633,7 @@ test_suspend_resume_hpd_common(data_t *data, enum igt_suspend_state state,
/* Now make sure we notice disconnected connectors after resuming */
try_suspend_resume_hpd(data, NULL, state, test, mon, true);
igt_cleanup_hotplug(mon);
igt_cleanup_uevents(mon);
}
static const char test_suspend_resume_edid_change_desc[] =
......@@ -647,7 +647,7 @@ test_suspend_resume_edid_change(data_t *data, struct chamelium_port *port,
enum test_edid edid,
enum test_edid alt_edid)
{
struct udev_monitor *mon = igt_watch_hotplug();
struct udev_monitor *mon = igt_watch_uevents();
bool link_status_failed[2][data->port_count];
int p;
......@@ -655,7 +655,7 @@ test_suspend_resume_edid_change(data_t *data, struct chamelium_port *port,
/* Catch the event and flush all remaining ones. */
igt_assert(igt_hotplug_detected(mon, HOTPLUG_TIMEOUT));
igt_flush_hotplugs(mon);
igt_flush_uevents(mon);
/* First plug in the port */
set_edid(data, port, edid);
......@@ -672,7 +672,7 @@ test_suspend_resume_edid_change(data_t *data, struct chamelium_port *port,
get_connectors_link_status_failed(data, link_status_failed[0]);
igt_flush_hotplugs(mon);
igt_flush_uevents(mon);
igt_system_suspend_autoresume(state, test);
igt_assert(igt_hotplug_detected(mon, HOTPLUG_TIMEOUT));
......@@ -2533,10 +2533,10 @@ static const char test_hpd_without_ddc_desc[] =
static void
test_hpd_without_ddc(data_t *data, struct chamelium_port *port)
{
struct udev_monitor *mon = igt_watch_hotplug();
struct udev_monitor *mon = igt_watch_uevents();
reset_state(data, port);
igt_flush_hotplugs(mon);
igt_flush_uevents(mon);
/* Disable the DDC on the connector and make sure we still get a
* hotplug
......@@ -2547,7 +2547,7 @@ test_hpd_without_ddc(data_t *data, struct chamelium_port *port)
igt_assert(igt_hotplug_detected(mon, HOTPLUG_TIMEOUT));
igt_assert_eq(reprobe_connector(data, port), DRM_MODE_CONNECTED);
igt_cleanup_hotplug(mon);
igt_cleanup_uevents(mon);
}
static const char test_hpd_storm_detect_desc[] =
......@@ -2567,7 +2567,7 @@ test_hpd_storm_detect(data_t *data, struct chamelium_port *port, int width)
chamelium_fire_hpd_pulses(data->chamelium, port, width, 10);
igt_assert(igt_hpd_storm_detected(data->drm_fd));
mon = igt_watch_hotplug();
mon = igt_watch_uevents();
chamelium_fire_hpd_pulses(data->chamelium, port, width, 10);
/*
......@@ -2578,7 +2578,7 @@ test_hpd_storm_detect(data_t *data, struct chamelium_port *port, int width)
count += igt_hotplug_detected(mon, 1);
igt_assert_lt(count, 2);
igt_cleanup_hotplug(mon);
igt_cleanup_uevents(mon);
igt_hpd_storm_reset(data->drm_fd);
}
......
......@@ -567,10 +567,10 @@ igt_main
igt_subtest("uevent") {
igt_require(data.display.is_atomic);
data.cp_tests = CP_UEVENT;
data.uevent_monitor = igt_watch_hotplug();
igt_flush_hotplugs(data.uevent_monitor);
data.uevent_monitor = igt_watch_uevents();
igt_flush_uevents(data.uevent_monitor);
test_content_protection(COMMIT_ATOMIC, HDCP_CONTENT_TYPE_0);
igt_cleanup_hotplug(data.uevent_monitor);
igt_cleanup_uevents(data.uevent_monitor);
}
/*
......
......@@ -1212,7 +1212,7 @@ static void calibrate_ts(struct test_output *o, int crtc_idx)
static void __run_test_on_crtc_set(struct test_output *o, int *crtc_idxs,
int crtc_count, int duration_ms)
{
struct udev_monitor *mon = igt_watch_hotplug();
struct udev_monitor *mon = igt_watch_uevents();
unsigned bo_size = 0;
bool vblank = true;
bool retried = false;
......@@ -1261,7 +1261,7 @@ static void __run_test_on_crtc_set(struct test_output *o, int *crtc_idxs,
retry:
kmstest_unset_all_crtcs(drm_fd, resources);
igt_flush_hotplugs(mon);
igt_flush_uevents(mon);
if (set_mode(o, o->fb_ids[0], 0, 0)) {
/* We may fail to apply the mode if there are hidden
......@@ -1351,7 +1351,7 @@ out:
free_test_output(o);
igt_cleanup_hotplug(mon);
igt_cleanup_uevents(mon);
}
static void run_test_on_crtc_set(struct test_output *o, int *crtc_idxs,
......
......@@ -1238,9 +1238,9 @@ static void lease_uevent(data_t *data)
struct local_drm_mode_list_lessees mll;
struct udev_monitor *uevent_monitor;
uevent_monitor = igt_watch_hotplug();
uevent_monitor = igt_watch_uevents();
igt_flush_hotplugs(uevent_monitor);
igt_flush_uevents(uevent_monitor);
lease_fd = create_simple_lease(data->master.fd, data);
......@@ -1260,7 +1260,7 @@ static void lease_uevent(data_t *data)
igt_assert_eq(list_lessees(data->master.fd, &mll), 0);
igt_assert_eq(mll.count_lessees, 0);
igt_cleanup_hotplug(uevent_monitor);
igt_cleanup_uevents(uevent_monitor);
}
igt_main
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment