ledtrig-backlight.c (9938b04472d5c59f8bd8152a548533a8599596a2) | ledtrig-backlight.c (2282e125a406e09331c5a785e3df29035c99a607) |
---|---|
1/* 2 * Backlight emulation LED trigger 3 * 4 * Copyright 2008 (C) Rodolfo Giometti <giometti@linux.it> 5 * Copyright 2008 (C) Eurotech S.p.A. <info@eurotech.it> 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License version 2 as --- 83 unchanged lines hidden (view full) --- 92 led_set_brightness_nosleep(led, LED_OFF); 93 else 94 led_set_brightness_nosleep(led, n->brightness); 95 96 return num; 97} 98static DEVICE_ATTR(inverted, 0644, bl_trig_invert_show, bl_trig_invert_store); 99 | 1/* 2 * Backlight emulation LED trigger 3 * 4 * Copyright 2008 (C) Rodolfo Giometti <giometti@linux.it> 5 * Copyright 2008 (C) Eurotech S.p.A. <info@eurotech.it> 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License version 2 as --- 83 unchanged lines hidden (view full) --- 92 led_set_brightness_nosleep(led, LED_OFF); 93 else 94 led_set_brightness_nosleep(led, n->brightness); 95 96 return num; 97} 98static DEVICE_ATTR(inverted, 0644, bl_trig_invert_show, bl_trig_invert_store); 99 |
100static void bl_trig_activate(struct led_classdev *led) | 100static int bl_trig_activate(struct led_classdev *led) |
101{ 102 int ret; 103 104 struct bl_trig_notifier *n; 105 106 n = kzalloc(sizeof(struct bl_trig_notifier), GFP_KERNEL); 107 led->trigger_data = n; 108 if (!n) { 109 dev_err(led->dev, "unable to allocate backlight trigger\n"); | 101{ 102 int ret; 103 104 struct bl_trig_notifier *n; 105 106 n = kzalloc(sizeof(struct bl_trig_notifier), GFP_KERNEL); 107 led->trigger_data = n; 108 if (!n) { 109 dev_err(led->dev, "unable to allocate backlight trigger\n"); |
110 return; | 110 return 0; |
111 } 112 113 ret = device_create_file(led->dev, &dev_attr_inverted); 114 if (ret) 115 goto err_invert; 116 117 n->led = led; 118 n->brightness = led->brightness; 119 n->old_status = UNBLANK; 120 n->notifier.notifier_call = fb_notifier_callback; 121 122 ret = fb_register_client(&n->notifier); 123 if (ret) 124 dev_err(led->dev, "unable to register backlight trigger\n"); 125 led->activated = true; 126 | 111 } 112 113 ret = device_create_file(led->dev, &dev_attr_inverted); 114 if (ret) 115 goto err_invert; 116 117 n->led = led; 118 n->brightness = led->brightness; 119 n->old_status = UNBLANK; 120 n->notifier.notifier_call = fb_notifier_callback; 121 122 ret = fb_register_client(&n->notifier); 123 if (ret) 124 dev_err(led->dev, "unable to register backlight trigger\n"); 125 led->activated = true; 126 |
127 return; | 127 return 0; |
128 129err_invert: 130 led->trigger_data = NULL; 131 kfree(n); | 128 129err_invert: 130 led->trigger_data = NULL; 131 kfree(n); |
132 133 return 0; |
|
132} 133 134static void bl_trig_deactivate(struct led_classdev *led) 135{ 136 struct bl_trig_notifier *n = 137 (struct bl_trig_notifier *) led->trigger_data; 138 139 if (led->activated) { --- 29 unchanged lines hidden --- | 134} 135 136static void bl_trig_deactivate(struct led_classdev *led) 137{ 138 struct bl_trig_notifier *n = 139 (struct bl_trig_notifier *) led->trigger_data; 140 141 if (led->activated) { --- 29 unchanged lines hidden --- |