* [PATCH] asus-laptop: is_visible should not return a bool
@ 2015-01-16 14:29 Vivien Didelot
2015-01-18 19:12 ` Darren Hart
0 siblings, 1 reply; 2+ messages in thread
From: Vivien Didelot @ 2015-01-16 14:29 UTC (permalink / raw)
To: platform-driver-x86
Cc: Vivien Didelot, Darren Hart, Corentin Chary, acpi4asus-user,
linux-kernel
With a Lucid platform, asus_sysfs_is_visible() returns a boolean for
ls_switch and ls_level attributes. Fix that and also s/supported/ok/ and
s/asus->handle/handle/ to avoid lines wider than 80 chars.
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
drivers/platform/x86/asus-laptop.c | 46 ++++++++++++++++----------------------
1 file changed, 19 insertions(+), 27 deletions(-)
diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c
index f71700e..c7d1655 100644
--- a/drivers/platform/x86/asus-laptop.c
+++ b/drivers/platform/x86/asus-laptop.c
@@ -1605,55 +1605,47 @@ static umode_t asus_sysfs_is_visible(struct kobject *kobj,
struct platform_device *pdev = to_platform_device(dev);
struct asus_laptop *asus = platform_get_drvdata(pdev);
acpi_handle handle = asus->handle;
- bool supported;
+ bool ok;
- if (asus->is_pega_lucid) {
- /* no ls_level interface on the Lucid */
- if (attr == &dev_attr_ls_switch.attr)
- supported = true;
- else if (attr == &dev_attr_ls_level.attr)
- supported = false;
- else
- goto normal;
+ if (asus->is_pega_lucid && attr == &dev_attr_ls_switch.attr) {
+ ok = true;
- return supported;
- }
+ } else if (asus->is_pega_lucid && attr == &dev_attr_ls_level.attr) {
+ ok = false; /* no ls_level interface on the Lucid */
-normal:
- if (attr == &dev_attr_wlan.attr) {
- supported = !acpi_check_handle(handle, METHOD_WLAN, NULL);
+ } else if (attr == &dev_attr_wlan.attr) {
+ ok = !acpi_check_handle(handle, METHOD_WLAN, NULL);
} else if (attr == &dev_attr_bluetooth.attr) {
- supported = !acpi_check_handle(handle, METHOD_BLUETOOTH, NULL);
+ ok = !acpi_check_handle(handle, METHOD_BLUETOOTH, NULL);
} else if (attr == &dev_attr_display.attr) {
- supported = !acpi_check_handle(handle, METHOD_SWITCH_DISPLAY, NULL);
+ ok = !acpi_check_handle(handle, METHOD_SWITCH_DISPLAY, NULL);
} else if (attr == &dev_attr_wimax.attr) {
- supported =
- !acpi_check_handle(asus->handle, METHOD_WIMAX, NULL);
+ ok = !acpi_check_handle(handle, METHOD_WIMAX, NULL);
} else if (attr == &dev_attr_wwan.attr) {
- supported = !acpi_check_handle(asus->handle, METHOD_WWAN, NULL);
+ ok = !acpi_check_handle(handle, METHOD_WWAN, NULL);
} else if (attr == &dev_attr_ledd.attr) {
- supported = !acpi_check_handle(handle, METHOD_LEDD, NULL);
+ ok = !acpi_check_handle(handle, METHOD_LEDD, NULL);
} else if (attr == &dev_attr_ls_switch.attr ||
attr == &dev_attr_ls_level.attr) {
- supported = !acpi_check_handle(handle, METHOD_ALS_CONTROL, NULL) &&
+ ok = !acpi_check_handle(handle, METHOD_ALS_CONTROL, NULL) &&
!acpi_check_handle(handle, METHOD_ALS_LEVEL, NULL);
} else if (attr == &dev_attr_ls_value.attr) {
- supported = asus->is_pega_lucid;
+ ok = asus->is_pega_lucid;
} else if (attr == &dev_attr_gps.attr) {
- supported = !acpi_check_handle(handle, METHOD_GPS_ON, NULL) &&
- !acpi_check_handle(handle, METHOD_GPS_OFF, NULL) &&
- !acpi_check_handle(handle, METHOD_GPS_STATUS, NULL);
+ ok = !acpi_check_handle(handle, METHOD_GPS_ON, NULL) &&
+ !acpi_check_handle(handle, METHOD_GPS_OFF, NULL) &&
+ !acpi_check_handle(handle, METHOD_GPS_STATUS, NULL);
} else {
- supported = true;
+ ok = true;
}
- return supported ? attr->mode : 0;
+ return ok ? attr->mode : 0;
}
--
2.2.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] asus-laptop: is_visible should not return a bool
2015-01-16 14:29 [PATCH] asus-laptop: is_visible should not return a bool Vivien Didelot
@ 2015-01-18 19:12 ` Darren Hart
0 siblings, 0 replies; 2+ messages in thread
From: Darren Hart @ 2015-01-18 19:12 UTC (permalink / raw)
To: Vivien Didelot
Cc: platform-driver-x86, Corentin Chary, acpi4asus-user, linux-kernel
On Fri, Jan 16, 2015 at 09:29:19AM -0500, Vivien Didelot wrote:
> With a Lucid platform, asus_sysfs_is_visible() returns a boolean for
> ls_switch and ls_level attributes. Fix that and also s/supported/ok/ and
> s/asus->handle/handle/ to avoid lines wider than 80 chars.
This is two patches, a cleanup and functional change. Since the cleanup has
nothing to do with the cleanup, please split these out.
"ok" is an atypical variable name. It looks as though "ret" would server just as
well and is far more consistent with typical usage.
--
Darren Hart
Intel Open Source Technology Center
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-01-18 19:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-16 14:29 [PATCH] asus-laptop: is_visible should not return a bool Vivien Didelot
2015-01-18 19:12 ` Darren Hart
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox