mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-24 21:54:34 -04:00
qcacld-3.0: Migrate driver transitions to osif_driver_sync
With the recent addition of osif_driver_sync APIs, DSC use is abstracted behind a common interface. Migrate HDD to the new interface by updating driver transitions to use the new APIs. Change-Id: I394f007dd5485cd8d22aee84af74f8854ed54bb6 CRs-Fixed: 2408211
This commit is contained in:
parent
60c206456f
commit
c1d81af5c6
5 changed files with 40 additions and 110 deletions
|
|
@ -1549,24 +1549,6 @@ struct hdd_cache_channels {
|
|||
};
|
||||
#endif
|
||||
|
||||
enum hdd_driver_state {
|
||||
driver_state_uninit,
|
||||
driver_state_deinit,
|
||||
driver_state_loaded,
|
||||
};
|
||||
|
||||
/**
|
||||
* struct hdd_driver - HDD driver-level context information
|
||||
* @dsc_driver: driver synchronization driver context handle
|
||||
* @state: the current stable state of the driver
|
||||
*/
|
||||
struct hdd_driver {
|
||||
struct dsc_driver *dsc_driver;
|
||||
enum hdd_driver_state state;
|
||||
};
|
||||
|
||||
struct hdd_driver *hdd_driver_get(void);
|
||||
|
||||
/**
|
||||
* struct hdd_dynamic_mac - hdd structure to handle dynamic mac address changes
|
||||
* @dynamic_mac: Dynamicaly configured mac, this contains the mac on which
|
||||
|
|
|
|||
|
|
@ -453,13 +453,12 @@ static int hdd_soc_probe(struct device *dev,
|
|||
const struct hif_bus_id *bid,
|
||||
enum qdf_bus_type bus_type)
|
||||
{
|
||||
struct dsc_driver *dsc_driver = hdd_driver_get()->dsc_driver;
|
||||
struct osif_psoc_sync *psoc_sync;
|
||||
int errno;
|
||||
|
||||
hdd_info("probing driver");
|
||||
|
||||
errno = osif_psoc_sync_create_and_trans(dsc_driver, &psoc_sync);
|
||||
errno = osif_psoc_sync_create_and_trans(&psoc_sync);
|
||||
if (errno)
|
||||
return errno;
|
||||
|
||||
|
|
|
|||
|
|
@ -12951,16 +12951,13 @@ static inline int hdd_state_query_cb(void)
|
|||
int hdd_init(void)
|
||||
{
|
||||
QDF_STATUS status;
|
||||
int ret;
|
||||
|
||||
osif_sync_init();
|
||||
|
||||
status = cds_init();
|
||||
if (QDF_IS_STATUS_ERROR(status)) {
|
||||
hdd_err("Failed to allocate CDS context");
|
||||
ret = -ENOMEM;
|
||||
goto deinit_dsc;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
qdf_register_module_state_query_callback(hdd_state_query_cb);
|
||||
|
||||
wlan_init_bug_report_lock();
|
||||
|
|
@ -12978,11 +12975,6 @@ int hdd_init(void)
|
|||
wlan_roam_debug_init();
|
||||
|
||||
return 0;
|
||||
|
||||
deinit_dsc:
|
||||
osif_sync_deinit();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -13003,8 +12995,6 @@ void hdd_deinit(void)
|
|||
|
||||
wlan_destroy_bug_report_lock();
|
||||
cds_deinit();
|
||||
|
||||
osif_sync_deinit();
|
||||
}
|
||||
|
||||
#ifdef QCA_WIFI_NAPIER_EMULATION
|
||||
|
|
@ -13340,34 +13330,6 @@ void hdd_component_pdev_close(struct wlan_objmgr_pdev *pdev)
|
|||
ucfg_mlme_pdev_close(pdev);
|
||||
}
|
||||
|
||||
static struct hdd_driver __hdd_driver;
|
||||
|
||||
static QDF_STATUS hdd_driver_ctx_init(struct hdd_driver *hdd_driver)
|
||||
{
|
||||
QDF_BUG(hdd_driver);
|
||||
if (!hdd_driver)
|
||||
return QDF_STATUS_E_INVAL;
|
||||
|
||||
hdd_driver->state = driver_state_uninit;
|
||||
|
||||
return dsc_driver_create(&hdd_driver->dsc_driver);
|
||||
}
|
||||
|
||||
static void hdd_driver_ctx_deinit(struct hdd_driver *hdd_driver)
|
||||
{
|
||||
QDF_BUG(hdd_driver);
|
||||
if (!hdd_driver)
|
||||
return;
|
||||
|
||||
dsc_driver_destroy(&hdd_driver->dsc_driver);
|
||||
qdf_mem_zero(hdd_driver, sizeof(*hdd_driver));
|
||||
}
|
||||
|
||||
struct hdd_driver *hdd_driver_get(void)
|
||||
{
|
||||
return &__hdd_driver;
|
||||
}
|
||||
|
||||
static QDF_STATUS hdd_qdf_print_init(void)
|
||||
{
|
||||
QDF_STATUS status;
|
||||
|
|
@ -13704,22 +13666,21 @@ unlock:
|
|||
|
||||
static int hdd_driver_mode_change(enum QDF_GLOBAL_MODE mode)
|
||||
{
|
||||
struct hdd_driver *hdd_driver = hdd_driver_get();
|
||||
struct osif_driver_sync *driver_sync;
|
||||
struct hdd_context *hdd_ctx;
|
||||
QDF_STATUS status;
|
||||
int errno;
|
||||
|
||||
hdd_enter();
|
||||
|
||||
status = dsc_driver_trans_start_wait(hdd_driver->dsc_driver,
|
||||
"mode change");
|
||||
status = osif_driver_sync_trans_start_wait(&driver_sync);
|
||||
if (QDF_IS_STATUS_ERROR(status)) {
|
||||
hdd_err("Failed to start 'mode change'; status:%u", status);
|
||||
errno = qdf_status_to_os_return(status);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
dsc_driver_wait_for_ops(hdd_driver->dsc_driver);
|
||||
osif_driver_sync_wait_for_ops(driver_sync);
|
||||
|
||||
hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
|
||||
errno = wlan_hdd_validate_context(hdd_ctx);
|
||||
|
|
@ -13737,7 +13698,7 @@ static int hdd_driver_mode_change(enum QDF_GLOBAL_MODE mode)
|
|||
cds_ssr_unprotect(__func__);
|
||||
|
||||
trans_stop:
|
||||
dsc_driver_trans_stop(hdd_driver->dsc_driver);
|
||||
osif_driver_sync_trans_stop(driver_sync);
|
||||
|
||||
exit:
|
||||
hdd_exit();
|
||||
|
|
@ -13787,12 +13748,11 @@ static int con_mode_handler(const char *kmessage, const struct kernel_param *kp)
|
|||
*/
|
||||
static int hdd_driver_load(void)
|
||||
{
|
||||
struct hdd_driver *hdd_driver = hdd_driver_get();
|
||||
struct osif_driver_sync *driver_sync;
|
||||
QDF_STATUS status;
|
||||
int errno;
|
||||
|
||||
pr_err("%s: Loading driver v%s\n",
|
||||
WLAN_MODULE_NAME,
|
||||
pr_err("%s: Loading driver v%s\n", WLAN_MODULE_NAME,
|
||||
g_wlan_driver_version);
|
||||
|
||||
status = hdd_qdf_init();
|
||||
|
|
@ -13801,18 +13761,13 @@ static int hdd_driver_load(void)
|
|||
goto exit;
|
||||
}
|
||||
|
||||
status = hdd_driver_ctx_init(hdd_driver);
|
||||
if (QDF_IS_STATUS_ERROR(status)) {
|
||||
hdd_err("Failed to init driver context; status:%u", status);
|
||||
errno = qdf_status_to_os_return(status);
|
||||
goto qdf_deinit;
|
||||
}
|
||||
osif_sync_init();
|
||||
|
||||
status = dsc_driver_trans_start(hdd_driver->dsc_driver, "load");
|
||||
QDF_BUG(QDF_IS_STATUS_SUCCESS(status));
|
||||
status = osif_driver_sync_create_and_trans(&driver_sync);
|
||||
if (QDF_IS_STATUS_ERROR(status)) {
|
||||
hdd_err("Failed to init driver sync; status:%u", status);
|
||||
errno = qdf_status_to_os_return(status);
|
||||
goto hdd_driver_deinit;
|
||||
goto sync_deinit;
|
||||
}
|
||||
|
||||
errno = hdd_init();
|
||||
|
|
@ -13849,9 +13804,10 @@ static int hdd_driver_load(void)
|
|||
goto param_destroy;
|
||||
}
|
||||
|
||||
hdd_driver->state = driver_state_loaded;
|
||||
hdd_driver_mode_change_register();
|
||||
dsc_driver_trans_stop(hdd_driver->dsc_driver);
|
||||
|
||||
osif_driver_sync_register(driver_sync);
|
||||
osif_driver_sync_trans_stop(driver_sync);
|
||||
|
||||
/* psoc probe can happen in registration; do after 'load' transition */
|
||||
errno = wlan_hdd_register_driver();
|
||||
|
|
@ -13865,9 +13821,12 @@ static int hdd_driver_load(void)
|
|||
return 0;
|
||||
|
||||
pld_deinit:
|
||||
status = dsc_driver_trans_start(hdd_driver->dsc_driver, "unload");
|
||||
status = osif_driver_sync_trans_start(&driver_sync);
|
||||
QDF_BUG(QDF_IS_STATUS_SUCCESS(status));
|
||||
|
||||
osif_driver_sync_unregister();
|
||||
osif_driver_sync_wait_for_ops(driver_sync);
|
||||
|
||||
hdd_driver_mode_change_unregister();
|
||||
pld_deinit();
|
||||
|
||||
|
|
@ -13880,11 +13839,10 @@ comp_deinit:
|
|||
hdd_deinit:
|
||||
hdd_deinit();
|
||||
trans_stop:
|
||||
hdd_driver->state = driver_state_deinit;
|
||||
dsc_driver_trans_stop(hdd_driver->dsc_driver);
|
||||
hdd_driver_deinit:
|
||||
hdd_driver_ctx_deinit(hdd_driver);
|
||||
qdf_deinit:
|
||||
osif_driver_sync_trans_stop(driver_sync);
|
||||
osif_driver_sync_destroy(driver_sync);
|
||||
sync_deinit:
|
||||
osif_sync_deinit();
|
||||
hdd_qdf_deinit();
|
||||
|
||||
exit:
|
||||
|
|
@ -13900,7 +13858,7 @@ exit:
|
|||
*/
|
||||
static void hdd_driver_unload(void)
|
||||
{
|
||||
struct hdd_driver *hdd_driver = hdd_driver_get();
|
||||
struct osif_driver_sync *driver_sync;
|
||||
struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
|
||||
QDF_STATUS status;
|
||||
|
||||
|
|
@ -13918,14 +13876,15 @@ static void hdd_driver_unload(void)
|
|||
/* trigger SoC remove */
|
||||
wlan_hdd_unregister_driver();
|
||||
|
||||
status = dsc_driver_trans_start_wait(hdd_driver->dsc_driver, "unload");
|
||||
status = osif_driver_sync_trans_start_wait(&driver_sync);
|
||||
QDF_BUG(QDF_IS_STATUS_SUCCESS(status));
|
||||
if (QDF_IS_STATUS_ERROR(status)) {
|
||||
hdd_err("Unable to unload wlan; status:%u", status);
|
||||
return;
|
||||
}
|
||||
|
||||
dsc_driver_wait_for_ops(hdd_driver->dsc_driver);
|
||||
osif_driver_sync_unregister();
|
||||
osif_driver_sync_wait_for_ops(driver_sync);
|
||||
|
||||
cds_set_driver_loaded(false);
|
||||
cds_set_unload_in_progress(true);
|
||||
|
|
@ -13942,10 +13901,10 @@ static void hdd_driver_unload(void)
|
|||
hdd_component_deinit();
|
||||
hdd_deinit();
|
||||
|
||||
hdd_driver->state = driver_state_deinit;
|
||||
dsc_driver_trans_stop(hdd_driver->dsc_driver);
|
||||
osif_driver_sync_trans_stop(driver_sync);
|
||||
osif_driver_sync_destroy(driver_sync);
|
||||
|
||||
hdd_driver_ctx_deinit(hdd_driver);
|
||||
osif_sync_deinit();
|
||||
|
||||
hdd_qdf_deinit();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,30 +30,26 @@ struct osif_psoc_sync;
|
|||
|
||||
/**
|
||||
* osif_psoc_sync_create() - create a psoc synchronization context
|
||||
* @dsc_driver: parent dsc_driver to the psoc
|
||||
* @out_psoc_sync: out parameter for the new synchronization context
|
||||
*
|
||||
* Return: Errno
|
||||
*/
|
||||
qdf_must_check int
|
||||
osif_psoc_sync_create(struct dsc_driver *dsc_driver,
|
||||
struct osif_psoc_sync **out_psoc_sync);
|
||||
osif_psoc_sync_create(struct osif_psoc_sync **out_psoc_sync);
|
||||
|
||||
/**
|
||||
* osif_psoc_sync_create_and_trans() - create a psoc synchronization context
|
||||
* @dsc_driver: parent dsc_driver to the psoc
|
||||
* @out_psoc_sync: out parameter for the new synchronization context
|
||||
*
|
||||
* For protecting the device creation process.
|
||||
*
|
||||
* Return: Errno
|
||||
*/
|
||||
#define osif_psoc_sync_create_and_trans(dsc_driver, out_psoc_sync) \
|
||||
__osif_psoc_sync_create_and_trans(dsc_driver, out_psoc_sync, __func__)
|
||||
#define osif_psoc_sync_create_and_trans(out_psoc_sync) \
|
||||
__osif_psoc_sync_create_and_trans(out_psoc_sync, __func__)
|
||||
|
||||
qdf_must_check int
|
||||
__osif_psoc_sync_create_and_trans(struct dsc_driver *dsc_driver,
|
||||
struct osif_psoc_sync **out_psoc_sync,
|
||||
__osif_psoc_sync_create_and_trans(struct osif_psoc_sync **out_psoc_sync,
|
||||
const char *desc);
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -17,12 +17,12 @@
|
|||
*/
|
||||
|
||||
#include "linux/device.h"
|
||||
#include "__osif_driver_sync.h"
|
||||
#include "__osif_psoc_sync.h"
|
||||
#include "osif_psoc_sync.h"
|
||||
#include "qdf_lock.h"
|
||||
#include "qdf_status.h"
|
||||
#include "qdf_types.h"
|
||||
#include "wlan_dsc_driver.h"
|
||||
#include "wlan_dsc_psoc.h"
|
||||
#include "wlan_dsc_vdev.h"
|
||||
|
||||
|
|
@ -90,16 +90,11 @@ static void osif_psoc_sync_put(struct osif_psoc_sync *psoc_sync)
|
|||
qdf_mem_zero(psoc_sync, sizeof(*psoc_sync));
|
||||
}
|
||||
|
||||
int osif_psoc_sync_create(struct dsc_driver *dsc_driver,
|
||||
struct osif_psoc_sync **out_psoc_sync)
|
||||
int osif_psoc_sync_create(struct osif_psoc_sync **out_psoc_sync)
|
||||
{
|
||||
QDF_STATUS status;
|
||||
struct osif_psoc_sync *psoc_sync;
|
||||
|
||||
QDF_BUG(dsc_driver);
|
||||
if (!dsc_driver)
|
||||
return -EINVAL;
|
||||
|
||||
QDF_BUG(out_psoc_sync);
|
||||
if (!out_psoc_sync)
|
||||
return -EINVAL;
|
||||
|
|
@ -110,7 +105,7 @@ int osif_psoc_sync_create(struct dsc_driver *dsc_driver,
|
|||
if (!psoc_sync)
|
||||
return -ENOMEM;
|
||||
|
||||
status = dsc_psoc_create(dsc_driver, &psoc_sync->dsc_psoc);
|
||||
status = osif_driver_sync_dsc_psoc_create(&psoc_sync->dsc_psoc);
|
||||
if (QDF_IS_STATUS_ERROR(status))
|
||||
goto sync_put;
|
||||
|
||||
|
|
@ -126,15 +121,14 @@ sync_put:
|
|||
return qdf_status_to_os_return(status);
|
||||
}
|
||||
|
||||
int __osif_psoc_sync_create_and_trans(struct dsc_driver *dsc_driver,
|
||||
struct osif_psoc_sync **out_psoc_sync,
|
||||
int __osif_psoc_sync_create_and_trans(struct osif_psoc_sync **out_psoc_sync,
|
||||
const char *desc)
|
||||
{
|
||||
struct osif_psoc_sync *psoc_sync;
|
||||
QDF_STATUS status;
|
||||
int errno;
|
||||
|
||||
errno = osif_psoc_sync_create(dsc_driver, &psoc_sync);
|
||||
errno = osif_psoc_sync_create(&psoc_sync);
|
||||
if (errno)
|
||||
return errno;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue