~ubuntu-branches/ubuntu/quantal/linux-lowlatency/quantal-proposed

« back to all changes in this revision

Viewing changes to drivers/video/backlight/lcd.c

  • Committer: Package Import Robot
  • Author(s): Andy Whitcroft, Andy Whitcroft
  • Date: 2012-06-21 09:16:38 UTC
  • Revision ID: package-import@ubuntu.com-20120621091638-gubhv4nox8xez1ct
Tags: 3.5.0-1.1
[ Andy Whitcroft]

* Rebuild lowlatency against Ubuntu-3.5.0-1.1
* All new configuration system to allow configuration deltas to be
  exposed via debian.lowlatency/config-delta

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 *
6
6
 */
7
7
 
 
8
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
9
 
8
10
#include <linux/module.h>
9
11
#include <linux/init.h>
10
12
#include <linux/device.h>
32
34
        case FB_EVENT_BLANK:
33
35
        case FB_EVENT_MODE_CHANGE:
34
36
        case FB_EVENT_MODE_CHANGE_ALL:
 
37
        case FB_EARLY_EVENT_BLANK:
 
38
        case FB_R_EARLY_EVENT_BLANK:
35
39
                break;
36
40
        default:
37
41
                return 0;
46
50
                if (event == FB_EVENT_BLANK) {
47
51
                        if (ld->ops->set_power)
48
52
                                ld->ops->set_power(ld, *(int *)evdata->data);
 
53
                } else if (event == FB_EARLY_EVENT_BLANK) {
 
54
                        if (ld->ops->early_set_power)
 
55
                                ld->ops->early_set_power(ld,
 
56
                                                *(int *)evdata->data);
 
57
                } else if (event == FB_R_EARLY_EVENT_BLANK) {
 
58
                        if (ld->ops->r_early_set_power)
 
59
                                ld->ops->r_early_set_power(ld,
 
60
                                                *(int *)evdata->data);
49
61
                } else {
50
62
                        if (ld->ops->set_mode)
51
63
                                ld->ops->set_mode(ld, evdata->data);
97
109
                struct device_attribute *attr, const char *buf, size_t count)
98
110
{
99
111
        int rc = -ENXIO;
100
 
        char *endp;
101
112
        struct lcd_device *ld = to_lcd_device(dev);
102
 
        int power = simple_strtoul(buf, &endp, 0);
103
 
        size_t size = endp - buf;
 
113
        unsigned long power;
104
114
 
105
 
        if (isspace(*endp))
106
 
                size++;
107
 
        if (size != count)
108
 
                return -EINVAL;
 
115
        rc = kstrtoul(buf, 0, &power);
 
116
        if (rc)
 
117
                return rc;
109
118
 
110
119
        mutex_lock(&ld->ops_lock);
111
120
        if (ld->ops && ld->ops->set_power) {
112
 
                pr_debug("lcd: set power to %d\n", power);
 
121
                pr_debug("set power to %lu\n", power);
113
122
                ld->ops->set_power(ld, power);
114
123
                rc = count;
115
124
        }
136
145
                struct device_attribute *attr, const char *buf, size_t count)
137
146
{
138
147
        int rc = -ENXIO;
139
 
        char *endp;
140
148
        struct lcd_device *ld = to_lcd_device(dev);
141
 
        int contrast = simple_strtoul(buf, &endp, 0);
142
 
        size_t size = endp - buf;
 
149
        unsigned long contrast;
143
150
 
144
 
        if (isspace(*endp))
145
 
                size++;
146
 
        if (size != count)
147
 
                return -EINVAL;
 
151
        rc = kstrtoul(buf, 0, &contrast);
 
152
        if (rc)
 
153
                return rc;
148
154
 
149
155
        mutex_lock(&ld->ops_lock);
150
156
        if (ld->ops && ld->ops->set_contrast) {
151
 
                pr_debug("lcd: set contrast to %d\n", contrast);
 
157
                pr_debug("set contrast to %lu\n", contrast);
152
158
                ld->ops->set_contrast(ld, contrast);
153
159
                rc = count;
154
160
        }
259
265
{
260
266
        lcd_class = class_create(THIS_MODULE, "lcd");
261
267
        if (IS_ERR(lcd_class)) {
262
 
                printk(KERN_WARNING "Unable to create backlight class; errno = %ld\n",
263
 
                                PTR_ERR(lcd_class));
 
268
                pr_warn("Unable to create backlight class; errno = %ld\n",
 
269
                        PTR_ERR(lcd_class));
264
270
                return PTR_ERR(lcd_class);
265
271
        }
266
272