Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ca946972 authored by Sergio Paracuellos's avatar Sergio Paracuellos Committed by Greg Kroah-Hartman
Browse files

staging: ks7010: refactor ks_wlan_get_mode function



Avoid the use of switch-case block which is not necessary
at all and just use a ternary operator to achieve this.

Signed-off-by: default avatarSergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1e4c7fb3
Loading
Loading
Loading
Loading
+2 −11
Original line number Diff line number Diff line
@@ -765,18 +765,9 @@ static int ks_wlan_get_mode(struct net_device *dev,
	if (priv->sleep_mode == SLP_SLEEP)
		return -EPERM;

	/* for SLEEP MODE */
	/* If not managed, assume it's ad-hoc */
	switch (priv->reg.operation_mode) {
	case MODE_INFRASTRUCTURE:
		uwrq->mode = IW_MODE_INFRA;
		break;
	case MODE_ADHOC:
		uwrq->mode = IW_MODE_ADHOC;
		break;
	default:
		uwrq->mode = IW_MODE_ADHOC;
	}
	uwrq->mode = (priv->reg.operation_mode == MODE_INFRASTRUCTURE) ?
		      IW_MODE_INFRA : IW_MODE_ADHOC;

	return 0;
}