Skip to content

Commit

Permalink
ath6kl: replace do while loop with function helpers on ar6000_avail_ev()
Browse files Browse the repository at this point in the history
This unwraps the do while loops in favor for function helpers.

Cc: Naveen Singh <nsingh@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Luis R. Rodriguez authored and Greg Kroah-Hartman committed Apr 5, 2011
1 parent c1ccd08 commit e4551c7
Showing 1 changed file with 48 additions and 20 deletions.
68 changes: 48 additions & 20 deletions drivers/staging/ath6kl/os/linux/ar6000_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1586,6 +1586,52 @@ init_netdev(struct net_device *dev, char *name)
return;
}

static int __ath6kl_init_netdev(struct net_device *dev)
{
int r;

rtnl_lock();
r = ar6000_init(dev);
rtnl_unlock();

if (r) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_avail: ar6000_init\n"));
return r;
}

return 0;
}

#ifdef HTC_RAW_INTERFACE
static int ath6kl_init_netdev_wmi(struct net_device *dev)
{
if (!eppingtest && bypasswmi)
return 0;

return __ath6kl_init_netdev(dev);
}
#else
static int ath6kl_init_netdev_wmi(struct net_device *dev)
{
return __ath6kl_init_netdev(dev);
}
#endif

static int ath6kl_init_netdev(struct ar6_softc *ar)
{
int r;

r = ar6000_sysfs_bmi_get_config(ar, wlaninitmode);
if (r) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
("ar6000_avail: "
"ar6000_sysfs_bmi_get_config failed\n"));
return r;
}

return ath6kl_init_netdev_wmi(ar->arNetDev);
}

/*
* HTC Event handlers
*/
Expand Down Expand Up @@ -1788,26 +1834,8 @@ ar6000_avail_ev(void *context, void *hif_handle)
AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("BMI enabled: %d\n", wlaninitmode));
if ((wlaninitmode == WLAN_INIT_MODE_UDEV) ||
(wlaninitmode == WLAN_INIT_MODE_DRV)) {
do {
r = ar6000_sysfs_bmi_get_config(ar, wlaninitmode);
if (r) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_avail: ar6000_sysfs_bmi_get_config failed\n"));
break;
}
#ifdef HTC_RAW_INTERFACE
if (!eppingtest && bypasswmi) {
break; /* Don't call ar6000_init for ART */
}
#endif
rtnl_lock();
r = ar6000_init(dev);
rtnl_unlock();
if (r) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,("ar6000_avail: ar6000_init\n"));
}
} while (false);

if (r)
r = ath6kl_init_netdev(ar);
if (r)
goto avail_ev_failed;
}

Expand Down

0 comments on commit e4551c7

Please sign in to comment.