From ba3a33876e92e000d7aa37eaf6581a7333c58560 Mon Sep 17 00:00:00 2001 From: Jiaxun Yang Date: Sat, 2 Dec 2017 21:45:31 +0800 Subject: platform/x86: ideapad-laptop: Remove unnecessary else Address the following checkpatch warning by removing unnecessary else blocks: WARNING: else is not generally useful after a break or return Signed-off-by: Jiaxun Yang Signed-off-by: Darren Hart (VMware) --- drivers/platform/x86/ideapad-laptop.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers/platform/x86/ideapad-laptop.c') diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c index 53ab4e0f8962..9f2a4bc58df0 100644 --- a/drivers/platform/x86/ideapad-laptop.c +++ b/drivers/platform/x86/ideapad-laptop.c @@ -124,10 +124,10 @@ static int read_method_int(acpi_handle handle, const char *method, int *val) if (ACPI_FAILURE(status)) { *val = -1; return -1; - } else { - *val = result; - return 0; } + *val = result; + return 0; + } static int method_gbmd(acpi_handle handle, unsigned long *ret) @@ -164,10 +164,10 @@ static int method_vpcr(acpi_handle handle, int cmd, int *ret) if (ACPI_FAILURE(status)) { *ret = -1; return -1; - } else { - *ret = result; - return 0; } + *ret = result; + return 0; + } static int method_vpcw(acpi_handle handle, int cmd, int data) -- cgit From f1395edbcec81dafa1c5fff3ef9c0ab04c6fe78d Mon Sep 17 00:00:00 2001 From: Jiaxun Yang Date: Sat, 2 Dec 2017 21:45:32 +0800 Subject: platform/x86: ideapad-laptop: Use __func__ instead of write_ec_cmd in pr_err Address the following checkpatch warning by using __func__ instead: WARNING: Prefer using '"%s...", __func__' to using 'write_ec_cmd', this function's name, in a string Signed-off-by: Jiaxun Yang Signed-off-by: Darren Hart (VMware) --- drivers/platform/x86/ideapad-laptop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/platform/x86/ideapad-laptop.c') diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c index 9f2a4bc58df0..37a88938bbaa 100644 --- a/drivers/platform/x86/ideapad-laptop.c +++ b/drivers/platform/x86/ideapad-laptop.c @@ -231,7 +231,7 @@ static int write_ec_cmd(acpi_handle handle, int cmd, unsigned long data) if (val == 0) return 0; } - pr_err("timeout in write_ec_cmd\n"); + pr_err("timeout in %s\n", __func__); return -1; } -- cgit From ae7c8cba32218592657130b34dc28f4d82aa755f Mon Sep 17 00:00:00 2001 From: Jiaxun Yang Date: Sat, 2 Dec 2017 21:45:34 +0800 Subject: platform/x86: ideapad-laptop: add lenovo RESCUER R720-15IKBN to no_hw_rfkill_list This model does not have a hardware rfkill switch, add it to the no_hw_rfkill_list to prevent the radio always being blocked. Reported-by: Roger Jargoyhen Signed-off-by: Jiaxun Yang Signed-off-by: Darren Hart (VMware) --- drivers/platform/x86/ideapad-laptop.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'drivers/platform/x86/ideapad-laptop.c') diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c index 37a88938bbaa..5ab638d4d243 100644 --- a/drivers/platform/x86/ideapad-laptop.c +++ b/drivers/platform/x86/ideapad-laptop.c @@ -963,6 +963,13 @@ static void ideapad_wmi_notify(u32 value, void *context) * report all radios as hardware-blocked. */ static const struct dmi_system_id no_hw_rfkill_list[] = { + { + .ident = "Lenovo RESCUER R720-15IKBN", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_MATCH(DMI_BOARD_NAME, "80WW"), + }, + }, { .ident = "Lenovo G40-30", .matches = { -- cgit From 28d71ae92182334421d642297f3b2bf642526c12 Mon Sep 17 00:00:00 2001 From: Olle Liljenzin Date: Sun, 7 Jan 2018 20:53:12 +0100 Subject: platform/x86: ideapad-laptop: Add Y720-15IKB to no_hw_rfkill Lenovo Legion Y720-15IKB is another Lenovo model without a hw rfkill switch, resulting in wifi always reported as hard blocked. Add the model to the list of models without rfkill switch. Signed-off-by: Olle Liljenzin Signed-off-by: Andy Shevchenko --- drivers/platform/x86/ideapad-laptop.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'drivers/platform/x86/ideapad-laptop.c') diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c index 5ab638d4d243..b2bbddd09a52 100644 --- a/drivers/platform/x86/ideapad-laptop.c +++ b/drivers/platform/x86/ideapad-laptop.c @@ -1110,6 +1110,13 @@ static const struct dmi_system_id no_hw_rfkill_list[] = { DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo Y520-15IKBN"), }, }, + { + .ident = "Lenovo Legion Y720-15IKB", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo Y720-15IKB"), + }, + }, { .ident = "Lenovo Legion Y720-15IKBN", .matches = { -- cgit From 334c4efd295cda01069cab03bf753537dc20c3eb Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Mon, 22 Jan 2018 18:05:45 +0200 Subject: platform/x86: ideapad-laptop: Re-use DEFINE_SHOW_ATTRIBUTE() macro ...instead of open coding file operations followed by custom ->open() callbacks per each attribute. Signed-off-by: Andy Shevchenko --- drivers/platform/x86/ideapad-laptop.c | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) (limited to 'drivers/platform/x86/ideapad-laptop.c') diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c index b2bbddd09a52..5b6f18b18801 100644 --- a/drivers/platform/x86/ideapad-laptop.c +++ b/drivers/platform/x86/ideapad-laptop.c @@ -284,19 +284,7 @@ static int debugfs_status_show(struct seq_file *s, void *data) return 0; } - -static int debugfs_status_open(struct inode *inode, struct file *file) -{ - return single_open(file, debugfs_status_show, inode->i_private); -} - -static const struct file_operations debugfs_status_fops = { - .owner = THIS_MODULE, - .open = debugfs_status_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; +DEFINE_SHOW_ATTRIBUTE(debugfs_status); static int debugfs_cfg_show(struct seq_file *s, void *data) { @@ -337,19 +325,7 @@ static int debugfs_cfg_show(struct seq_file *s, void *data) } return 0; } - -static int debugfs_cfg_open(struct inode *inode, struct file *file) -{ - return single_open(file, debugfs_cfg_show, inode->i_private); -} - -static const struct file_operations debugfs_cfg_fops = { - .owner = THIS_MODULE, - .open = debugfs_cfg_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; +DEFINE_SHOW_ATTRIBUTE(debugfs_cfg); static int ideapad_debugfs_init(struct ideapad_private *priv) { -- cgit