Skip to content

Commit

Permalink
staging: rtl8192e: Pass priv to firmware download functions
Browse files Browse the repository at this point in the history
Signed-off-by: Mike McCormack <mikem@ring3k.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Mike McCormack authored and Greg Kroah-Hartman committed Mar 14, 2011
1 parent 4368607 commit ef8efe5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 18 deletions.
4 changes: 2 additions & 2 deletions drivers/staging/rtl8192e/r8192E.h
Original file line number Diff line number Diff line change
Expand Up @@ -1108,7 +1108,7 @@ typedef struct r8192_priv
struct workqueue_struct *priv_wq;
}r8192_priv;

bool init_firmware(struct net_device *dev);
bool init_firmware(struct r8192_priv *priv);
u32 read_cam(struct r8192_priv *priv, u8 addr);
void write_cam(struct r8192_priv *priv, u8 addr, u32 data);
u8 read_nic_byte(struct r8192_priv *priv, int x);
Expand All @@ -1126,7 +1126,7 @@ void CamResetAllEntry(struct r8192_priv *priv);
void EnableHWSecurityConfig8192(struct r8192_priv *priv);
void setKey(struct r8192_priv *priv, u8 EntryNo, u8 KeyIndex, u16 KeyType,
const u8 *MacAddr, u8 DefaultKey, u32 *KeyContent);
void firmware_init_param(struct net_device *dev);
void firmware_init_param(struct r8192_priv *priv);
RT_STATUS cmpk_message_handle_tx(struct net_device *dev, u8* codevirtualaddress, u32 packettype, u32 buffer_len);

#ifdef ENABLE_IPS
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/rtl8192e/r8192E_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2713,7 +2713,7 @@ static RT_STATUS rtl8192_adapter_start(struct r8192_priv *priv)

//Firmware download
RT_TRACE(COMP_INIT, "Load Firmware!\n");
bfirmwareok = init_firmware(dev);
bfirmwareok = init_firmware(priv);
if(bfirmwareok != true) {
rtStatus = RT_STATUS_FAILURE;
return rtStatus;
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/rtl8192e/r819xE_cmdpkt.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ RT_STATUS cmpk_message_handle_tx(
int i;

RT_TRACE(COMP_CMDPKT,"%s(),buffer_len is %d\n",__FUNCTION__,buffer_len);
firmware_init_param(dev);
firmware_init_param(priv);
//Fragmentation might be required
frag_threshold = pfirmware->cmdpacket_frag_thresold;
do {
Expand Down
24 changes: 10 additions & 14 deletions drivers/staging/rtl8192e/r819xE_firmware.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ enum opt_rst_type {
OPT_FIRMWARE_RESET = 1,
};

void firmware_init_param(struct net_device *dev)
void firmware_init_param(struct r8192_priv *priv)
{
struct r8192_priv *priv = ieee80211_priv(dev);
rt_firmware *pfirmware = priv->pFirmware;

pfirmware->cmdpacket_frag_thresold =
Expand All @@ -37,10 +36,10 @@ void firmware_init_param(struct net_device *dev)
/*
* segment the img and use the ptr and length to remember info on each segment
*/
static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address,
static bool fw_download_code(struct r8192_priv *priv, u8 *code_virtual_address,
u32 buffer_len)
{
struct r8192_priv *priv = ieee80211_priv(dev);
struct net_device *dev = priv->ieee80211->dev;
bool rt_status = true;
u16 frag_threshold;
u16 frag_length, frag_offset = 0;
Expand All @@ -52,7 +51,7 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address,
cb_desc *tcb_desc;
u8 bLastIniPkt;

firmware_init_param(dev);
firmware_init_param(priv);

/* Fragmentation might be required */
frag_threshold = pfirmware->cmdpacket_frag_thresold;
Expand Down Expand Up @@ -113,9 +112,8 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address,
* register. Switch to CPU register in the begin and switch
* back before return
*/
static bool CPUcheck_maincodeok_turnonCPU(struct net_device *dev)
static bool CPUcheck_maincodeok_turnonCPU(struct r8192_priv *priv)
{
struct r8192_priv *priv = ieee80211_priv(dev);
unsigned long timeout;
bool rt_status = true;
u32 CPU_status = 0;
Expand Down Expand Up @@ -166,9 +164,8 @@ static bool CPUcheck_maincodeok_turnonCPU(struct net_device *dev)
return rt_status;
}

static bool CPUcheck_firmware_ready(struct net_device *dev)
static bool CPUcheck_firmware_ready(struct r8192_priv *priv)
{
struct r8192_priv *priv = ieee80211_priv(dev);
unsigned long timeout;
bool rt_status = true;
u32 CPU_status = 0;
Expand Down Expand Up @@ -197,9 +194,8 @@ static bool CPUcheck_firmware_ready(struct net_device *dev)

}

bool init_firmware(struct net_device *dev)
bool init_firmware(struct r8192_priv *priv)
{
struct r8192_priv *priv = ieee80211_priv(dev);
bool rt_status = true;
u32 file_length = 0;
u8 *mapped_file = NULL;
Expand Down Expand Up @@ -289,7 +285,7 @@ bool init_firmware(struct net_device *dev)
* 3. each skb_buff packet data content will already include
* the firmware info and Tx descriptor info
*/
rt_status = fw_download_code(dev, mapped_file, file_length);
rt_status = fw_download_code(priv, mapped_file, file_length);
if (rt_status != TRUE)
goto download_firmware_fail;

Expand All @@ -314,7 +310,7 @@ bool init_firmware(struct net_device *dev)
pfirmware->firmware_status = FW_STATUS_2_MOVE_MAIN_CODE;

/* Check Put Code OK and Turn On CPU */
rt_status = CPUcheck_maincodeok_turnonCPU(dev);
rt_status = CPUcheck_maincodeok_turnonCPU(priv);
if (rt_status != TRUE) {
RT_TRACE(COMP_FIRMWARE,
"CPUcheck_maincodeok_turnonCPU fail!\n");
Expand All @@ -329,7 +325,7 @@ bool init_firmware(struct net_device *dev)
pfirmware->firmware_status = FW_STATUS_4_MOVE_DATA_CODE;
mdelay(1);

rt_status = CPUcheck_firmware_ready(dev);
rt_status = CPUcheck_firmware_ready(priv);
if (rt_status != TRUE) {
RT_TRACE(COMP_FIRMWARE,
"CPUcheck_firmware_ready fail(%d)!\n",
Expand Down

0 comments on commit ef8efe5

Please sign in to comment.