aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/misc/compal-laptop.c37
1 files changed, 2 insertions, 35 deletions
diff --git a/drivers/misc/compal-laptop.c b/drivers/misc/compal-laptop.c
index 0c1f5875fbb9..344b790a6253 100644
--- a/drivers/misc/compal-laptop.c
+++ b/drivers/misc/compal-laptop.c
@@ -28,9 +28,6 @@
28 * 28 *
29 * This driver exports a few files in /sys/devices/platform/compal-laptop/: 29 * This driver exports a few files in /sys/devices/platform/compal-laptop/:
30 * 30 *
31 * lcd_level - Screen brightness: contains a single integer in the
32 * range 0..7. (rw)
33 *
34 * wlan - wlan subsystem state: contains 0 or 1 (rw) 31 * wlan - wlan subsystem state: contains 0 or 1 (rw)
35 * 32 *
36 * bluetooth - Bluetooth subsystem state: contains 0 or 1 (rw) 33 * bluetooth - Bluetooth subsystem state: contains 0 or 1 (rw)
@@ -44,7 +41,7 @@
44 * This driver might work on other laptops produced by Compal. If you 41 * This driver might work on other laptops produced by Compal. If you
45 * want to try it you can pass force=1 as argument to the module which 42 * want to try it you can pass force=1 as argument to the module which
46 * will force it to load even when the DMI data doesn't identify the 43 * will force it to load even when the DMI data doesn't identify the
47 * laptop as IFL90. 44 * laptop as FL9x.
48 */ 45 */
49 46
50#include <linux/module.h> 47#include <linux/module.h>
@@ -56,7 +53,7 @@
56#include <linux/platform_device.h> 53#include <linux/platform_device.h>
57#include <linux/autoconf.h> 54#include <linux/autoconf.h>
58 55
59#define COMPAL_DRIVER_VERSION "0.2.5" 56#define COMPAL_DRIVER_VERSION "0.2.6"
60 57
61#define COMPAL_LCD_LEVEL_MAX 8 58#define COMPAL_LCD_LEVEL_MAX 8
62 59
@@ -209,34 +206,6 @@ static ssize_t show_bluetooth(struct device *dev,
209 return sprintf(buf, "%i\n", enabled); 206 return sprintf(buf, "%i\n", enabled);
210} 207}
211 208
212static ssize_t show_lcd_level(struct device *dev,
213 struct device_attribute *attr, char *buf)
214{
215 int ret;
216
217 ret = get_lcd_level();
218 if (ret < 0)
219 return ret;
220
221 return sprintf(buf, "%i\n", ret);
222}
223
224static ssize_t store_lcd_level(struct device *dev,
225 struct device_attribute *attr, const char *buf, size_t count)
226{
227 int level, ret;
228
229 if (sscanf(buf, "%i", &level) != 1 ||
230 (level < 0 || level >= COMPAL_LCD_LEVEL_MAX))
231 return -EINVAL;
232
233 ret = set_lcd_level(level);
234 if (ret < 0)
235 return ret;
236
237 return count;
238}
239
240static ssize_t store_wlan_state(struct device *dev, 209static ssize_t store_wlan_state(struct device *dev,
241 struct device_attribute *attr, const char *buf, size_t count) 210 struct device_attribute *attr, const char *buf, size_t count)
242{ 211{
@@ -267,13 +236,11 @@ static ssize_t store_bluetooth_state(struct device *dev,
267 return count; 236 return count;
268} 237}
269 238
270static DEVICE_ATTR(lcd_level, 0644, show_lcd_level, store_lcd_level);
271static DEVICE_ATTR(bluetooth, 0644, show_bluetooth, store_bluetooth_state); 239static DEVICE_ATTR(bluetooth, 0644, show_bluetooth, store_bluetooth_state);
272static DEVICE_ATTR(wlan, 0644, show_wlan, store_wlan_state); 240static DEVICE_ATTR(wlan, 0644, show_wlan, store_wlan_state);
273static DEVICE_ATTR(raw, 0444, show_raw, NULL); 241static DEVICE_ATTR(raw, 0444, show_raw, NULL);
274 242
275static struct attribute *compal_attributes[] = { 243static struct attribute *compal_attributes[] = {
276 &dev_attr_lcd_level.attr,
277 &dev_attr_bluetooth.attr, 244 &dev_attr_bluetooth.attr,
278 &dev_attr_wlan.attr, 245 &dev_attr_wlan.attr,
279 &dev_attr_raw.attr, 246 &dev_attr_raw.attr,