wl1271: Change booleans in struct wl1271 into a flags bitmask

For cleaner implementation, change the bunch of booleans in the struct wl1271
structure into a flags bitmask.

Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Juuso Oikarinen
2009-12-11 15:41:07 +02:00
committed by John W. Linville
parent 830fb67b8e
commit 71449f8d70
7 changed files with 55 additions and 64 deletions

View File

@@ -241,10 +241,12 @@ static ssize_t gpio_power_read(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
{
struct wl1271 *wl = file->private_data;
bool state = test_bit(WL1271_FLAG_GPIO_POWER, &wl->flags);
int res;
char buf[10];
res = scnprintf(buf, sizeof(buf), "%d\n", wl->gpio_power);
res = scnprintf(buf, sizeof(buf), "%d\n", state);
return simple_read_from_buffer(user_buf, count, ppos, buf, res);
}
@@ -274,8 +276,13 @@ static ssize_t gpio_power_write(struct file *file,
goto out;
}
wl->set_power(!!value);
wl->gpio_power = !!value;
if (value) {
wl->set_power(true);
set_bit(WL1271_FLAG_GPIO_POWER, &wl->flags);
} else {
wl->set_power(false);
clear_bit(WL1271_FLAG_GPIO_POWER, &wl->flags);
}
out:
mutex_unlock(&wl->mutex);