Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3abf4afd authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "async: Add cmdline option to specify drivers to be async probed"

parents 8fa03aac 11f71349
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -863,6 +863,10 @@
			The filter can be disabled or changed to another
			driver later using sysfs.

	driver_async_probe=  [KNL]
			List of driver names to be probed asynchronously.
			Format: <driver_name1>,<driver_name2>...

	drm_kms_helper.edid_firmware=[<connector>:]<file>[,[<connector>:]<file>]
			Broken monitors, graphic adapters, KVMs and EDIDless
			panels may send no or incorrect EDID data sets.
+24 −0
Original line number Diff line number Diff line
@@ -56,6 +56,10 @@ static LIST_HEAD(deferred_probe_active_list);
static atomic_t deferred_trigger_count = ATOMIC_INIT(0);
static bool initcalls_done;

/* Save the async probe drivers' name from kernel cmdline */
#define ASYNC_DRV_NAMES_MAX_LEN	256
static char async_probe_drv_names[ASYNC_DRV_NAMES_MAX_LEN];

/*
 * In some cases, like suspend to RAM or hibernation, It might be reasonable
 * to prohibit probing of devices as it could be unsafe.
@@ -576,6 +580,23 @@ int driver_probe_device(struct device_driver *drv, struct device *dev)
	return ret;
}

static inline bool cmdline_requested_async_probing(const char *drv_name)
{
	return parse_option_str(async_probe_drv_names, drv_name);
}

/* The option format is "driver_async_probe=drv_name1,drv_name2,..." */
static int __init save_async_options(char *buf)
{
	if (strlen(buf) >= ASYNC_DRV_NAMES_MAX_LEN)
		printk(KERN_WARNING
			"Too long list of driver names for 'driver_async_probe'!\n");

	strlcpy(async_probe_drv_names, buf, ASYNC_DRV_NAMES_MAX_LEN);
	return 0;
}
__setup("driver_async_probe=", save_async_options);

bool driver_allows_async_probing(struct device_driver *drv)
{
	switch (drv->probe_type) {
@@ -586,6 +607,9 @@ bool driver_allows_async_probing(struct device_driver *drv)
		return false;

	default:
		if (cmdline_requested_async_probing(drv->name))
			return true;

		if (module_requested_async_probing(drv->owner))
			return true;