Move all the static function declarations from .h to .c

Making a function static means "this function is compilation-unit-locale and
cannot be used (linked to) by others".

Putting a function prototype p into a header file h means every other module m
that includes h can call p.

Putting a static function prototype into a header file means "you can call this,
but you can not call this" which makes no sense. All this prototypes all only
needed compilation unit internally (and should only be used so). This commit
moves them where they belong. And subsequent commits will clean them up
because most are not necesarry in the .c file.
This commit is contained in:
Richard Sailer 2019-05-31 21:16:10 +02:00
parent 41623907ad
commit 80fd1b3ee3
2 changed files with 73 additions and 73 deletions

View file

@ -33,6 +33,79 @@ MODULE_DESCRIPTION("TUXEDO Computer Keyboard Backlight Driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_VERSION("1.0.0"); MODULE_VERSION("1.0.0");
// Init and Exit methods
static int __init tuxdeo_keyboard_init(void);
static void __exit tuxdeo_keyboard_exit(void);
static int __init tuxedo_input_init(void);
static void __exit tuxedo_input_exit(void);
// Methods for controlling the Keyboard
static void set_brightness(u8 brightness);
static void set_kb_state(u8 state);
static void set_mode(u8 mode);
static int set_color(u32 region, u32 color);
static int set_color_region(const char *buffer, size_t size, u32 region);
static int tuxedo_wmi_remove(struct platform_device *dev);
static int tuxedo_wmi_resume(struct platform_device *dev);
static int tuxedo_wmi_probe(struct platform_device *dev);
static void tuxedo_wmi_notify(u32 value, void *context);
static int tuxedo_evaluate_method(u32 method_id, u32 arg, u32 * retval);
// Sysfs Interface Methods
// Sysfs Interface for the keyboard state (ON / OFF)
static ssize_t show_state_fs(struct device *child,
struct device_attribute *attr, char *buffer);
static ssize_t set_state_fs(struct device *child, struct device_attribute *attr,
const char *buffer, size_t size);
// Sysfs Interface for the color of the left side (Color as hexvalue)
static ssize_t show_color_left_fs(struct device *child,
struct device_attribute *attr, char *buffer);
static ssize_t set_color_left_fs(struct device *child,
struct device_attribute *attr,
const char *buffer, size_t size);
// Sysfs Interface for the color of the center (Color as hexvalue)
static ssize_t show_color_center_fs(struct device *child,
struct device_attribute *attr,
char *buffer);
static ssize_t set_color_center_fs(struct device *child,
struct device_attribute *attr,
const char *buffer, size_t size);
// Sysfs Interface for the color of the right side (Color as hexvalue)
static ssize_t show_color_right_fs(struct device *child,
struct device_attribute *attr, char *buffer);
static ssize_t set_color_right_fs(struct device *child,
struct device_attribute *attr,
const char *buffer, size_t size);
// Sysfs Interface for the color of the extra region (Color as hexvalue)
static ssize_t show_color_extra_fs(struct device *child,
struct device_attribute *attr, char *buffer);
static ssize_t set_color_extra_fs(struct device *child,
struct device_attribute *attr,
const char *buffer, size_t size);
// Sysfs Interface for the keyboard brightness (unsigned int)
static ssize_t show_brightness_fs(struct device *child,
struct device_attribute *attr, char *buffer);
static ssize_t set_brightness_fs(struct device *child,
struct device_attribute *attr,
const char *buffer, size_t size);
// Sysfs Interface for the keyboard mode
static ssize_t show_mode_fs(struct device *child, struct device_attribute *attr,
char *buffer);
static ssize_t set_mode_fs(struct device *child, struct device_attribute *attr,
const char *buffer, size_t size);
// Sysfs Interface for if the keyboard has extra region
static ssize_t show_hasextra_fs(struct device *child,
struct device_attribute *attr, char *buffer);
// Sysfs Interface for the keyboard state (ON / OFF) // Sysfs Interface for the keyboard state (ON / OFF)
static ssize_t static ssize_t
show_state_fs(struct device *child, struct device_attribute *attr, char *buffer) show_state_fs(struct device *child, struct device_attribute *attr, char *buffer)

View file

@ -78,58 +78,6 @@
// Module Parameter Values // Module Parameter Values
//static bool //static bool
// Sysfs Interface Methods
// Sysfs Interface for the keyboard state (ON / OFF)
static ssize_t show_state_fs(struct device *child,
struct device_attribute *attr, char *buffer);
static ssize_t set_state_fs(struct device *child, struct device_attribute *attr,
const char *buffer, size_t size);
// Sysfs Interface for the color of the left side (Color as hexvalue)
static ssize_t show_color_left_fs(struct device *child,
struct device_attribute *attr, char *buffer);
static ssize_t set_color_left_fs(struct device *child,
struct device_attribute *attr,
const char *buffer, size_t size);
// Sysfs Interface for the color of the center (Color as hexvalue)
static ssize_t show_color_center_fs(struct device *child,
struct device_attribute *attr,
char *buffer);
static ssize_t set_color_center_fs(struct device *child,
struct device_attribute *attr,
const char *buffer, size_t size);
// Sysfs Interface for the color of the right side (Color as hexvalue)
static ssize_t show_color_right_fs(struct device *child,
struct device_attribute *attr, char *buffer);
static ssize_t set_color_right_fs(struct device *child,
struct device_attribute *attr,
const char *buffer, size_t size);
// Sysfs Interface for the color of the extra region (Color as hexvalue)
static ssize_t show_color_extra_fs(struct device *child,
struct device_attribute *attr, char *buffer);
static ssize_t set_color_extra_fs(struct device *child,
struct device_attribute *attr,
const char *buffer, size_t size);
// Sysfs Interface for the keyboard brightness (unsigned int)
static ssize_t show_brightness_fs(struct device *child,
struct device_attribute *attr, char *buffer);
static ssize_t set_brightness_fs(struct device *child,
struct device_attribute *attr,
const char *buffer, size_t size);
// Sysfs Interface for the keyboard mode
static ssize_t show_mode_fs(struct device *child, struct device_attribute *attr,
char *buffer);
static ssize_t set_mode_fs(struct device *child, struct device_attribute *attr,
const char *buffer, size_t size);
// Sysfs Interface for if the keyboard has extra region
static ssize_t show_hasextra_fs(struct device *child,
struct device_attribute *attr, char *buffer);
// Keyboard struct // Keyboard struct
static struct { static struct {
@ -171,27 +119,6 @@ static struct {
struct platform_device *tuxedo_platform_device; struct platform_device *tuxedo_platform_device;
static struct input_dev *tuxedo_input_device; static struct input_dev *tuxedo_input_device;
// Init and Exit methods
static int __init tuxdeo_keyboard_init(void);
static void __exit tuxdeo_keyboard_exit(void);
static int __init tuxedo_input_init(void);
static void __exit tuxedo_input_exit(void);
// Methods for controlling the Keyboard
static void set_brightness(u8 brightness);
static void set_kb_state(u8 state);
static void set_mode(u8 mode);
static int set_color(u32 region, u32 color);
static int set_color_region(const char *buffer, size_t size, u32 region);
static int tuxedo_wmi_remove(struct platform_device *dev);
static int tuxedo_wmi_resume(struct platform_device *dev);
static int tuxedo_wmi_probe(struct platform_device *dev);
static void tuxedo_wmi_notify(u32 value, void *context);
static int tuxedo_evaluate_method(u32 method_id, u32 arg, u32 * retval);
static struct platform_driver tuxedo_platform_driver = { static struct platform_driver tuxedo_platform_driver = {
.remove = tuxedo_wmi_remove, .remove = tuxedo_wmi_remove,