2015-02-11 06:44:08

by Azael Avalos

[permalink] [raw]
Subject: [PATCH 0/5] toshiba_acpi: Clean file plus some function renames

These patches are simply "cleaning" the file, making it more readable
and in the process, make it comply according to coding style.

--->8---
Darren,

I'm sending these patches now and let you decide if you want them for
3.20 as the merge window is still open or queue them up for 3.21 :-)
---8<---

Azael Avalos (5):
toshiba_acpi: Clean file according to coding style
Documentation/ABI: Add file describing the sysfs entries for
toshiba_acpi
toshiba_acpi: Move sysfs function and struct declarations further down
toshiba_acpi: Drop the toshiba_ prefix from sysfs function names
toshiba_acpi: Make use of DEVICE_ATTR_{RO, RW} macros

.../ABI/testing/sysfs-driver-toshiba_acpi | 114 +++++++
drivers/platform/x86/toshiba_acpi.c | 344 ++++++++-------------
2 files changed, 237 insertions(+), 221 deletions(-)
create mode 100644 Documentation/ABI/testing/sysfs-driver-toshiba_acpi

--
2.2.2


2015-02-11 06:44:10

by Azael Avalos

[permalink] [raw]
Subject: [PATCH 1/5] toshiba_acpi: Clean file according to coding style

This patch simply cleans the the driver out of 2 errors and 17
warnings according to "checkpatch -f", no functionality was changed,
simply a cleanup.

Signed-off-by: Azael Avalos <[email protected]>
---
drivers/platform/x86/toshiba_acpi.c | 38 ++++++++++++++++++++++---------------
1 file changed, 23 insertions(+), 15 deletions(-)

diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
index 52e4647..016d7ab 100644
--- a/drivers/platform/x86/toshiba_acpi.c
+++ b/drivers/platform/x86/toshiba_acpi.c
@@ -57,7 +57,7 @@
#include <linux/i8042.h>
#include <linux/acpi.h>
#include <linux/dmi.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>

MODULE_AUTHOR("John Belmonte");
MODULE_DESCRIPTION("Toshiba Laptop ACPI Extras Driver");
@@ -288,7 +288,7 @@ static const struct key_entry toshiba_acpi_alt_keymap[] = {
/* utility
*/

-static __inline__ void _set_bit(u32 * word, u32 mask, int value)
+static inline void _set_bit(u32 *word, u32 mask, int value)
{
*word = (*word & ~mask) | (mask * value);
}
@@ -331,9 +331,8 @@ static acpi_status tci_raw(struct toshiba_acpi_dev *dev,
(char *)dev->method_hci, &params,
&results);
if ((status == AE_OK) && (out_objs->package.count <= TCI_WORDS)) {
- for (i = 0; i < out_objs->package.count; ++i) {
+ for (i = 0; i < out_objs->package.count; ++i)
out[i] = out_objs->package.elements[i].integer.value;
- }
}

return status;
@@ -359,6 +358,7 @@ static u32 hci_read1(struct toshiba_acpi_dev *dev, u32 reg, u32 *out1)
u32 in[TCI_WORDS] = { HCI_GET, reg, 0, 0, 0, 0 };
u32 out[TCI_WORDS];
acpi_status status = tci_raw(dev, in, out);
+
if (ACPI_FAILURE(status))
return TOS_FAILURE;

@@ -376,11 +376,13 @@ static u32 hci_write2(struct toshiba_acpi_dev *dev, u32 reg, u32 in1, u32 in2)
return ACPI_SUCCESS(status) ? out[0] : TOS_FAILURE;
}

-static u32 hci_read2(struct toshiba_acpi_dev *dev, u32 reg, u32 *out1, u32 *out2)
+static u32 hci_read2(struct toshiba_acpi_dev *dev,
+ u32 reg, u32 *out1, u32 *out2)
{
u32 in[TCI_WORDS] = { HCI_GET, reg, *out1, *out2, 0, 0 };
u32 out[TCI_WORDS];
acpi_status status = tci_raw(dev, in, out);
+
if (ACPI_FAILURE(status))
return TOS_FAILURE;

@@ -455,6 +457,7 @@ static u32 sci_read(struct toshiba_acpi_dev *dev, u32 reg, u32 *out1)
u32 in[TCI_WORDS] = { SCI_GET, reg, 0, 0, 0, 0 };
u32 out[TCI_WORDS];
acpi_status status = tci_raw(dev, in, out);
+
if (ACPI_FAILURE(status))
return TOS_FAILURE;

@@ -713,7 +716,8 @@ static int toshiba_eco_mode_available(struct toshiba_acpi_dev *dev)
return 1;
}

-static enum led_brightness toshiba_eco_mode_get_status(struct led_classdev *cdev)
+static enum led_brightness
+toshiba_eco_mode_get_status(struct led_classdev *cdev)
{
struct toshiba_acpi_dev *dev = container_of(cdev,
struct toshiba_acpi_dev, eco_led);
@@ -1235,7 +1239,7 @@ static int set_tr_backlight_status(struct toshiba_acpi_dev *dev, bool enable)
return hci_result == TOS_SUCCESS ? 0 : -EIO;
}

-static struct proc_dir_entry *toshiba_proc_dir /*= 0*/ ;
+static struct proc_dir_entry *toshiba_proc_dir /*= 0*/;

static int __get_lcd_brightness(struct toshiba_acpi_dev *dev)
{
@@ -1246,6 +1250,7 @@ static int __get_lcd_brightness(struct toshiba_acpi_dev *dev)
if (dev->tr_backlight_supported) {
bool enabled;
int ret = get_tr_backlight_status(dev, &enabled);
+
if (ret)
return ret;
if (enabled)
@@ -1263,6 +1268,7 @@ static int __get_lcd_brightness(struct toshiba_acpi_dev *dev)
static int get_lcd_brightness(struct backlight_device *bd)
{
struct toshiba_acpi_dev *dev = bl_get_data(bd);
+
return __get_lcd_brightness(dev);
}

@@ -1299,6 +1305,7 @@ static int set_lcd_brightness(struct toshiba_acpi_dev *dev, int value)
if (dev->tr_backlight_supported) {
bool enable = !value;
int ret = set_tr_backlight_status(dev, enable);
+
if (ret)
return ret;
if (value)
@@ -1313,6 +1320,7 @@ static int set_lcd_brightness(struct toshiba_acpi_dev *dev, int value)
static int set_lcd_status(struct backlight_device *bd)
{
struct toshiba_acpi_dev *dev = bl_get_data(bd);
+
return set_lcd_brightness(dev, bd->props.brightness);
}

@@ -1370,6 +1378,7 @@ static int video_proc_show(struct seq_file *m, void *v)
int is_lcd = (value & HCI_VIDEO_OUT_LCD) ? 1 : 0;
int is_crt = (value & HCI_VIDEO_OUT_CRT) ? 1 : 0;
int is_tv = (value & HCI_VIDEO_OUT_TV) ? 1 : 0;
+
seq_printf(m, "lcd_out: %d\n", is_lcd);
seq_printf(m, "crt_out: %d\n", is_crt);
seq_printf(m, "tv_out: %d\n", is_tv);
@@ -1422,8 +1431,7 @@ static ssize_t video_proc_write(struct file *file, const char __user *buf,
do {
++buffer;
--remain;
- }
- while (remain && *(buffer - 1) != ';');
+ } while (remain && *(buffer - 1) != ';');
}

kfree(cmd);
@@ -1431,6 +1439,7 @@ static ssize_t video_proc_write(struct file *file, const char __user *buf,
ret = get_video_status(dev, &video_out);
if (!ret) {
unsigned int new_video_out = video_out;
+
if (lcd_out != -1)
_set_bit(&new_video_out, HCI_VIDEO_OUT_LCD, lcd_out);
if (crt_out != -1)
@@ -1500,10 +1509,10 @@ static ssize_t fan_proc_write(struct file *file, const char __user *buf,
if (sscanf(cmd, " force_on : %i", &value) == 1 &&
value >= 0 && value <= 1) {
hci_result = hci_write1(dev, HCI_FAN, value);
- if (hci_result != TOS_SUCCESS)
- return -EIO;
- else
+ if (hci_result == TOS_SUCCESS)
dev->force_fan = value;
+ else
+ return -EIO;
} else {
return -EINVAL;
}
@@ -1568,11 +1577,10 @@ static ssize_t keys_proc_write(struct file *file, const char __user *buf,
return -EFAULT;
cmd[len] = '\0';

- if (sscanf(cmd, " hotkey_ready : %i", &value) == 1 && value == 0) {
+ if (sscanf(cmd, " hotkey_ready : %i", &value) == 1 && value == 0)
dev->key_event_valid = 0;
- } else {
+ else
return -EINVAL;
- }

return count;
}
--
2.2.2

2015-02-11 06:45:41

by Azael Avalos

[permalink] [raw]
Subject: [PATCH 2/5] Documentation/ABI: Add file describing the sysfs entries for toshiba_acpi

This patch adds a new file describing the sysfs entries for the
toshiba_acpi driver.

Signed-off-by: Azael Avalos <[email protected]>
---
.../ABI/testing/sysfs-driver-toshiba_acpi | 114 +++++++++++++++++++++
1 file changed, 114 insertions(+)
create mode 100644 Documentation/ABI/testing/sysfs-driver-toshiba_acpi

diff --git a/Documentation/ABI/testing/sysfs-driver-toshiba_acpi b/Documentation/ABI/testing/sysfs-driver-toshiba_acpi
new file mode 100644
index 0000000..ca9c71a
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-driver-toshiba_acpi
@@ -0,0 +1,114 @@
+What: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/TOS{1900,620{0,7,8}}:00/kbd_backlight_mode
+Date: June 8, 2014
+KernelVersion: 3.15
+Contact: Azael Avalos <[email protected]>
+Description: This file controls the keyboard backlight operation mode, valid
+ values are:
+ * 0x1 -> FN-Z
+ * 0x2 -> AUTO (also called TIMER)
+ * 0x8 -> ON
+ * 0x10 -> OFF
+ Note that the kernel 3.16 onwards this file accepts all listed
+ parameters, kernel 3.15 only accepts the first two (FN-Z and
+ AUTO).
+Users: KToshiba
+
+What: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/TOS{1900,620{0,7,8}}:00/kbd_backlight_timeout
+Date: June 8, 2014
+KernelVersion: 3.15
+Contact: Azael Avalos <[email protected]>
+Description: This file controls the timeout of the keyboard backlight
+ whenever the operation mode is set to AUTO (or TIMER),
+ valid values range from 0-60.
+ Note that the kernel 3.15 only had support for the first
+ keyboard type, the kernel 3.16 added support for the second
+ type and the range accepted for type 2 is 1-60.
+ See the entry named "kbd_type"
+Users: KToshiba
+
+What: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/TOS{1900,620{0,7,8}}:00/position
+Date: June 8, 2014
+KernelVersion: 3.15
+Contact: Azael Avalos <[email protected]>
+Description: This file shows the absolute position of the built-in
+ accelereometer.
+
+What: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/TOS{1900,620{0,7,8}}:00/touchpad
+Date: June 8, 2014
+KernelVersion: 3.15
+Contact: Azael Avalos <[email protected]>
+Description: This files controls the status of the touchpad and pointing
+ stick (if available), valid values are:
+ * 0 -> OFF
+ * 1 -> ON
+Users: KToshiba
+
+What: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/TOS{1900,620{0,7,8}}:00/available_kbd_modes
+Date: August 3, 2014
+KernelVersion: 3.16
+Contact: Azael Avalos <[email protected]>
+Description: This file shows the supported keyboard backlight modes
+ the system supports, which can be:
+ * 0x1 -> FN-Z
+ * 0x2 -> AUTO (also called TIMER)
+ * 0x8 -> ON
+ * 0x10 -> OFF
+ Note that not all keyboard types support the listed modes.
+ See the entry named "available_kbd_modes"
+Users: KToshiba
+
+What: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/TOS{1900,620{0,7,8}}:00/kbd_type
+Date: August 3, 2014
+KernelVersion: 3.16
+Contact: Azael Avalos <[email protected]>
+Description: This file shows the current keyboard backlight type,
+ which can be:
+ * 1 -> Type 1, supporting modes FN-Z and AUTO
+ * 2 -> Type 2, supporting modes TIMER, ON and OFF
+Users: KToshiba
+
+What: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/TOS{1900,620{0,7,8}}:00/version
+Date: February, 2015
+KernelVersion: 3.20
+Contact: Azael Avalos <[email protected]>
+Description: This file shows the current version of the driver
+
+What: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/TOS{1900,620{0,7,8}}:00/fan
+Date: February, 2015
+KernelVersion: 3.20
+Contact: Azael Avalos <[email protected]>
+Description: This file controls the state of the internal fan, valid
+ values are:
+ * 0 -> OFF
+ * 1 -> ON
+
+What: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/TOS{1900,620{0,7,8}}:00/kbd_function_keys
+Date: February, 2015
+KernelVersion: 3.20
+Contact: Azael Avalos <[email protected]>
+Description: This file controls the Special Functions (hotkeys) operation
+ mode, valid values are:
+ * 0 -> Normal Operation
+ * 1 -> Special Functions
+ In the "Normal Operation" mode, the F{1-12} keys are as usual
+ and the hotkeys are accessed via FN-F{1-12}.
+ In the "Special Functions" mode, the F{1-12} keys trigger the
+ hotkey and the F{1-12} keys are accessed via FN-F{1-12}.
+
+What: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/TOS{1900,620{0,7,8}}:00/panel_power_on
+Date: February, 2015
+KernelVersion: 3.20
+Contact: Azael Avalos <[email protected]>
+Description: This file controls whether the laptop should turn ON whenever
+ the LID is opened, valid values are:
+ * 0 -> Disabled
+ * 1 -> Enabled
+
+What: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/TOS{1900,620{0,7,8}}:00/usb_three
+Date: February, 2015
+KernelVersion: 3.20
+Contact: Azael Avalos <[email protected]>
+Description: This file controls whether the USB 3 functionality, valid
+ values are:
+ * 0 -> Disabled (Acts as a regular USB 2)
+ * 1 -> Enabled (Full USB 3 functionality)
--
2.2.2

2015-02-11 06:44:13

by Azael Avalos

[permalink] [raw]
Subject: [PATCH 3/5] toshiba_acpi: Move sysfs function and struct declarations further down

Commit 93f8c16d635e ("toshiba_acpi: Support new keyboard backlight
type") moved all the sysfs structs and function declarations further
up in order to make use of sysfs_update_group, however,
commit 805469053ba9 ("toshiba_acpi: Add keyboard backlight mode
change event") made use of that function unnecesary.

This patch moves all the sysfs structs and function declarations
further down, making the file shorther in lines and better readable.

Signed-off-by: Azael Avalos <[email protected]>
---
drivers/platform/x86/toshiba_acpi.c | 196 +++++++++++-------------------------
1 file changed, 58 insertions(+), 138 deletions(-)

diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
index 016d7ab..818d184 100644
--- a/drivers/platform/x86/toshiba_acpi.c
+++ b/drivers/platform/x86/toshiba_acpi.c
@@ -1660,144 +1660,6 @@ static const struct backlight_ops toshiba_backlight_data = {
* Sysfs files
*/
static ssize_t toshiba_version_show(struct device *dev,
- struct device_attribute *attr, char *buf);
-static ssize_t toshiba_fan_store(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count);
-static ssize_t toshiba_fan_show(struct device *dev,
- struct device_attribute *attr, char *buf);
-static ssize_t toshiba_kbd_bl_mode_store(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count);
-static ssize_t toshiba_kbd_bl_mode_show(struct device *dev,
- struct device_attribute *attr,
- char *buf);
-static ssize_t toshiba_kbd_type_show(struct device *dev,
- struct device_attribute *attr,
- char *buf);
-static ssize_t toshiba_available_kbd_modes_show(struct device *dev,
- struct device_attribute *attr,
- char *buf);
-static ssize_t toshiba_kbd_bl_timeout_store(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count);
-static ssize_t toshiba_kbd_bl_timeout_show(struct device *dev,
- struct device_attribute *attr,
- char *buf);
-static ssize_t toshiba_touchpad_store(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count);
-static ssize_t toshiba_touchpad_show(struct device *dev,
- struct device_attribute *attr,
- char *buf);
-static ssize_t toshiba_position_show(struct device *dev,
- struct device_attribute *attr,
- char *buf);
-static ssize_t toshiba_usb_sleep_charge_show(struct device *dev,
- struct device_attribute *attr,
- char *buf);
-static ssize_t toshiba_usb_sleep_charge_store(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count);
-static ssize_t sleep_functions_on_battery_show(struct device *dev,
- struct device_attribute *attr,
- char *buf);
-static ssize_t sleep_functions_on_battery_store(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count);
-static ssize_t toshiba_usb_rapid_charge_show(struct device *dev,
- struct device_attribute *attr,
- char *buf);
-static ssize_t toshiba_usb_rapid_charge_store(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count);
-static ssize_t toshiba_usb_sleep_music_show(struct device *dev,
- struct device_attribute *attr,
- char *buf);
-static ssize_t toshiba_usb_sleep_music_store(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count);
-static ssize_t toshiba_kbd_function_keys_show(struct device *dev,
- struct device_attribute *attr,
- char *buf);
-static ssize_t toshiba_kbd_function_keys_store(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count);
-static ssize_t toshiba_panel_power_on_show(struct device *dev,
- struct device_attribute *attr,
- char *buf);
-static ssize_t toshiba_panel_power_on_store(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count);
-static ssize_t toshiba_usb_three_show(struct device *dev,
- struct device_attribute *attr,
- char *buf);
-static ssize_t toshiba_usb_three_store(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count);
-
-static DEVICE_ATTR(version, S_IRUGO, toshiba_version_show, NULL);
-static DEVICE_ATTR(fan, S_IRUGO | S_IWUSR,
- toshiba_fan_show, toshiba_fan_store);
-static DEVICE_ATTR(kbd_backlight_mode, S_IRUGO | S_IWUSR,
- toshiba_kbd_bl_mode_show, toshiba_kbd_bl_mode_store);
-static DEVICE_ATTR(kbd_type, S_IRUGO, toshiba_kbd_type_show, NULL);
-static DEVICE_ATTR(available_kbd_modes, S_IRUGO,
- toshiba_available_kbd_modes_show, NULL);
-static DEVICE_ATTR(kbd_backlight_timeout, S_IRUGO | S_IWUSR,
- toshiba_kbd_bl_timeout_show, toshiba_kbd_bl_timeout_store);
-static DEVICE_ATTR(touchpad, S_IRUGO | S_IWUSR,
- toshiba_touchpad_show, toshiba_touchpad_store);
-static DEVICE_ATTR(position, S_IRUGO, toshiba_position_show, NULL);
-static DEVICE_ATTR(usb_sleep_charge, S_IRUGO | S_IWUSR,
- toshiba_usb_sleep_charge_show,
- toshiba_usb_sleep_charge_store);
-static DEVICE_ATTR(sleep_functions_on_battery, S_IRUGO | S_IWUSR,
- sleep_functions_on_battery_show,
- sleep_functions_on_battery_store);
-static DEVICE_ATTR(usb_rapid_charge, S_IRUGO | S_IWUSR,
- toshiba_usb_rapid_charge_show,
- toshiba_usb_rapid_charge_store);
-static DEVICE_ATTR(usb_sleep_music, S_IRUGO | S_IWUSR,
- toshiba_usb_sleep_music_show,
- toshiba_usb_sleep_music_store);
-static DEVICE_ATTR(kbd_function_keys, S_IRUGO | S_IWUSR,
- toshiba_kbd_function_keys_show,
- toshiba_kbd_function_keys_store);
-static DEVICE_ATTR(panel_power_on, S_IRUGO | S_IWUSR,
- toshiba_panel_power_on_show,
- toshiba_panel_power_on_store);
-static DEVICE_ATTR(usb_three, S_IRUGO | S_IWUSR,
- toshiba_usb_three_show, toshiba_usb_three_store);
-
-static struct attribute *toshiba_attributes[] = {
- &dev_attr_version.attr,
- &dev_attr_fan.attr,
- &dev_attr_kbd_backlight_mode.attr,
- &dev_attr_kbd_type.attr,
- &dev_attr_available_kbd_modes.attr,
- &dev_attr_kbd_backlight_timeout.attr,
- &dev_attr_touchpad.attr,
- &dev_attr_position.attr,
- &dev_attr_usb_sleep_charge.attr,
- &dev_attr_sleep_functions_on_battery.attr,
- &dev_attr_usb_rapid_charge.attr,
- &dev_attr_usb_sleep_music.attr,
- &dev_attr_kbd_function_keys.attr,
- &dev_attr_panel_power_on.attr,
- &dev_attr_usb_three.attr,
- NULL,
-};
-
-static umode_t toshiba_sysfs_is_visible(struct kobject *,
- struct attribute *, int);
-
-static struct attribute_group toshiba_attr_group = {
- .is_visible = toshiba_sysfs_is_visible,
- .attrs = toshiba_attributes,
-};
-
-static ssize_t toshiba_version_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
return sprintf(buf, "%s\n", TOSHIBA_ACPI_VERSION);
@@ -2353,6 +2215,59 @@ static ssize_t toshiba_usb_three_store(struct device *dev,
return count;
}

+static DEVICE_ATTR(version, S_IRUGO, toshiba_version_show, NULL);
+static DEVICE_ATTR(fan, S_IRUGO | S_IWUSR,
+ toshiba_fan_show, toshiba_fan_store);
+static DEVICE_ATTR(kbd_backlight_mode, S_IRUGO | S_IWUSR,
+ toshiba_kbd_bl_mode_show, toshiba_kbd_bl_mode_store);
+static DEVICE_ATTR(kbd_type, S_IRUGO, toshiba_kbd_type_show, NULL);
+static DEVICE_ATTR(available_kbd_modes, S_IRUGO,
+ toshiba_available_kbd_modes_show, NULL);
+static DEVICE_ATTR(kbd_backlight_timeout, S_IRUGO | S_IWUSR,
+ toshiba_kbd_bl_timeout_show, toshiba_kbd_bl_timeout_store);
+static DEVICE_ATTR(touchpad, S_IRUGO | S_IWUSR,
+ toshiba_touchpad_show, toshiba_touchpad_store);
+static DEVICE_ATTR(position, S_IRUGO, toshiba_position_show, NULL);
+static DEVICE_ATTR(usb_sleep_charge, S_IRUGO | S_IWUSR,
+ toshiba_usb_sleep_charge_show,
+ toshiba_usb_sleep_charge_store);
+static DEVICE_ATTR(sleep_functions_on_battery, S_IRUGO | S_IWUSR,
+ sleep_functions_on_battery_show,
+ sleep_functions_on_battery_store);
+static DEVICE_ATTR(usb_rapid_charge, S_IRUGO | S_IWUSR,
+ toshiba_usb_rapid_charge_show,
+ toshiba_usb_rapid_charge_store);
+static DEVICE_ATTR(usb_sleep_music, S_IRUGO | S_IWUSR,
+ toshiba_usb_sleep_music_show,
+ toshiba_usb_sleep_music_store);
+static DEVICE_ATTR(kbd_function_keys, S_IRUGO | S_IWUSR,
+ toshiba_kbd_function_keys_show,
+ toshiba_kbd_function_keys_store);
+static DEVICE_ATTR(panel_power_on, S_IRUGO | S_IWUSR,
+ toshiba_panel_power_on_show,
+ toshiba_panel_power_on_store);
+static DEVICE_ATTR(usb_three, S_IRUGO | S_IWUSR,
+ toshiba_usb_three_show, toshiba_usb_three_store);
+
+static struct attribute *toshiba_attributes[] = {
+ &dev_attr_version.attr,
+ &dev_attr_fan.attr,
+ &dev_attr_kbd_backlight_mode.attr,
+ &dev_attr_kbd_type.attr,
+ &dev_attr_available_kbd_modes.attr,
+ &dev_attr_kbd_backlight_timeout.attr,
+ &dev_attr_touchpad.attr,
+ &dev_attr_position.attr,
+ &dev_attr_usb_sleep_charge.attr,
+ &dev_attr_sleep_functions_on_battery.attr,
+ &dev_attr_usb_rapid_charge.attr,
+ &dev_attr_usb_sleep_music.attr,
+ &dev_attr_kbd_function_keys.attr,
+ &dev_attr_panel_power_on.attr,
+ &dev_attr_usb_three.attr,
+ NULL,
+};
+
static umode_t toshiba_sysfs_is_visible(struct kobject *kobj,
struct attribute *attr, int idx)
{
@@ -2388,6 +2303,11 @@ static umode_t toshiba_sysfs_is_visible(struct kobject *kobj,
return exists ? attr->mode : 0;
}

+static struct attribute_group toshiba_attr_group = {
+ .is_visible = toshiba_sysfs_is_visible,
+ .attrs = toshiba_attributes,
+};
+
/*
* Hotkeys
*/
--
2.2.2

2015-02-11 06:44:15

by Azael Avalos

[permalink] [raw]
Subject: [PATCH 4/5] toshiba_acpi: Drop the toshiba_ prefix from sysfs function names

This patch removes the toshiba_ prefix from all the sysfs function
names and adapted the code according to coding style.

Also a few functions were renamed to match the sysfs entry, as this
patch is a preparation for the next patch to switch to
DEVICE_ATTR_{RO, RW, WO} macros.

Signed-off-by: Azael Avalos <[email protected]>
---
drivers/platform/x86/toshiba_acpi.c | 166 +++++++++++++++++-------------------
1 file changed, 76 insertions(+), 90 deletions(-)

diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
index 818d184..0b5614c 100644
--- a/drivers/platform/x86/toshiba_acpi.c
+++ b/drivers/platform/x86/toshiba_acpi.c
@@ -1659,15 +1659,15 @@ static const struct backlight_ops toshiba_backlight_data = {
/*
* Sysfs files
*/
-static ssize_t toshiba_version_show(struct device *dev,
- struct device_attribute *attr, char *buf)
+static ssize_t version_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
{
return sprintf(buf, "%s\n", TOSHIBA_ACPI_VERSION);
}

-static ssize_t toshiba_fan_store(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count)
+static ssize_t fan_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
{
struct toshiba_acpi_dev *toshiba = dev_get_drvdata(dev);
u32 result;
@@ -1690,8 +1690,8 @@ static ssize_t toshiba_fan_store(struct device *dev,
return count;
}

-static ssize_t toshiba_fan_show(struct device *dev,
- struct device_attribute *attr, char *buf)
+static ssize_t fan_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
{
struct toshiba_acpi_dev *toshiba = dev_get_drvdata(dev);
u32 value;
@@ -1704,9 +1704,9 @@ static ssize_t toshiba_fan_show(struct device *dev,
return sprintf(buf, "%d\n", value);
}

-static ssize_t toshiba_kbd_bl_mode_store(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count)
+static ssize_t kbd_backlight_mode_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
{
struct toshiba_acpi_dev *toshiba = dev_get_drvdata(dev);
int mode;
@@ -1761,9 +1761,9 @@ static ssize_t toshiba_kbd_bl_mode_store(struct device *dev,
return count;
}

-static ssize_t toshiba_kbd_bl_mode_show(struct device *dev,
- struct device_attribute *attr,
- char *buf)
+static ssize_t kbd_backlight_mode_show(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
{
struct toshiba_acpi_dev *toshiba = dev_get_drvdata(dev);
u32 time;
@@ -1774,18 +1774,17 @@ static ssize_t toshiba_kbd_bl_mode_show(struct device *dev,
return sprintf(buf, "%i\n", time & SCI_KBD_MODE_MASK);
}

-static ssize_t toshiba_kbd_type_show(struct device *dev,
- struct device_attribute *attr,
- char *buf)
+static ssize_t kbd_type_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
{
struct toshiba_acpi_dev *toshiba = dev_get_drvdata(dev);

return sprintf(buf, "%d\n", toshiba->kbd_type);
}

-static ssize_t toshiba_available_kbd_modes_show(struct device *dev,
- struct device_attribute *attr,
- char *buf)
+static ssize_t available_kbd_modes_show(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
{
struct toshiba_acpi_dev *toshiba = dev_get_drvdata(dev);

@@ -1797,9 +1796,9 @@ static ssize_t toshiba_available_kbd_modes_show(struct device *dev,
SCI_KBD_MODE_AUTO, SCI_KBD_MODE_ON, SCI_KBD_MODE_OFF);
}

-static ssize_t toshiba_kbd_bl_timeout_store(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count)
+static ssize_t kbd_backlight_timeout_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
{
struct toshiba_acpi_dev *toshiba = dev_get_drvdata(dev);
int time;
@@ -1840,9 +1839,9 @@ static ssize_t toshiba_kbd_bl_timeout_store(struct device *dev,
return count;
}

-static ssize_t toshiba_kbd_bl_timeout_show(struct device *dev,
- struct device_attribute *attr,
- char *buf)
+static ssize_t kbd_backlight_timeout_show(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
{
struct toshiba_acpi_dev *toshiba = dev_get_drvdata(dev);
u32 time;
@@ -1853,9 +1852,9 @@ static ssize_t toshiba_kbd_bl_timeout_show(struct device *dev,
return sprintf(buf, "%i\n", time >> HCI_MISC_SHIFT);
}

-static ssize_t toshiba_touchpad_store(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count)
+static ssize_t touchpad_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
{
struct toshiba_acpi_dev *toshiba = dev_get_drvdata(dev);
int state;
@@ -1875,8 +1874,8 @@ static ssize_t toshiba_touchpad_store(struct device *dev,
return count;
}

-static ssize_t toshiba_touchpad_show(struct device *dev,
- struct device_attribute *attr, char *buf)
+static ssize_t touchpad_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
{
struct toshiba_acpi_dev *toshiba = dev_get_drvdata(dev);
u32 state;
@@ -1889,8 +1888,8 @@ static ssize_t toshiba_touchpad_show(struct device *dev,
return sprintf(buf, "%i\n", state);
}

-static ssize_t toshiba_position_show(struct device *dev,
- struct device_attribute *attr, char *buf)
+static ssize_t position_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
{
struct toshiba_acpi_dev *toshiba = dev_get_drvdata(dev);
u32 xyval, zval, tmp;
@@ -1910,9 +1909,8 @@ static ssize_t toshiba_position_show(struct device *dev,
return sprintf(buf, "%d %d %d\n", x, y, z);
}

-static ssize_t toshiba_usb_sleep_charge_show(struct device *dev,
- struct device_attribute *attr,
- char *buf)
+static ssize_t usb_sleep_charge_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
{
struct toshiba_acpi_dev *toshiba = dev_get_drvdata(dev);
u32 mode;
@@ -1925,9 +1923,9 @@ static ssize_t toshiba_usb_sleep_charge_show(struct device *dev,
return sprintf(buf, "%x\n", mode & SCI_USB_CHARGE_MODE_MASK);
}

-static ssize_t toshiba_usb_sleep_charge_store(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count)
+static ssize_t usb_sleep_charge_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
{
struct toshiba_acpi_dev *toshiba = dev_get_drvdata(dev);
u32 mode;
@@ -2021,9 +2019,8 @@ static ssize_t sleep_functions_on_battery_store(struct device *dev,
return count;
}

-static ssize_t toshiba_usb_rapid_charge_show(struct device *dev,
- struct device_attribute *attr,
- char *buf)
+static ssize_t usb_rapid_charge_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
{
struct toshiba_acpi_dev *toshiba = dev_get_drvdata(dev);
u32 state;
@@ -2036,9 +2033,9 @@ static ssize_t toshiba_usb_rapid_charge_show(struct device *dev,
return sprintf(buf, "%d\n", state);
}

-static ssize_t toshiba_usb_rapid_charge_store(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count)
+static ssize_t usb_rapid_charge_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
{
struct toshiba_acpi_dev *toshiba = dev_get_drvdata(dev);
int state;
@@ -2057,9 +2054,8 @@ static ssize_t toshiba_usb_rapid_charge_store(struct device *dev,
return count;
}

-static ssize_t toshiba_usb_sleep_music_show(struct device *dev,
- struct device_attribute *attr,
- char *buf)
+static ssize_t usb_sleep_music_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
{
struct toshiba_acpi_dev *toshiba = dev_get_drvdata(dev);
u32 state;
@@ -2072,9 +2068,9 @@ static ssize_t toshiba_usb_sleep_music_show(struct device *dev,
return sprintf(buf, "%d\n", state);
}

-static ssize_t toshiba_usb_sleep_music_store(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count)
+static ssize_t usb_sleep_music_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
{
struct toshiba_acpi_dev *toshiba = dev_get_drvdata(dev);
int state;
@@ -2093,9 +2089,8 @@ static ssize_t toshiba_usb_sleep_music_store(struct device *dev,
return count;
}

-static ssize_t toshiba_kbd_function_keys_show(struct device *dev,
- struct device_attribute *attr,
- char *buf)
+static ssize_t kbd_function_keys_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
{
struct toshiba_acpi_dev *toshiba = dev_get_drvdata(dev);
int mode;
@@ -2108,9 +2103,9 @@ static ssize_t toshiba_kbd_function_keys_show(struct device *dev,
return sprintf(buf, "%d\n", mode);
}

-static ssize_t toshiba_kbd_function_keys_store(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count)
+static ssize_t kbd_function_keys_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
{
struct toshiba_acpi_dev *toshiba = dev_get_drvdata(dev);
int mode;
@@ -2135,9 +2130,8 @@ static ssize_t toshiba_kbd_function_keys_store(struct device *dev,
return count;
}

-static ssize_t toshiba_panel_power_on_show(struct device *dev,
- struct device_attribute *attr,
- char *buf)
+static ssize_t panel_power_on_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
{
struct toshiba_acpi_dev *toshiba = dev_get_drvdata(dev);
u32 state;
@@ -2150,9 +2144,9 @@ static ssize_t toshiba_panel_power_on_show(struct device *dev,
return sprintf(buf, "%d\n", state);
}

-static ssize_t toshiba_panel_power_on_store(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count)
+static ssize_t panel_power_on_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
{
struct toshiba_acpi_dev *toshiba = dev_get_drvdata(dev);
int state;
@@ -2173,9 +2167,8 @@ static ssize_t toshiba_panel_power_on_store(struct device *dev,
return count;
}

-static ssize_t toshiba_usb_three_show(struct device *dev,
- struct device_attribute *attr,
- char *buf)
+static ssize_t usb_three_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
{
struct toshiba_acpi_dev *toshiba = dev_get_drvdata(dev);
u32 state;
@@ -2188,9 +2181,9 @@ static ssize_t toshiba_usb_three_show(struct device *dev,
return sprintf(buf, "%d\n", state);
}

-static ssize_t toshiba_usb_three_store(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count)
+static ssize_t usb_three_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
{
struct toshiba_acpi_dev *toshiba = dev_get_drvdata(dev);
int state;
@@ -2215,39 +2208,32 @@ static ssize_t toshiba_usb_three_store(struct device *dev,
return count;
}

-static DEVICE_ATTR(version, S_IRUGO, toshiba_version_show, NULL);
-static DEVICE_ATTR(fan, S_IRUGO | S_IWUSR,
- toshiba_fan_show, toshiba_fan_store);
+static DEVICE_ATTR(version, S_IRUGO, version_show, NULL);
+static DEVICE_ATTR(fan, S_IRUGO | S_IWUSR, fan_show, fan_store);
static DEVICE_ATTR(kbd_backlight_mode, S_IRUGO | S_IWUSR,
- toshiba_kbd_bl_mode_show, toshiba_kbd_bl_mode_store);
-static DEVICE_ATTR(kbd_type, S_IRUGO, toshiba_kbd_type_show, NULL);
-static DEVICE_ATTR(available_kbd_modes, S_IRUGO,
- toshiba_available_kbd_modes_show, NULL);
+ kbd_backlight_mode_show, kbd_backlight_mode_store);
+static DEVICE_ATTR(kbd_type, S_IRUGO, kbd_type_show, NULL);
+static DEVICE_ATTR(available_kbd_modes, S_IRUGO,
+ available_kbd_modes_show, NULL);
static DEVICE_ATTR(kbd_backlight_timeout, S_IRUGO | S_IWUSR,
- toshiba_kbd_bl_timeout_show, toshiba_kbd_bl_timeout_store);
-static DEVICE_ATTR(touchpad, S_IRUGO | S_IWUSR,
- toshiba_touchpad_show, toshiba_touchpad_store);
-static DEVICE_ATTR(position, S_IRUGO, toshiba_position_show, NULL);
+ kbd_backlight_timeout_show, kbd_backlight_timeout_store);
+static DEVICE_ATTR(touchpad, S_IRUGO | S_IWUSR, touchpad_show, touchpad_store);
+static DEVICE_ATTR(position, S_IRUGO, position_show, NULL);
static DEVICE_ATTR(usb_sleep_charge, S_IRUGO | S_IWUSR,
- toshiba_usb_sleep_charge_show,
- toshiba_usb_sleep_charge_store);
+ usb_sleep_charge_show, usb_sleep_charge_store);
static DEVICE_ATTR(sleep_functions_on_battery, S_IRUGO | S_IWUSR,
sleep_functions_on_battery_show,
sleep_functions_on_battery_store);
static DEVICE_ATTR(usb_rapid_charge, S_IRUGO | S_IWUSR,
- toshiba_usb_rapid_charge_show,
- toshiba_usb_rapid_charge_store);
+ usb_rapid_charge_show, usb_rapid_charge_store);
static DEVICE_ATTR(usb_sleep_music, S_IRUGO | S_IWUSR,
- toshiba_usb_sleep_music_show,
- toshiba_usb_sleep_music_store);
+ usb_sleep_music_show, usb_sleep_music_store);
static DEVICE_ATTR(kbd_function_keys, S_IRUGO | S_IWUSR,
- toshiba_kbd_function_keys_show,
- toshiba_kbd_function_keys_store);
+ kbd_function_keys_show, kbd_function_keys_store);
static DEVICE_ATTR(panel_power_on, S_IRUGO | S_IWUSR,
- toshiba_panel_power_on_show,
- toshiba_panel_power_on_store);
+ panel_power_on_show, panel_power_on_store);
static DEVICE_ATTR(usb_three, S_IRUGO | S_IWUSR,
- toshiba_usb_three_show, toshiba_usb_three_store);
+ usb_three_show, usb_three_store);

static struct attribute *toshiba_attributes[] = {
&dev_attr_version.attr,
--
2.2.2

2015-02-11 06:44:38

by Azael Avalos

[permalink] [raw]
Subject: [PATCH 5/5] toshiba_acpi: Make use of DEVICE_ATTR_{RO, RW} macros

This patch makes use of the DEVICE_ATTR_{RO, RW} macros to simplify
sysfs attributes declarations.

Signed-off-by: Azael Avalos <[email protected]>
---
drivers/platform/x86/toshiba_acpi.c | 42 +++++++++++++------------------------
1 file changed, 15 insertions(+), 27 deletions(-)

diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
index 0b5614c..eea3447 100644
--- a/drivers/platform/x86/toshiba_acpi.c
+++ b/drivers/platform/x86/toshiba_acpi.c
@@ -1664,6 +1664,7 @@ static ssize_t version_show(struct device *dev,
{
return sprintf(buf, "%s\n", TOSHIBA_ACPI_VERSION);
}
+static DEVICE_ATTR_RO(version);

static ssize_t fan_store(struct device *dev,
struct device_attribute *attr,
@@ -1703,6 +1704,7 @@ static ssize_t fan_show(struct device *dev,

return sprintf(buf, "%d\n", value);
}
+static DEVICE_ATTR_RW(fan);

static ssize_t kbd_backlight_mode_store(struct device *dev,
struct device_attribute *attr,
@@ -1773,6 +1775,7 @@ static ssize_t kbd_backlight_mode_show(struct device *dev,

return sprintf(buf, "%i\n", time & SCI_KBD_MODE_MASK);
}
+static DEVICE_ATTR_RW(kbd_backlight_mode);

static ssize_t kbd_type_show(struct device *dev,
struct device_attribute *attr, char *buf)
@@ -1781,6 +1784,7 @@ static ssize_t kbd_type_show(struct device *dev,

return sprintf(buf, "%d\n", toshiba->kbd_type);
}
+static DEVICE_ATTR_RO(kbd_type);

static ssize_t available_kbd_modes_show(struct device *dev,
struct device_attribute *attr,
@@ -1795,6 +1799,7 @@ static ssize_t available_kbd_modes_show(struct device *dev,
return sprintf(buf, "%x %x %x\n",
SCI_KBD_MODE_AUTO, SCI_KBD_MODE_ON, SCI_KBD_MODE_OFF);
}
+static DEVICE_ATTR_RO(available_kbd_modes);

static ssize_t kbd_backlight_timeout_store(struct device *dev,
struct device_attribute *attr,
@@ -1851,6 +1856,7 @@ static ssize_t kbd_backlight_timeout_show(struct device *dev,

return sprintf(buf, "%i\n", time >> HCI_MISC_SHIFT);
}
+static DEVICE_ATTR_RW(kbd_backlight_timeout);

static ssize_t touchpad_store(struct device *dev,
struct device_attribute *attr,
@@ -1887,6 +1893,7 @@ static ssize_t touchpad_show(struct device *dev,

return sprintf(buf, "%i\n", state);
}
+static DEVICE_ATTR_RW(touchpad);

static ssize_t position_show(struct device *dev,
struct device_attribute *attr, char *buf)
@@ -1908,6 +1915,7 @@ static ssize_t position_show(struct device *dev,

return sprintf(buf, "%d %d %d\n", x, y, z);
}
+static DEVICE_ATTR_RO(position);

static ssize_t usb_sleep_charge_show(struct device *dev,
struct device_attribute *attr, char *buf)
@@ -1957,6 +1965,7 @@ static ssize_t usb_sleep_charge_store(struct device *dev,

return count;
}
+static DEVICE_ATTR_RW(usb_sleep_charge);

static ssize_t sleep_functions_on_battery_show(struct device *dev,
struct device_attribute *attr,
@@ -2018,6 +2027,7 @@ static ssize_t sleep_functions_on_battery_store(struct device *dev,

return count;
}
+static DEVICE_ATTR_RW(sleep_functions_on_battery);

static ssize_t usb_rapid_charge_show(struct device *dev,
struct device_attribute *attr, char *buf)
@@ -2053,6 +2063,7 @@ static ssize_t usb_rapid_charge_store(struct device *dev,

return count;
}
+static DEVICE_ATTR_RW(usb_rapid_charge);

static ssize_t usb_sleep_music_show(struct device *dev,
struct device_attribute *attr, char *buf)
@@ -2088,6 +2099,7 @@ static ssize_t usb_sleep_music_store(struct device *dev,

return count;
}
+static DEVICE_ATTR_RW(usb_sleep_music);

static ssize_t kbd_function_keys_show(struct device *dev,
struct device_attribute *attr, char *buf)
@@ -2129,6 +2141,7 @@ static ssize_t kbd_function_keys_store(struct device *dev,

return count;
}
+static DEVICE_ATTR_RW(kbd_function_keys);

static ssize_t panel_power_on_show(struct device *dev,
struct device_attribute *attr, char *buf)
@@ -2166,6 +2179,7 @@ static ssize_t panel_power_on_store(struct device *dev,

return count;
}
+static DEVICE_ATTR_RW(panel_power_on);

static ssize_t usb_three_show(struct device *dev,
struct device_attribute *attr, char *buf)
@@ -2207,33 +2221,7 @@ static ssize_t usb_three_store(struct device *dev,

return count;
}
-
-static DEVICE_ATTR(version, S_IRUGO, version_show, NULL);
-static DEVICE_ATTR(fan, S_IRUGO | S_IWUSR, fan_show, fan_store);
-static DEVICE_ATTR(kbd_backlight_mode, S_IRUGO | S_IWUSR,
- kbd_backlight_mode_show, kbd_backlight_mode_store);
-static DEVICE_ATTR(kbd_type, S_IRUGO, kbd_type_show, NULL);
-static DEVICE_ATTR(available_kbd_modes, S_IRUGO,
- available_kbd_modes_show, NULL);
-static DEVICE_ATTR(kbd_backlight_timeout, S_IRUGO | S_IWUSR,
- kbd_backlight_timeout_show, kbd_backlight_timeout_store);
-static DEVICE_ATTR(touchpad, S_IRUGO | S_IWUSR, touchpad_show, touchpad_store);
-static DEVICE_ATTR(position, S_IRUGO, position_show, NULL);
-static DEVICE_ATTR(usb_sleep_charge, S_IRUGO | S_IWUSR,
- usb_sleep_charge_show, usb_sleep_charge_store);
-static DEVICE_ATTR(sleep_functions_on_battery, S_IRUGO | S_IWUSR,
- sleep_functions_on_battery_show,
- sleep_functions_on_battery_store);
-static DEVICE_ATTR(usb_rapid_charge, S_IRUGO | S_IWUSR,
- usb_rapid_charge_show, usb_rapid_charge_store);
-static DEVICE_ATTR(usb_sleep_music, S_IRUGO | S_IWUSR,
- usb_sleep_music_show, usb_sleep_music_store);
-static DEVICE_ATTR(kbd_function_keys, S_IRUGO | S_IWUSR,
- kbd_function_keys_show, kbd_function_keys_store);
-static DEVICE_ATTR(panel_power_on, S_IRUGO | S_IWUSR,
- panel_power_on_show, panel_power_on_store);
-static DEVICE_ATTR(usb_three, S_IRUGO | S_IWUSR,
- usb_three_show, usb_three_store);
+static DEVICE_ATTR_RW(usb_three);

static struct attribute *toshiba_attributes[] = {
&dev_attr_version.attr,
--
2.2.2

2015-02-12 05:30:39

by Darren Hart

[permalink] [raw]
Subject: Re: [PATCH 0/5] toshiba_acpi: Clean file plus some function renames

On Tue, Feb 10, 2015 at 11:43:55PM -0700, Azael Avalos wrote:
> These patches are simply "cleaning" the file, making it more readable
> and in the process, make it comply according to coding style.
>
> --->8---
> Darren,
>
> I'm sending these patches now and let you decide if you want them for
> 3.20 as the merge window is still open or queue them up for 3.21 :-)

Queued, thanks.

--
Darren Hart
Intel Open Source Technology Center

2015-02-12 05:38:10

by Darren Hart

[permalink] [raw]
Subject: Re: [PATCH 2/5] Documentation/ABI: Add file describing the sysfs entries for toshiba_acpi

On Tue, Feb 10, 2015 at 11:43:57PM -0700, Azael Avalos wrote:
> This patch adds a new file describing the sysfs entries for the
> toshiba_acpi driver.
>

+linux-api list

I've queued this for 3.20 through platform-drivers-x86. Any objections?


> Signed-off-by: Azael Avalos <[email protected]>
> ---
> .../ABI/testing/sysfs-driver-toshiba_acpi | 114 +++++++++++++++++++++
> 1 file changed, 114 insertions(+)
> create mode 100644 Documentation/ABI/testing/sysfs-driver-toshiba_acpi
>
> diff --git a/Documentation/ABI/testing/sysfs-driver-toshiba_acpi b/Documentation/ABI/testing/sysfs-driver-toshiba_acpi
> new file mode 100644
> index 0000000..ca9c71a
> --- /dev/null
> +++ b/Documentation/ABI/testing/sysfs-driver-toshiba_acpi
> @@ -0,0 +1,114 @@
> +What: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/TOS{1900,620{0,7,8}}:00/kbd_backlight_mode
> +Date: June 8, 2014
> +KernelVersion: 3.15
> +Contact: Azael Avalos <[email protected]>
> +Description: This file controls the keyboard backlight operation mode, valid
> + values are:
> + * 0x1 -> FN-Z
> + * 0x2 -> AUTO (also called TIMER)
> + * 0x8 -> ON
> + * 0x10 -> OFF
> + Note that the kernel 3.16 onwards this file accepts all listed
> + parameters, kernel 3.15 only accepts the first two (FN-Z and
> + AUTO).
> +Users: KToshiba
> +
> +What: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/TOS{1900,620{0,7,8}}:00/kbd_backlight_timeout
> +Date: June 8, 2014
> +KernelVersion: 3.15
> +Contact: Azael Avalos <[email protected]>
> +Description: This file controls the timeout of the keyboard backlight
> + whenever the operation mode is set to AUTO (or TIMER),
> + valid values range from 0-60.
> + Note that the kernel 3.15 only had support for the first
> + keyboard type, the kernel 3.16 added support for the second
> + type and the range accepted for type 2 is 1-60.
> + See the entry named "kbd_type"
> +Users: KToshiba
> +
> +What: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/TOS{1900,620{0,7,8}}:00/position
> +Date: June 8, 2014
> +KernelVersion: 3.15
> +Contact: Azael Avalos <[email protected]>
> +Description: This file shows the absolute position of the built-in
> + accelereometer.
> +
> +What: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/TOS{1900,620{0,7,8}}:00/touchpad
> +Date: June 8, 2014
> +KernelVersion: 3.15
> +Contact: Azael Avalos <[email protected]>
> +Description: This files controls the status of the touchpad and pointing
> + stick (if available), valid values are:
> + * 0 -> OFF
> + * 1 -> ON
> +Users: KToshiba
> +
> +What: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/TOS{1900,620{0,7,8}}:00/available_kbd_modes
> +Date: August 3, 2014
> +KernelVersion: 3.16
> +Contact: Azael Avalos <[email protected]>
> +Description: This file shows the supported keyboard backlight modes
> + the system supports, which can be:
> + * 0x1 -> FN-Z
> + * 0x2 -> AUTO (also called TIMER)
> + * 0x8 -> ON
> + * 0x10 -> OFF
> + Note that not all keyboard types support the listed modes.
> + See the entry named "available_kbd_modes"
> +Users: KToshiba
> +
> +What: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/TOS{1900,620{0,7,8}}:00/kbd_type
> +Date: August 3, 2014
> +KernelVersion: 3.16
> +Contact: Azael Avalos <[email protected]>
> +Description: This file shows the current keyboard backlight type,
> + which can be:
> + * 1 -> Type 1, supporting modes FN-Z and AUTO
> + * 2 -> Type 2, supporting modes TIMER, ON and OFF
> +Users: KToshiba
> +
> +What: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/TOS{1900,620{0,7,8}}:00/version
> +Date: February, 2015
> +KernelVersion: 3.20
> +Contact: Azael Avalos <[email protected]>
> +Description: This file shows the current version of the driver
> +
> +What: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/TOS{1900,620{0,7,8}}:00/fan
> +Date: February, 2015
> +KernelVersion: 3.20
> +Contact: Azael Avalos <[email protected]>
> +Description: This file controls the state of the internal fan, valid
> + values are:
> + * 0 -> OFF
> + * 1 -> ON
> +
> +What: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/TOS{1900,620{0,7,8}}:00/kbd_function_keys
> +Date: February, 2015
> +KernelVersion: 3.20
> +Contact: Azael Avalos <[email protected]>
> +Description: This file controls the Special Functions (hotkeys) operation
> + mode, valid values are:
> + * 0 -> Normal Operation
> + * 1 -> Special Functions
> + In the "Normal Operation" mode, the F{1-12} keys are as usual
> + and the hotkeys are accessed via FN-F{1-12}.
> + In the "Special Functions" mode, the F{1-12} keys trigger the
> + hotkey and the F{1-12} keys are accessed via FN-F{1-12}.
> +
> +What: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/TOS{1900,620{0,7,8}}:00/panel_power_on
> +Date: February, 2015
> +KernelVersion: 3.20
> +Contact: Azael Avalos <[email protected]>
> +Description: This file controls whether the laptop should turn ON whenever
> + the LID is opened, valid values are:
> + * 0 -> Disabled
> + * 1 -> Enabled
> +
> +What: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/TOS{1900,620{0,7,8}}:00/usb_three
> +Date: February, 2015
> +KernelVersion: 3.20
> +Contact: Azael Avalos <[email protected]>
> +Description: This file controls whether the USB 3 functionality, valid
> + values are:
> + * 0 -> Disabled (Acts as a regular USB 2)
> + * 1 -> Enabled (Full USB 3 functionality)
> --
> 2.2.2
>
>

--
Darren Hart
Intel Open Source Technology Center

2015-02-12 05:42:57

by Azael Avalos

[permalink] [raw]
Subject: Re: [PATCH 2/5] Documentation/ABI: Add file describing the sysfs entries for toshiba_acpi

Hi Darren,

2015-02-11 22:38 GMT-07:00 Darren Hart <[email protected]>:
> On Tue, Feb 10, 2015 at 11:43:57PM -0700, Azael Avalos wrote:
>> This patch adds a new file describing the sysfs entries for the
>> toshiba_acpi driver.
>>
>
> +linux-api list

Just CC me, because I'm not subscribed to that list, in case something
needs to be changed.

>
> I've queued this for 3.20 through platform-drivers-x86. Any objections?

Not at all, and given that this patch is managed on another list,
let's see if there are any problems with this file.

Cheers
Azael

>
>
>> Signed-off-by: Azael Avalos <[email protected]>
>> ---
>> .../ABI/testing/sysfs-driver-toshiba_acpi | 114 +++++++++++++++++++++
>> 1 file changed, 114 insertions(+)
>> create mode 100644 Documentation/ABI/testing/sysfs-driver-toshiba_acpi
>>
>> diff --git a/Documentation/ABI/testing/sysfs-driver-toshiba_acpi b/Documentation/ABI/testing/sysfs-driver-toshiba_acpi
>> new file mode 100644
>> index 0000000..ca9c71a
>> --- /dev/null
>> +++ b/Documentation/ABI/testing/sysfs-driver-toshiba_acpi
>> @@ -0,0 +1,114 @@
>> +What: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/TOS{1900,620{0,7,8}}:00/kbd_backlight_mode
>> +Date: June 8, 2014
>> +KernelVersion: 3.15
>> +Contact: Azael Avalos <[email protected]>
>> +Description: This file controls the keyboard backlight operation mode, valid
>> + values are:
>> + * 0x1 -> FN-Z
>> + * 0x2 -> AUTO (also called TIMER)
>> + * 0x8 -> ON
>> + * 0x10 -> OFF
>> + Note that the kernel 3.16 onwards this file accepts all listed
>> + parameters, kernel 3.15 only accepts the first two (FN-Z and
>> + AUTO).
>> +Users: KToshiba
>> +
>> +What: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/TOS{1900,620{0,7,8}}:00/kbd_backlight_timeout
>> +Date: June 8, 2014
>> +KernelVersion: 3.15
>> +Contact: Azael Avalos <[email protected]>
>> +Description: This file controls the timeout of the keyboard backlight
>> + whenever the operation mode is set to AUTO (or TIMER),
>> + valid values range from 0-60.
>> + Note that the kernel 3.15 only had support for the first
>> + keyboard type, the kernel 3.16 added support for the second
>> + type and the range accepted for type 2 is 1-60.
>> + See the entry named "kbd_type"
>> +Users: KToshiba
>> +
>> +What: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/TOS{1900,620{0,7,8}}:00/position
>> +Date: June 8, 2014
>> +KernelVersion: 3.15
>> +Contact: Azael Avalos <[email protected]>
>> +Description: This file shows the absolute position of the built-in
>> + accelereometer.
>> +
>> +What: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/TOS{1900,620{0,7,8}}:00/touchpad
>> +Date: June 8, 2014
>> +KernelVersion: 3.15
>> +Contact: Azael Avalos <[email protected]>
>> +Description: This files controls the status of the touchpad and pointing
>> + stick (if available), valid values are:
>> + * 0 -> OFF
>> + * 1 -> ON
>> +Users: KToshiba
>> +
>> +What: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/TOS{1900,620{0,7,8}}:00/available_kbd_modes
>> +Date: August 3, 2014
>> +KernelVersion: 3.16
>> +Contact: Azael Avalos <[email protected]>
>> +Description: This file shows the supported keyboard backlight modes
>> + the system supports, which can be:
>> + * 0x1 -> FN-Z
>> + * 0x2 -> AUTO (also called TIMER)
>> + * 0x8 -> ON
>> + * 0x10 -> OFF
>> + Note that not all keyboard types support the listed modes.
>> + See the entry named "available_kbd_modes"
>> +Users: KToshiba
>> +
>> +What: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/TOS{1900,620{0,7,8}}:00/kbd_type
>> +Date: August 3, 2014
>> +KernelVersion: 3.16
>> +Contact: Azael Avalos <[email protected]>
>> +Description: This file shows the current keyboard backlight type,
>> + which can be:
>> + * 1 -> Type 1, supporting modes FN-Z and AUTO
>> + * 2 -> Type 2, supporting modes TIMER, ON and OFF
>> +Users: KToshiba
>> +
>> +What: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/TOS{1900,620{0,7,8}}:00/version
>> +Date: February, 2015
>> +KernelVersion: 3.20
>> +Contact: Azael Avalos <[email protected]>
>> +Description: This file shows the current version of the driver
>> +
>> +What: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/TOS{1900,620{0,7,8}}:00/fan
>> +Date: February, 2015
>> +KernelVersion: 3.20
>> +Contact: Azael Avalos <[email protected]>
>> +Description: This file controls the state of the internal fan, valid
>> + values are:
>> + * 0 -> OFF
>> + * 1 -> ON
>> +
>> +What: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/TOS{1900,620{0,7,8}}:00/kbd_function_keys
>> +Date: February, 2015
>> +KernelVersion: 3.20
>> +Contact: Azael Avalos <[email protected]>
>> +Description: This file controls the Special Functions (hotkeys) operation
>> + mode, valid values are:
>> + * 0 -> Normal Operation
>> + * 1 -> Special Functions
>> + In the "Normal Operation" mode, the F{1-12} keys are as usual
>> + and the hotkeys are accessed via FN-F{1-12}.
>> + In the "Special Functions" mode, the F{1-12} keys trigger the
>> + hotkey and the F{1-12} keys are accessed via FN-F{1-12}.
>> +
>> +What: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/TOS{1900,620{0,7,8}}:00/panel_power_on
>> +Date: February, 2015
>> +KernelVersion: 3.20
>> +Contact: Azael Avalos <[email protected]>
>> +Description: This file controls whether the laptop should turn ON whenever
>> + the LID is opened, valid values are:
>> + * 0 -> Disabled
>> + * 1 -> Enabled
>> +
>> +What: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/TOS{1900,620{0,7,8}}:00/usb_three
>> +Date: February, 2015
>> +KernelVersion: 3.20
>> +Contact: Azael Avalos <[email protected]>
>> +Description: This file controls whether the USB 3 functionality, valid
>> + values are:
>> + * 0 -> Disabled (Acts as a regular USB 2)
>> + * 1 -> Enabled (Full USB 3 functionality)
>> --
>> 2.2.2
>>
>>
>
> --
> Darren Hart
> Intel Open Source Technology Center



--
-- El mundo apesta y vosotros apestais tambien --