wireless/bcm43xxx: remove global variable for bcmf_sdio_thread

Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
chao.an 2022-06-19 01:02:21 +08:00 committed by Xiang Xiao
parent e3bfdf7115
commit 0ec74ec6dd

View File

@ -28,6 +28,7 @@
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include <string.h> #include <string.h>
#include <stdio.h>
#include <debug.h> #include <debug.h>
#include <errno.h> #include <errno.h>
#include <queue.h> #include <queue.h>
@ -115,10 +116,6 @@ static bool brcm_chip_sr_capable(FAR struct bcmf_sdio_dev_s *sbus);
* Private Data * Private Data
****************************************************************************/ ****************************************************************************/
/* FIXME remove */
FAR struct bcmf_dev_s *g_sdio_priv;
/* Buffer pool for SDIO bus interface /* Buffer pool for SDIO bus interface
* This pool is shared between all driver devices * This pool is shared between all driver devices
*/ */
@ -660,8 +657,10 @@ int bcmf_write_reg(FAR struct bcmf_sdio_dev_s *sbus, uint8_t function,
int bcmf_bus_sdio_initialize(FAR struct bcmf_dev_s *priv, int bcmf_bus_sdio_initialize(FAR struct bcmf_dev_s *priv,
int minor, FAR struct sdio_dev_s *dev) int minor, FAR struct sdio_dev_s *dev)
{ {
int ret;
FAR struct bcmf_sdio_dev_s *sbus; FAR struct bcmf_sdio_dev_s *sbus;
FAR char *argv[2];
char arg1[32];
int ret;
/* Allocate sdio bus structure */ /* Allocate sdio bus structure */
@ -759,10 +758,6 @@ int bcmf_bus_sdio_initialize(FAR struct bcmf_dev_s *priv,
goto exit_uninit_hw; goto exit_uninit_hw;
} }
/* FIXME global variable for now */
g_sdio_priv = priv;
/* Register sdio bus */ /* Register sdio bus */
priv->bus = &sbus->bus; priv->bus = &sbus->bus;
@ -774,11 +769,13 @@ int bcmf_bus_sdio_initialize(FAR struct bcmf_dev_s *priv,
/* Spawn bcmf daemon thread */ /* Spawn bcmf daemon thread */
snprintf(arg1, sizeof(arg1), "%p", priv);
argv[0] = arg1;
argv[1] = NULL;
ret = kthread_create(BCMF_THREAD_NAME, ret = kthread_create(BCMF_THREAD_NAME,
CONFIG_IEEE80211_BROADCOM_SCHED_PRIORITY, CONFIG_IEEE80211_BROADCOM_SCHED_PRIORITY,
BCMF_THREAD_STACK_SIZE, bcmf_sdio_thread, BCMF_THREAD_STACK_SIZE, bcmf_sdio_thread,
(FAR char * const *)NULL); argv);
if (ret <= 0) if (ret <= 0)
{ {
wlerr("Cannot spawn bcmf thread\n"); wlerr("Cannot spawn bcmf thread\n");
@ -868,7 +865,8 @@ void bcmf_sdio_waitdog_timeout(wdparm_t arg)
int bcmf_sdio_thread(int argc, char **argv) int bcmf_sdio_thread(int argc, char **argv)
{ {
FAR struct bcmf_dev_s *priv = g_sdio_priv; FAR struct bcmf_dev_s *priv = (FAR struct bcmf_dev_s *)
((uintptr_t)strtoul(argv[1], NULL, 16));
FAR struct bcmf_sdio_dev_s *sbus = (FAR struct bcmf_sdio_dev_s *)priv->bus; FAR struct bcmf_sdio_dev_s *sbus = (FAR struct bcmf_sdio_dev_s *)priv->bus;
int ret; int ret;