Changeset 9363


Ignore:
Timestamp:
2007-10-20T16:32:13+02:00 (10 years ago)
Author:
juhosg
Message:

make morse LED trigger available as a package, and fix it to compile with 2.6.23

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/package/kernel/modules/other.mk

    r9362 r9363  
    335335 
    336336 
     337define KernelPackage/ledtrig-morse 
     338  SUBMENU:=$(OTHER_MENU) 
     339  TITLE:=LED Morse Trigger 
     340  KCONFIG:=CONFIG_LEDS_TRIGGER_MORSE 
     341  FILES:=$(LINUX_DIR)/drivers/leds/ledtrig-morse.$(LINUX_KMOD_SUFFIX) 
     342  AUTOLOAD:=$(call AutoLoad,50,ledtrig-morse) 
     343endef 
     344 
     345define KernelPackage/ledtrig-morse/description 
     346 Kernel module to show morse coded messages on LEDs. 
     347endef 
     348 
     349$(eval $(call KernelPackage,ledtrig-morse)) 
     350 
     351 
    337352define KernelPackage/nsc-gpio 
    338353  SUBMENU:=$(OTHER_MENU) 
  • trunk/target/linux/generic-2.6/files/drivers/leds/ledtrig-morse.c

    r9056 r9363  
    1919 */ 
    2020 
     21#include <linux/kernel.h> 
     22#include <linux/version.h> 
    2123#include <linux/module.h> 
    2224#include <linux/jiffies.h> 
    23 #include <linux/kernel.h> 
    2425#include <linux/init.h> 
    2526#include <linux/list.h> 
     
    8990static void morse_timer_function(unsigned long data) 
    9091{ 
    91         struct led_classdev *led_cdev = (struct led_classdev *) data; 
     92        struct led_classdev *led_cdev = (struct led_classdev *)data; 
    9293        struct morse_trig_data *morse_data = led_cdev->trigger_data; 
    9394        unsigned long brightness = LED_OFF; 
     
    145146} 
    146147 
    147 static ssize_t morse_delay_show(struct class_device *dev, char *buf) 
    148 { 
    149         struct led_classdev *led_cdev = class_get_devdata(dev); 
     148static ssize_t _morse_delay_show(struct led_classdev *led_cdev, char *buf) 
     149{ 
    150150        struct morse_trig_data *morse_data = led_cdev->trigger_data; 
    151151 
     
    155155} 
    156156 
    157 static ssize_t morse_delay_store(struct class_device *dev, const char *buf, 
    158                 size_t size) 
    159 { 
    160         struct led_classdev *led_cdev = class_get_devdata(dev); 
     157static ssize_t _morse_delay_store(struct led_classdev *led_cdev, 
     158                const char *buf, size_t size) 
     159{ 
    161160        struct morse_trig_data *morse_data = led_cdev->trigger_data; 
    162161        char *after; 
     
    177176} 
    178177 
    179 static ssize_t morse_msg_show(struct class_device *dev, char *buf) 
    180 { 
    181         struct led_classdev *led_cdev = class_get_devdata(dev); 
     178static ssize_t _morse_msg_show(struct led_classdev *led_cdev, char *buf) 
     179{ 
    182180        struct morse_trig_data *morse_data = led_cdev->trigger_data; 
    183181 
     
    190188} 
    191189 
    192 static ssize_t morse_msg_store(struct class_device *dev, const char *buf, 
    193                                 size_t size) 
    194 { 
    195         struct led_classdev *led_cdev = class_get_devdata(dev); 
     190static ssize_t _morse_msg_store(struct led_classdev *led_cdev, 
     191                const char *buf, size_t size) 
     192{ 
    196193        struct morse_trig_data *morse_data = led_cdev->trigger_data; 
    197194        char *m; 
     
    216213} 
    217214 
     215#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23) 
     216static ssize_t morse_delay_show(struct device *dev, 
     217                struct device_attribute *attr, char *buf) 
     218{ 
     219        struct led_classdev *led_cdev = dev_get_drvdata(dev); 
     220 
     221        return _morse_delay_show(led_cdev, buf); 
     222} 
     223 
     224static ssize_t morse_delay_store(struct device *dev, 
     225                struct device_attribute *attr, const char *buf, size_t size) 
     226{ 
     227        struct led_classdev *led_cdev = dev_get_drvdata(dev); 
     228 
     229        return _morse_delay_store(led_cdev, buf, size); 
     230} 
     231 
     232static ssize_t morse_msg_show(struct device *dev, 
     233                struct device_attribute *attr, char *buf) 
     234{ 
     235        struct led_classdev *led_cdev = dev_get_drvdata(dev); 
     236 
     237        return _morse_msg_show(led_cdev, buf); 
     238} 
     239 
     240static ssize_t morse_msg_store(struct device *dev, 
     241                struct device_attribute *attr, const char *buf, size_t size) 
     242{ 
     243        struct led_classdev *led_cdev = dev_get_drvdata(dev); 
     244 
     245        return _morse_msg_store(led_cdev, buf, size); 
     246} 
     247 
     248static DEVICE_ATTR(delay, 0644, morse_delay_show, morse_delay_store); 
     249static DEVICE_ATTR(message, 0644, morse_msg_show, morse_msg_store); 
     250 
     251#define led_device_create_file(leddev, attr) \ 
     252        device_create_file(leddev->dev, &dev_attr_ ## attr) 
     253#define led_device_remove_file(leddev, attr) \ 
     254        device_remove_file(leddev->dev, &dev_attr_ ## attr) 
     255 
     256#else 
     257static ssize_t morse_delay_show(struct class_device *dev, char *buf) 
     258{ 
     259        struct led_classdev *led_cdev = class_get_devdata(dev); 
     260 
     261        return _morse_delay_show(led_cdev, buf); 
     262} 
     263 
     264static ssize_t morse_delay_store(struct class_device *dev, const char *buf, 
     265                size_t size) 
     266{ 
     267        struct led_classdev *led_cdev = class_get_devdata(dev); 
     268 
     269        return _morse_delay_store(led_cdev, buf, size); 
     270} 
     271 
     272static ssize_t morse_msg_show(struct class_device *dev, char *buf) 
     273{ 
     274        struct led_classdev *led_cdev = class_get_devdata(dev); 
     275 
     276        return _morse_msg_show(led_cdev, buf); 
     277} 
     278 
     279static ssize_t morse_msg_store(struct class_device *dev, const char *buf, 
     280                                size_t size) 
     281{ 
     282        struct led_classdev *led_cdev = class_get_devdata(dev); 
     283 
     284        return _morse_msg_store(led_cdev, buf, size); 
     285} 
     286 
    218287static CLASS_DEVICE_ATTR(delay, 0644, morse_delay_show, morse_delay_store); 
    219288static CLASS_DEVICE_ATTR(message, 0644, morse_msg_show, morse_msg_store); 
     289 
     290#define led_device_create_file(leddev, attr) \ 
     291        class_device_create_file(leddev->class_dev, &class_device_attr_ ## attr) 
     292#define led_device_remove_file(leddev, attr) \ 
     293        class_device_remove_file(leddev->class_dev, &class_device_attr_ ## attr) 
     294 
     295#endif 
    220296 
    221297static void morse_trig_activate(struct led_classdev *led_cdev) 
     
    233309        morse_data->timer.data = (unsigned long)led_cdev; 
    234310 
    235         rc = class_device_create_file(led_cdev->class_dev, 
    236                                 &class_device_attr_delay); 
     311        rc = led_device_create_file(led_cdev, delay); 
    237312        if (rc) goto err; 
    238313 
    239         rc = class_device_create_file(led_cdev->class_dev, 
    240                                 &class_device_attr_message); 
     314        rc = led_device_create_file(led_cdev, message); 
    241315        if (rc) goto err_delay; 
    242316 
     
    246320 
    247321err_delay: 
    248         class_device_remove_file(led_cdev->class_dev, 
    249                                 &class_device_attr_delay); 
     322        led_device_remove_file(led_cdev, delay); 
    250323err: 
    251324        kfree(morse_data); 
     
    259332                return; 
    260333 
    261         class_device_remove_file(led_cdev->class_dev, 
    262                 &class_device_attr_message); 
    263         class_device_remove_file(led_cdev->class_dev, 
    264                 &class_device_attr_delay); 
     334        led_device_remove_file(led_cdev, message); 
     335        led_device_remove_file(led_cdev, delay); 
    265336 
    266337        del_timer_sync(&morse_data->timer); 
Note: See TracChangeset for help on using the changeset viewer.