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

Commit 0d24bce1 authored by Lincoln Tran's avatar Lincoln Tran Committed by snandini
Browse files

qcacld-3.0: Move regulatory event initializtion

Currently, the regulatory update event is created in
hdd_regulatory_init. In some cases, the country can be set before this
function, causing a crash. Move the event creation to before the country
setting logic.

Change-Id: I344d0de71f1983b3da7b47b816d6bbb0e402cbe8
CRs-fixed: 2891434
parent 90307097
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -41,6 +41,22 @@ struct hdd_context;
 */
int hdd_update_regulatory_config(struct hdd_context *hdd_ctx);

/**
 * hdd_init_regulatory_update_event() - Initialize the regulatory update event
 * @hdd_ctx: HDD context
 *
 * Return: 0 on success, err on failure
 */
int hdd_init_regulatory_update_event(struct hdd_context *hdd_ctx);

/**
 * hdd_deinit_regulatory_update_event() - Cleanup the regulatory update event
 * @hdd_ctx: HDD context
 *
 * Return: none
 */
void hdd_deinit_regulatory_update_event(struct hdd_context *hdd_ctx);

int hdd_regulatory_init(struct hdd_context *hdd_ctx, struct wiphy *wiphy);

/**
+9 −0
Original line number Diff line number Diff line
@@ -9371,6 +9371,8 @@ void hdd_wlan_exit(struct hdd_context *hdd_ctx)

	hdd_wlan_stop_modules(hdd_ctx, false);

	hdd_deinit_regulatory_update_event(hdd_ctx);

	hdd_driver_memdump_deinit();

	qdf_nbuf_deinit_replenish_timer();
@@ -15051,6 +15053,13 @@ int hdd_wlan_startup(struct hdd_context *hdd_ctx)

	hdd_dp_trace_init(hdd_ctx->config);

	errno = hdd_init_regulatory_update_event(hdd_ctx);
	if (errno) {
		hdd_err("Failed to initialize regulatory update event; errno:%d",
			errno);
		goto memdump_deinit;
	}

	errno = hdd_wlan_start_modules(hdd_ctx, false);
	if (errno) {
		hdd_err("Failed to start modules; errno:%d", errno);
+32 −6
Original line number Diff line number Diff line
@@ -1678,6 +1678,26 @@ int hdd_update_regulatory_config(struct hdd_context *hdd_ctx)
	return 0;
}

int hdd_init_regulatory_update_event(struct hdd_context *hdd_ctx)
{
	QDF_STATUS status;

	status = qdf_event_create(&hdd_ctx->regulatory_update_event);
	if (QDF_IS_STATUS_ERROR(status)) {
		hdd_err("Failed to create regulatory update event");
		goto failure;
	}
	status = qdf_mutex_create(&hdd_ctx->regulatory_status_lock);
	if (QDF_IS_STATUS_ERROR(status)) {
		hdd_err("Failed to create regulatory status mutex");
		goto failure;
	}
	hdd_ctx->is_regulatory_update_in_progress = false;

failure:
	return qdf_status_to_os_return(status);
}

int hdd_regulatory_init(struct hdd_context *hdd_ctx, struct wiphy *wiphy)
{
	bool offload_enabled;
@@ -1696,10 +1716,6 @@ int hdd_regulatory_init(struct hdd_context *hdd_ctx, struct wiphy *wiphy)
					       hdd_regulatory_dyn_cbk,
					       NULL);

	qdf_event_create(&hdd_ctx->regulatory_update_event);
	qdf_mutex_create(&hdd_ctx->regulatory_status_lock);
	hdd_ctx->is_regulatory_update_in_progress = false;

	wiphy->regulatory_flags |= REGULATORY_WIPHY_SELF_MANAGED;
	/* Check the kernel version for upstream commit aced43ce780dc5 that
	 * has support for processing user cell_base hints when wiphy is
@@ -1758,12 +1774,22 @@ int hdd_regulatory_init(struct hdd_context *hdd_ctx, struct wiphy *wiphy)
}
#endif

void hdd_deinit_regulatory_update_event(struct hdd_context *hdd_ctx)
{
	QDF_STATUS status;

	status = qdf_event_destroy(&hdd_ctx->regulatory_update_event);
	if (QDF_IS_STATUS_ERROR(status))
		hdd_err("Failed to destroy regulatory update event");
	status = qdf_mutex_destroy(&hdd_ctx->regulatory_status_lock);
	if (QDF_IS_STATUS_ERROR(status))
		hdd_err("Failed to destroy regulatory status mutex");
}

void hdd_regulatory_deinit(struct hdd_context *hdd_ctx)
{
	qdf_flush_work(&hdd_ctx->country_change_work);
	qdf_destroy_work(0, &hdd_ctx->country_change_work);
	qdf_event_destroy(&hdd_ctx->regulatory_update_event);
	qdf_mutex_destroy(&hdd_ctx->regulatory_status_lock);
}

void hdd_update_regdb_offload_config(struct hdd_context *hdd_ctx)