Skip to content

Commit 0a6ea2e

Browse files
Marek VasutKalle Valo
authored andcommitted
wifi: wilc1000: Fold chip_allow_sleep()/chip_wakeup() into wlan.c
Neither chip_allow_sleep()/chip_wakeup() is used outside of wlan.c . Make both functions static and remove both the exported symbol and entries from wlan.h . Make chip_allow_sleep() return error code in preparation for the follow up patches. Move acquire_bus() and release_bus() to avoid forward declaration of chip_allow_sleep()/chip_wakeup(). Reviewed-by: Alexis Lothoré <[email protected]> Signed-off-by: Marek Vasut <[email protected]> Signed-off-by: Kalle Valo <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent 719e469 commit 0a6ea2e

File tree

2 files changed

+23
-26
lines changed

2 files changed

+23
-26
lines changed

drivers/net/wireless/microchip/wilc1000/wlan.c

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,6 @@
1212

1313
#define WAKE_UP_TRIAL_RETRY 10000
1414

15-
static inline void acquire_bus(struct wilc *wilc, enum bus_acquire acquire)
16-
{
17-
mutex_lock(&wilc->hif_cs);
18-
if (acquire == WILC_BUS_ACQUIRE_AND_WAKEUP && wilc->power_save_mode)
19-
chip_wakeup(wilc);
20-
}
21-
22-
static inline void release_bus(struct wilc *wilc, enum bus_release release)
23-
{
24-
if (release == WILC_BUS_RELEASE_ALLOW_SLEEP && wilc->power_save_mode)
25-
chip_allow_sleep(wilc);
26-
mutex_unlock(&wilc->hif_cs);
27-
}
28-
2915
static void wilc_wlan_txq_remove(struct wilc *wilc, u8 q_num,
3016
struct txq_entry_t *tqe)
3117
{
@@ -555,7 +541,7 @@ static struct rxq_entry_t *wilc_wlan_rxq_remove(struct wilc *wilc)
555541
return rqe;
556542
}
557543

558-
void chip_allow_sleep(struct wilc *wilc)
544+
static int chip_allow_sleep(struct wilc *wilc)
559545
{
560546
u32 reg = 0;
561547
const struct wilc_hif_func *hif_func = wilc->hif_func;
@@ -584,7 +570,7 @@ void chip_allow_sleep(struct wilc *wilc)
584570
while (--trials) {
585571
ret = hif_func->hif_read_reg(wilc, to_host_from_fw_reg, &reg);
586572
if (ret)
587-
return;
573+
return ret;
588574
if ((reg & to_host_from_fw_bit) == 0)
589575
break;
590576
}
@@ -594,28 +580,28 @@ void chip_allow_sleep(struct wilc *wilc)
594580
/* Clear bit 1 */
595581
ret = hif_func->hif_read_reg(wilc, wakeup_reg, &reg);
596582
if (ret)
597-
return;
583+
return ret;
598584
if (reg & wakeup_bit) {
599585
reg &= ~wakeup_bit;
600586
ret = hif_func->hif_write_reg(wilc, wakeup_reg, reg);
601587
if (ret)
602-
return;
588+
return ret;
603589
}
604590

605591
ret = hif_func->hif_read_reg(wilc, from_host_to_fw_reg, &reg);
606592
if (ret)
607-
return;
593+
return ret;
608594
if (reg & from_host_to_fw_bit) {
609595
reg &= ~from_host_to_fw_bit;
610596
ret = hif_func->hif_write_reg(wilc, from_host_to_fw_reg, reg);
611597
if (ret)
612-
return;
613-
598+
return ret;
614599
}
600+
601+
return 0;
615602
}
616-
EXPORT_SYMBOL_GPL(chip_allow_sleep);
617603

618-
void chip_wakeup(struct wilc *wilc)
604+
static void chip_wakeup(struct wilc *wilc)
619605
{
620606
u32 ret = 0;
621607
u32 clk_status_val = 0, trials = 0;
@@ -674,7 +660,20 @@ void chip_wakeup(struct wilc *wilc)
674660
if (wilc->io_type == WILC_HIF_SPI)
675661
wilc->hif_func->hif_reset(wilc);
676662
}
677-
EXPORT_SYMBOL_GPL(chip_wakeup);
663+
664+
static inline void acquire_bus(struct wilc *wilc, enum bus_acquire acquire)
665+
{
666+
mutex_lock(&wilc->hif_cs);
667+
if (acquire == WILC_BUS_ACQUIRE_AND_WAKEUP && wilc->power_save_mode)
668+
chip_wakeup(wilc);
669+
}
670+
671+
static inline void release_bus(struct wilc *wilc, enum bus_release release)
672+
{
673+
if (release == WILC_BUS_RELEASE_ALLOW_SLEEP && wilc->power_save_mode)
674+
chip_allow_sleep(wilc);
675+
mutex_unlock(&wilc->hif_cs);
676+
}
678677

679678
void host_wakeup_notify(struct wilc *wilc)
680679
{

drivers/net/wireless/microchip/wilc1000/wlan.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,8 +438,6 @@ void wilc_wfi_p2p_rx(struct wilc_vif *vif, u8 *buff, u32 size);
438438
bool wilc_wfi_mgmt_frame_rx(struct wilc_vif *vif, u8 *buff, u32 size);
439439
void host_wakeup_notify(struct wilc *wilc);
440440
void host_sleep_notify(struct wilc *wilc);
441-
void chip_allow_sleep(struct wilc *wilc);
442-
void chip_wakeup(struct wilc *wilc);
443441
int wilc_send_config_pkt(struct wilc_vif *vif, u8 mode, struct wid *wids,
444442
u32 count);
445443
int wilc_wlan_init(struct net_device *dev);

0 commit comments

Comments
 (0)