mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-24 09:13:20 -05:00
7add1ee346
With ARCH=x86, make allmodconfig && make W=1 C=1 reports: WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/platform/x86/amilo-rfkill.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/platform/x86/uv_sysfs.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/platform/x86/ibm_rtl.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/platform/x86/xo1-rfkill.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/platform/x86/firmware_attributes_class.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/platform/x86/wireless-hotkey.o Add the missing invocations of the MODULE_DESCRIPTION() macro. Signed-off-by: Jeff Johnson <quic_jjohnson@quicinc.com> Link: https://lore.kernel.org/r/20240611-md-drivers-platform-x86-v1-1-d850e53619ee@quicinc.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
53 lines
1.3 KiB
C
53 lines
1.3 KiB
C
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
/* Firmware attributes class helper module */
|
|
|
|
#include <linux/mutex.h>
|
|
#include <linux/device/class.h>
|
|
#include <linux/module.h>
|
|
#include "firmware_attributes_class.h"
|
|
|
|
static DEFINE_MUTEX(fw_attr_lock);
|
|
static int fw_attr_inuse;
|
|
|
|
static const struct class firmware_attributes_class = {
|
|
.name = "firmware-attributes",
|
|
};
|
|
|
|
int fw_attributes_class_get(const struct class **fw_attr_class)
|
|
{
|
|
int err;
|
|
|
|
mutex_lock(&fw_attr_lock);
|
|
if (!fw_attr_inuse) { /*first time class is being used*/
|
|
err = class_register(&firmware_attributes_class);
|
|
if (err) {
|
|
mutex_unlock(&fw_attr_lock);
|
|
return err;
|
|
}
|
|
}
|
|
fw_attr_inuse++;
|
|
*fw_attr_class = &firmware_attributes_class;
|
|
mutex_unlock(&fw_attr_lock);
|
|
return 0;
|
|
}
|
|
EXPORT_SYMBOL_GPL(fw_attributes_class_get);
|
|
|
|
int fw_attributes_class_put(void)
|
|
{
|
|
mutex_lock(&fw_attr_lock);
|
|
if (!fw_attr_inuse) {
|
|
mutex_unlock(&fw_attr_lock);
|
|
return -EINVAL;
|
|
}
|
|
fw_attr_inuse--;
|
|
if (!fw_attr_inuse) /* No more consumers */
|
|
class_unregister(&firmware_attributes_class);
|
|
mutex_unlock(&fw_attr_lock);
|
|
return 0;
|
|
}
|
|
EXPORT_SYMBOL_GPL(fw_attributes_class_put);
|
|
|
|
MODULE_AUTHOR("Mark Pearson <markpearson@lenovo.com>");
|
|
MODULE_DESCRIPTION("Firmware attributes class helper module");
|
|
MODULE_LICENSE("GPL");
|