From d9d16e16a3f82e88fec99222c9c7e26563b05688 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 7 Nov 2017 17:30:05 +0100 Subject: kobject: add SPDX identifiers to all kobject files It's good to have SPDX identifiers in all files to make it easier to audit the kernel tree for correct licenses. Update the kobject files files with the correct SPDX license identifier based on the license text in the file itself. The SPDX identifier is a legally binding shorthand, which can be used instead of the full boiler plate text. This work is based on a script and data from Thomas Gleixner, Philippe Ombredanne, and Kate Stewart. Cc: Thomas Gleixner Cc: Kate Stewart Cc: Philippe Ombredanne Signed-off-by: Greg Kroah-Hartman --- lib/kobject.c | 1 + lib/kobject_uevent.c | 1 + 2 files changed, 2 insertions(+) (limited to 'lib') diff --git a/lib/kobject.c b/lib/kobject.c index 763d70a18941..450e771d0ac7 100644 --- a/lib/kobject.c +++ b/lib/kobject.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * kobject.c - library routines for handling generic kernel objects * diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c index c3e84edc47c9..bbedaf359a1e 100644 --- a/lib/kobject_uevent.c +++ b/lib/kobject_uevent.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * kernel userspace event delivery * -- cgit v1.2.1 From 045c5f75b77177ad19fe747e33aae2249a12e827 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 7 Nov 2017 17:30:06 +0100 Subject: kobject: Remove redundant license text Now that the SPDX tag is in all kobject files, that identifies the license in a specific and legally-defined manner. So the extra GPL text wording can be removed as it is no longer needed at all. This is done on a quest to remove the 700+ different ways that files in the kernel describe the GPL license text. And there's unneeded stuff like the address (sometimes incorrect) for the FSF which is never needed. No copyright headers or other non-license-description text was removed. Signed-off-by: Greg Kroah-Hartman --- lib/kobject.c | 3 --- lib/kobject_uevent.c | 2 -- 2 files changed, 5 deletions(-) (limited to 'lib') diff --git a/lib/kobject.c b/lib/kobject.c index 450e771d0ac7..fad12300d264 100644 --- a/lib/kobject.c +++ b/lib/kobject.c @@ -6,9 +6,6 @@ * Copyright (c) 2006-2007 Greg Kroah-Hartman * Copyright (c) 2006-2007 Novell Inc. * - * This file is released under the GPLv2. - * - * * Please see the file Documentation/kobject.txt for critical information * about using the kobject interface. */ diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c index bbedaf359a1e..cc7e2c46273b 100644 --- a/lib/kobject_uevent.c +++ b/lib/kobject_uevent.c @@ -6,8 +6,6 @@ * Copyright (C) 2004 Novell, Inc. All rights reserved. * Copyright (C) 2004 IBM, Inc. All rights reserved. * - * Licensed under the GNU GPL v2. - * * Authors: * Robert Love * Kay Sievers -- cgit v1.2.1 From b6b996b6cdeecf7e1646c87422e04e446ddce124 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Tue, 19 Dec 2017 10:15:07 -0800 Subject: treewide: Use DEVICE_ATTR_RW Convert DEVICE_ATTR uses to DEVICE_ATTR_RW where possible. Done with perl script: $ git grep -w --name-only DEVICE_ATTR | \ xargs perl -i -e 'local $/; while (<>) { s/\bDEVICE_ATTR\s*\(\s*(\w+)\s*,\s*\(?(\s*S_IRUGO\s*\|\s*S_IWUSR|\s*S_IWUSR\s*\|\s*S_IRUGO\s*|\s*0644\s*)\)?\s*,\s*\1_show\s*,\s*\1_store\s*\)/DEVICE_ATTR_RW(\1)/g; print;}' Signed-off-by: Joe Perches Acked-by: Felipe Balbi Acked-by: Andy Shevchenko Acked-by: Bartlomiej Zolnierkiewicz Acked-by: Zhang Rui Acked-by: Jarkko Nikula Acked-by: Jani Nikula Signed-off-by: Greg Kroah-Hartman --- lib/test_firmware.c | 14 +++++--------- lib/test_kmod.c | 14 +++++--------- 2 files changed, 10 insertions(+), 18 deletions(-) (limited to 'lib') diff --git a/lib/test_firmware.c b/lib/test_firmware.c index 64a4c76cba2b..964784dc1602 100644 --- a/lib/test_firmware.c +++ b/lib/test_firmware.c @@ -359,7 +359,7 @@ static ssize_t config_name_show(struct device *dev, { return config_test_show_str(buf, test_fw_config->name); } -static DEVICE_ATTR(config_name, 0644, config_name_show, config_name_store); +static DEVICE_ATTR_RW(config_name); static ssize_t config_num_requests_store(struct device *dev, struct device_attribute *attr, @@ -388,8 +388,7 @@ static ssize_t config_num_requests_show(struct device *dev, { return test_dev_config_show_u8(buf, test_fw_config->num_requests); } -static DEVICE_ATTR(config_num_requests, 0644, config_num_requests_show, - config_num_requests_store); +static DEVICE_ATTR_RW(config_num_requests); static ssize_t config_sync_direct_store(struct device *dev, struct device_attribute *attr, @@ -411,8 +410,7 @@ static ssize_t config_sync_direct_show(struct device *dev, { return test_dev_config_show_bool(buf, test_fw_config->sync_direct); } -static DEVICE_ATTR(config_sync_direct, 0644, config_sync_direct_show, - config_sync_direct_store); +static DEVICE_ATTR_RW(config_sync_direct); static ssize_t config_send_uevent_store(struct device *dev, struct device_attribute *attr, @@ -428,8 +426,7 @@ static ssize_t config_send_uevent_show(struct device *dev, { return test_dev_config_show_bool(buf, test_fw_config->send_uevent); } -static DEVICE_ATTR(config_send_uevent, 0644, config_send_uevent_show, - config_send_uevent_store); +static DEVICE_ATTR_RW(config_send_uevent); static ssize_t config_read_fw_idx_store(struct device *dev, struct device_attribute *attr, @@ -445,8 +442,7 @@ static ssize_t config_read_fw_idx_show(struct device *dev, { return test_dev_config_show_u8(buf, test_fw_config->read_fw_idx); } -static DEVICE_ATTR(config_read_fw_idx, 0644, config_read_fw_idx_show, - config_read_fw_idx_store); +static DEVICE_ATTR_RW(config_read_fw_idx); static ssize_t trigger_request_store(struct device *dev, diff --git a/lib/test_kmod.c b/lib/test_kmod.c index 337f408b4de6..e372b97eee13 100644 --- a/lib/test_kmod.c +++ b/lib/test_kmod.c @@ -694,8 +694,7 @@ static ssize_t config_test_driver_show(struct device *dev, return config_test_show_str(&test_dev->config_mutex, buf, config->test_driver); } -static DEVICE_ATTR(config_test_driver, 0644, config_test_driver_show, - config_test_driver_store); +static DEVICE_ATTR_RW(config_test_driver); static ssize_t config_test_fs_store(struct device *dev, struct device_attribute *attr, @@ -726,8 +725,7 @@ static ssize_t config_test_fs_show(struct device *dev, return config_test_show_str(&test_dev->config_mutex, buf, config->test_fs); } -static DEVICE_ATTR(config_test_fs, 0644, config_test_fs_show, - config_test_fs_store); +static DEVICE_ATTR_RW(config_test_fs); static int trigger_config_run_type(struct kmod_test_device *test_dev, enum kmod_test_case test_case, @@ -1012,8 +1010,7 @@ static ssize_t config_num_threads_show(struct device *dev, return test_dev_config_show_int(test_dev, buf, config->num_threads); } -static DEVICE_ATTR(config_num_threads, 0644, config_num_threads_show, - config_num_threads_store); +static DEVICE_ATTR_RW(config_num_threads); static ssize_t config_test_case_store(struct device *dev, struct device_attribute *attr, @@ -1037,8 +1034,7 @@ static ssize_t config_test_case_show(struct device *dev, return test_dev_config_show_uint(test_dev, buf, config->test_case); } -static DEVICE_ATTR(config_test_case, 0644, config_test_case_show, - config_test_case_store); +static DEVICE_ATTR_RW(config_test_case); static ssize_t test_result_show(struct device *dev, struct device_attribute *attr, @@ -1049,7 +1045,7 @@ static ssize_t test_result_show(struct device *dev, return test_dev_config_show_int(test_dev, buf, config->test_result); } -static DEVICE_ATTR(test_result, 0644, test_result_show, test_result_store); +static DEVICE_ATTR_RW(test_result); #define TEST_KMOD_DEV_ATTR(name) &dev_attr_##name.attr -- cgit v1.2.1 From 76f8ab1bd1cb0be3233ab07790c3108d986aeabf Mon Sep 17 00:00:00 2001 From: Wei Yongjun Date: Thu, 11 Jan 2018 11:13:45 +0000 Subject: test_firmware: make local symbol test_fw_config static Fixes the following sparse warnings: lib/test_firmware.c:99:20: warning: symbol 'test_fw_config' was not declared. Should it be static? Signed-off-by: Wei Yongjun Signed-off-by: Greg Kroah-Hartman --- lib/test_firmware.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/test_firmware.c b/lib/test_firmware.c index 964784dc1602..1e907dd3b4fe 100644 --- a/lib/test_firmware.c +++ b/lib/test_firmware.c @@ -96,7 +96,7 @@ struct test_config { struct device *device); }; -struct test_config *test_fw_config; +static struct test_config *test_fw_config; static ssize_t test_fw_misc_read(struct file *f, char __user *buf, size_t size, loff_t *offset) -- cgit v1.2.1 From a5e1923356505e46476c2fb518559b7a4d9d25b1 Mon Sep 17 00:00:00 2001 From: Wei Yongjun Date: Thu, 11 Jan 2018 11:12:55 +0000 Subject: test_firmware: fix missing unlock on error in config_num_requests_store() Add the missing unlock before return from function config_num_requests_store() in the error handling case. Fixes: c92316bf8e94 ("test_firmware: add batched firmware tests") Cc: stable Signed-off-by: Wei Yongjun Signed-off-by: Greg Kroah-Hartman --- lib/test_firmware.c | 1 + 1 file changed, 1 insertion(+) (limited to 'lib') diff --git a/lib/test_firmware.c b/lib/test_firmware.c index 1e907dd3b4fe..078a61480573 100644 --- a/lib/test_firmware.c +++ b/lib/test_firmware.c @@ -371,6 +371,7 @@ static ssize_t config_num_requests_store(struct device *dev, if (test_fw_config->reqs) { pr_err("Must call release_all_firmware prior to changing config\n"); rc = -EINVAL; + mutex_unlock(&test_fw_mutex); goto out; } mutex_unlock(&test_fw_mutex); -- cgit v1.2.1