Changeset 9094


Ignore:
Timestamp:
2007-10-02T16:23:27+02:00 (10 years ago)
Author:
florian
Message:

Rewrite platform code to be smarter

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/target/linux/rdc/files/arch/i386/mach-rdc/platform.c

    r8505 r9094  
    2929#include <linux/device.h> 
    3030#include <linux/platform_device.h> 
     31#include <linux/version.h> 
     32#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23) 
     33#include <linux/leds.h> 
     34#endif 
    3135 
    3236#include <asm/gpio.h> 
     
    3438#define PFX "rdc321x: " 
    3539 
    36 /* FIXME : Flash */ 
     40/* Flash */ 
    3741static struct resource rdc_flash_resource[] = { 
    3842        [0] = { 
     
    5155 
    5256/* LEDS */ 
     57#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23) 
     58static struct gpio_led default_leds[] = { 
     59        { .name = "rdc:dmz", .gpio = 1, .active_low = 1, }, 
     60}; 
     61 
     62static struct gpio_led_platform_data rdc321x_led_data = { 
     63        .num_leds = ARRAY_SIZE(default_leds), 
     64        .leds = default_leds, 
     65}; 
     66 
    5367static struct platform_device rdc321x_leds = { 
    54         .name = "rdc321x-leds", 
     68        .name = "leds-gpio", 
     69        .id = -1, 
     70        .dev = { 
     71                .platform_data = &rdc321x_led_data, 
     72        } 
     73}; 
     74#else 
     75static struct platform_device rdc321x_leds = { 
     76        .name "rdc321x-leds", 
    5577        .id = -1, 
    5678        .num_resources = 0, 
    5779}; 
     80#endif 
    5881 
     82/* Watchdog */ 
    5983static struct platform_device rdc321x_wdt = { 
    6084        .name = "rdc321x-wdt", 
     
    6387}; 
    6488 
     89static struct platform_device *rdc321x_devs[] = { 
     90        &rdc_flash_device, 
     91        &rdc321x_leds, 
     92        &rdc321x_wdt 
     93}; 
     94 
    6595static int __init rdc_board_setup(void) 
    6696{ 
    67         int err; 
    68  
    69         err = platform_device_register(&rdc_flash_device); 
    70         if (err) 
    71                 printk(KERN_ALERT PFX "failed to register flash\n"); 
    72  
    73         err = platform_device_register(&rdc321x_leds); 
    74         if (err) 
    75                 printk(KERN_ALERT PFX "failed to register LEDS\n"); 
    76  
    77         err = platform_device_register(&rdc321x_wdt); 
    78                 printk(KERN_ALERT PFX "failed to register watchdog\n"); 
    79  
    80         return err;  
     97        return platform_add_devices(rdc321x_devs, ARRAY_SIZE(rdc321x_devs)); 
    8198} 
    8299 
Note: See TracChangeset for help on using the changeset viewer.