Arch/led_fixes.patch
author Andreas Boehler <andreas _AT_ aboehler.at>
Wed, 23 Oct 2013 22:50:29 +0200
changeset 6 35c0804c8ca2
permissions -rw-r--r--
Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
6
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
     1
diff -purN linux-3.11.orig/drivers/leds/trigger/Kconfig linux-3.11/drivers/leds/trigger/Kconfig
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
     2
--- linux-3.11.orig/drivers/leds/trigger/Kconfig	2013-09-02 22:46:10.000000000 +0200
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
     3
+++ linux-3.11/drivers/leds/trigger/Kconfig	2013-09-12 23:10:19.343331257 +0200
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
     4
@@ -38,6 +38,14 @@ config LEDS_TRIGGER_IDE_DISK
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
     5
 	depends on IDE_GD_ATA
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
     6
 	depends on LEDS_TRIGGERS
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
     7
 	help
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
     8
+	  This allows LEDs to be controlled by SATA disk activity.
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
     9
+	  If unsure, say Y.
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    10
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    11
+config LEDS_TRIGGER_SATA_DISK
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    12
+	bool "LED SATA Disk Trigger"
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    13
+	depends on ATA
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    14
+	depends on LEDS_TRIGGERS
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    15
+	help
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    16
 	  This allows LEDs to be controlled by IDE disk activity.
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    17
 	  If unsure, say Y.
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    18
 
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    19
@@ -89,6 +97,13 @@ config LEDS_TRIGGER_DEFAULT_ON
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    20
 	  This allows LEDs to be initialised in the ON state.
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    21
 	  If unsure, say Y.
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    22
 
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    23
+config LEDS_TRIGGER_NETDEV 
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    24
+       tristate "LED Netdev Trigger" 
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    25
+       depends on LEDS_TRIGGERS 
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    26
+       help 
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    27
+        This allows LEDs to be controlled by network device activity. 
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    28
+        If unsure, say Y. 
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    29
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    30
 comment "iptables trigger is under Netfilter config (LED target)"
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    31
 	depends on LEDS_TRIGGERS
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    32
 
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    33
diff -purN linux-3.11.orig/drivers/leds/trigger/ledtrig-netdev.c linux-3.11/drivers/leds/trigger/ledtrig-netdev.c
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    34
--- linux-3.11.orig/drivers/leds/trigger/ledtrig-netdev.c	1970-01-01 01:00:00.000000000 +0100
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    35
+++ linux-3.11/drivers/leds/trigger/ledtrig-netdev.c	2013-09-12 23:17:47.227775980 +0200
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    36
@@ -0,0 +1,460 @@
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    37
+/*
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    38
+ * LED Kernel Netdev Trigger
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    39
+ *
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    40
+ * Toggles the LED to reflect the link and traffic state of a named net device
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    41
+ *
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    42
+ * Copyright 2007 Oliver Jowett <oliver@opencloud.com>
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    43
+ *
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    44
+ * Derived from ledtrig-timer.c which is:
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    45
+ *  Copyright 2005-2006 Openedhand Ltd.
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    46
+ *  Author: Richard Purdie <rpurdie@openedhand.com>
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    47
+ *
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    48
+ * This program is free software; you can redistribute it and/or modify
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    49
+ * it under the terms of the GNU General Public License version 2 as
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    50
+ * published by the Free Software Foundation.
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    51
+ *
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    52
+ */
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    53
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    54
+#include <linux/module.h>
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    55
+#include <linux/jiffies.h>
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    56
+#include <linux/kernel.h>
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    57
+#include <linux/init.h>
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    58
+#include <linux/list.h>
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    59
+#include <linux/spinlock.h>
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    60
+#include <linux/device.h>
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    61
+#include <linux/netdevice.h>
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    62
+#include <linux/timer.h>
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    63
+#include <linux/ctype.h>
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    64
+#include <linux/leds.h>
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    65
+#include <linux/version.h>
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    66
+#include <net/net_namespace.h>
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    67
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    68
+/*
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    69
+ * Configurable sysfs attributes:
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    70
+ *
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    71
+ * device_name - network device name to monitor
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    72
+ *
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    73
+ * interval - duration of LED blink, in milliseconds
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    74
+ *
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    75
+ * mode - either "none" (LED is off) or a space separated list
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    76
+ * of one or more of:
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    77
+ *   link: LED's normal state reflects whether the link is up (has carrier)
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    78
+ *         or not
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    79
+ *   tx:   LED blinks on transmitted data
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    80
+ *   rx:   LED blinks on receive data
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    81
+ *
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    82
+ * Some suggestions:
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    83
+ *
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    84
+ *  Simple link status LED:
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    85
+ *  $ echo netdev >someled/trigger
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    86
+ *  $ echo eth0 >someled/device_name
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    87
+ *  $ echo link >someled/mode
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    88
+ *
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    89
+ *  Ethernet-style link/activity LED:
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    90
+ *  $ echo netdev >someled/trigger
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    91
+ *  $ echo eth0 >someled/device_name
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    92
+ *  $ echo "link tx rx" >someled/mode
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    93
+ *
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    94
+ *  Modem-style tx/rx LEDs:
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    95
+ *  $ echo netdev >led1/trigger
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    96
+ *  $ echo ppp0 >led1/device_name
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    97
+ *  $ echo tx >led1/mode
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    98
+ *  $ echo netdev >led2/trigger
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
    99
+ *  $ echo ppp0 >led2/device_name
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   100
+ *  $ echo rx >led2/mode
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   101
+ *
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   102
+ */
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   103
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   104
+#define MODE_LINK 1
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   105
+#define MODE_TX	  2
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   106
+#define MODE_RX	  4
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   107
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   108
+struct led_netdev_data {
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   109
+	rwlock_t lock;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   110
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   111
+	struct timer_list timer;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   112
+	struct notifier_block notifier;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   113
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   114
+	struct led_classdev *led_cdev;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   115
+	struct net_device *net_dev;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   116
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   117
+	char device_name[IFNAMSIZ];
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   118
+	unsigned interval;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   119
+	unsigned mode;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   120
+	unsigned link_up;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   121
+	unsigned last_activity;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   122
+};
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   123
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   124
+static void set_baseline_state(struct led_netdev_data *trigger_data)
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   125
+{
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   126
+	if ((trigger_data->mode & MODE_LINK) != 0 && trigger_data->link_up)
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   127
+		led_set_brightness(trigger_data->led_cdev, LED_FULL);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   128
+	else
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   129
+		led_set_brightness(trigger_data->led_cdev, LED_OFF);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   130
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   131
+	if ((trigger_data->mode & (MODE_TX | MODE_RX)) != 0 &&
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   132
+	    trigger_data->link_up)
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   133
+		mod_timer(&trigger_data->timer,
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   134
+			  jiffies + trigger_data->interval);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   135
+	else
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   136
+		del_timer(&trigger_data->timer);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   137
+}
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   138
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   139
+static ssize_t led_device_name_show(struct device *dev,
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   140
+				    struct device_attribute *attr, char *buf)
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   141
+{
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   142
+	struct led_classdev *led_cdev = dev_get_drvdata(dev);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   143
+	struct led_netdev_data *trigger_data = led_cdev->trigger_data;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   144
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   145
+	read_lock(&trigger_data->lock);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   146
+	sprintf(buf, "%s\n", trigger_data->device_name);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   147
+	read_unlock(&trigger_data->lock);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   148
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   149
+	return strlen(buf) + 1;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   150
+}
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   151
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   152
+static ssize_t led_device_name_store(struct device *dev,
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   153
+				     struct device_attribute *attr,
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   154
+				     const char *buf, size_t size)
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   155
+{
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   156
+	struct led_classdev *led_cdev = dev_get_drvdata(dev);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   157
+	struct led_netdev_data *trigger_data = led_cdev->trigger_data;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   158
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   159
+	if (size < 0 || size >= IFNAMSIZ)
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   160
+		return -EINVAL;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   161
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   162
+	write_lock(&trigger_data->lock);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   163
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   164
+	strcpy(trigger_data->device_name, buf);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   165
+	if (size > 0 && trigger_data->device_name[size-1] == '\n')
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   166
+		trigger_data->device_name[size-1] = 0;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   167
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   168
+	if (trigger_data->device_name[0] != 0) {
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   169
+		/* check for existing device to update from */
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   170
+		struct net_device *dev =
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   171
+			dev_get_by_name(&init_net, trigger_data->device_name);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   172
+		if (dev != NULL) {
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   173
+			unsigned int flags = dev_get_flags(dev);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   174
+			trigger_data->net_dev = dev;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   175
+			trigger_data->link_up = (flags & IFF_LOWER_UP) != 0;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   176
+		}
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   177
+		/* updates LEDs, may start timers */
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   178
+		set_baseline_state(trigger_data);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   179
+	}
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   180
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   181
+	write_unlock(&trigger_data->lock);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   182
+	return size;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   183
+}
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   184
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   185
+static DEVICE_ATTR(device_name, 0644,
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   186
+		   led_device_name_show, led_device_name_store);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   187
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   188
+static ssize_t led_mode_show(struct device *dev,
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   189
+			     struct device_attribute *attr, char *buf)
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   190
+{
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   191
+	struct led_classdev *led_cdev = dev_get_drvdata(dev);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   192
+	struct led_netdev_data *trigger_data = led_cdev->trigger_data;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   193
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   194
+	read_lock(&trigger_data->lock);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   195
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   196
+	if (trigger_data->mode == 0) {
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   197
+		strcpy(buf, "none\n");
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   198
+	} else {
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   199
+		if (trigger_data->mode & MODE_LINK)
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   200
+			strcat(buf, "link ");
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   201
+		if (trigger_data->mode & MODE_TX)
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   202
+			strcat(buf, "tx ");
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   203
+		if (trigger_data->mode & MODE_RX)
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   204
+			strcat(buf, "rx ");
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   205
+		strcat(buf, "\n");
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   206
+	}
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   207
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   208
+	read_unlock(&trigger_data->lock);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   209
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   210
+	return strlen(buf)+1;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   211
+}
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   212
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   213
+static ssize_t led_mode_store(struct device *dev,
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   214
+			      struct device_attribute *attr,
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   215
+			      const char *buf, size_t size)
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   216
+{
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   217
+	struct led_classdev *led_cdev = dev_get_drvdata(dev);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   218
+	struct led_netdev_data *trigger_data = led_cdev->trigger_data;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   219
+	char copybuf[32];
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   220
+	int new_mode = -1;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   221
+	char *p, *token;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   222
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   223
+	/* take a copy since we don't want to trash the inbound buffer
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   224
+	   when using strsep */
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   225
+	strncpy(copybuf, buf, sizeof(copybuf));
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   226
+	copybuf[sizeof(copybuf) - 1] = '\0';
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   227
+	p = copybuf;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   228
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   229
+	while ((token = strsep(&p, " \t\n")) != NULL) {
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   230
+		if (!*token)
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   231
+			continue;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   232
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   233
+		if (new_mode == -1)
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   234
+			new_mode = 0;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   235
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   236
+		if (!strcmp(token, "none"))
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   237
+			new_mode = 0;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   238
+		else if (!strcmp(token, "tx"))
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   239
+			new_mode |= MODE_TX;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   240
+		else if (!strcmp(token, "rx"))
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   241
+			new_mode |= MODE_RX;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   242
+		else if (!strcmp(token, "link"))
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   243
+			new_mode |= MODE_LINK;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   244
+		else
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   245
+			return -EINVAL;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   246
+	}
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   247
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   248
+	if (new_mode == -1)
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   249
+		return -EINVAL;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   250
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   251
+	write_lock(&trigger_data->lock);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   252
+	trigger_data->mode = new_mode;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   253
+	set_baseline_state(trigger_data);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   254
+	write_unlock(&trigger_data->lock);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   255
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   256
+	return size;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   257
+}
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   258
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   259
+static DEVICE_ATTR(mode, 0644, led_mode_show, led_mode_store);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   260
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   261
+static ssize_t led_interval_show(struct device *dev,
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   262
+				 struct device_attribute *attr,
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   263
+				 char *buf)
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   264
+{
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   265
+	struct led_classdev *led_cdev = dev_get_drvdata(dev);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   266
+	struct led_netdev_data *trigger_data = led_cdev->trigger_data;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   267
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   268
+	read_lock(&trigger_data->lock);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   269
+	sprintf(buf, "%u\n", jiffies_to_msecs(trigger_data->interval));
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   270
+	read_unlock(&trigger_data->lock);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   271
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   272
+	return strlen(buf) + 1;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   273
+}
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   274
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   275
+static ssize_t led_interval_store(struct device *dev,
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   276
+				  struct device_attribute *attr,
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   277
+				  const char *buf, size_t size)
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   278
+{
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   279
+	struct led_classdev *led_cdev = dev_get_drvdata(dev);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   280
+	struct led_netdev_data *trigger_data = led_cdev->trigger_data;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   281
+	int ret = -EINVAL;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   282
+	char *after;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   283
+	unsigned long value = simple_strtoul(buf, &after, 10);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   284
+	size_t count = after - buf;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   285
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   286
+	if (*after && isspace(*after))
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   287
+		count++;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   288
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   289
+	/* impose some basic bounds on the timer interval */
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   290
+	if (count == size && value >= 5 && value <= 10000) {
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   291
+		write_lock(&trigger_data->lock);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   292
+		trigger_data->interval = msecs_to_jiffies(value);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   293
+		set_baseline_state(trigger_data);	/* resets timer */
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   294
+		write_unlock(&trigger_data->lock);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   295
+		ret = count;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   296
+	}
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   297
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   298
+	return ret;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   299
+}
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   300
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   301
+static DEVICE_ATTR(interval, 0644, led_interval_show, led_interval_store);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   302
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   303
+static int netdev_trig_notify(struct notifier_block *nb,
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   304
+			      unsigned long evt,
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   305
+			      void *dv)
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   306
+{
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   307
+	struct net_device *dev = dv;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   308
+	struct led_netdev_data *trigger_data =
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   309
+		container_of(nb, struct led_netdev_data, notifier);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   310
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   311
+	if (evt != NETDEV_UP && evt != NETDEV_DOWN && evt != NETDEV_CHANGE &&
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   312
+	    evt != NETDEV_REGISTER && evt != NETDEV_UNREGISTER)
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   313
+		return NOTIFY_DONE;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   314
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   315
+	write_lock(&trigger_data->lock);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   316
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   317
+	if (strcmp(dev->name, trigger_data->device_name))
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   318
+		goto done;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   319
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   320
+	if (evt == NETDEV_REGISTER) {
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   321
+		if (trigger_data->net_dev != NULL)
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   322
+			dev_put(trigger_data->net_dev);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   323
+		dev_hold(dev);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   324
+		trigger_data->net_dev = dev;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   325
+		trigger_data->link_up = 0;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   326
+		goto done;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   327
+	}
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   328
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   329
+	if (evt == NETDEV_UNREGISTER && trigger_data->net_dev != NULL) {
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   330
+		dev_put(trigger_data->net_dev);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   331
+		trigger_data->net_dev = NULL;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   332
+		goto done;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   333
+	}
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   334
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   335
+	/* UP / DOWN / CHANGE */
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   336
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   337
+	trigger_data->link_up = (evt != NETDEV_DOWN && netif_carrier_ok(dev));
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   338
+	set_baseline_state(trigger_data);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   339
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   340
+done:
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   341
+	write_unlock(&trigger_data->lock);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   342
+	return NOTIFY_DONE;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   343
+}
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   344
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   345
+/* here's the real work! */
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   346
+static void netdev_trig_timer(unsigned long arg)
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   347
+{
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   348
+	struct led_netdev_data *trigger_data = (struct led_netdev_data *)arg;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   349
+	struct rtnl_link_stats64 temp;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   350
+	const struct rtnl_link_stats64 *dev_stats;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   351
+	unsigned new_activity;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   352
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   353
+	write_lock(&trigger_data->lock);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   354
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   355
+	if (!trigger_data->link_up || !trigger_data->net_dev ||
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   356
+	    (trigger_data->mode & (MODE_TX | MODE_RX)) == 0) {
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   357
+		/* we don't need to do timer work, just reflect link state. */
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   358
+		int on = (trigger_data->mode & MODE_LINK) != 0 &&
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   359
+			trigger_data->link_up;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   360
+		led_set_brightness(trigger_data->led_cdev,
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   361
+				   on ? LED_FULL : LED_OFF);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   362
+		goto no_restart;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   363
+	}
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   364
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   365
+	dev_stats = dev_get_stats(trigger_data->net_dev, &temp);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   366
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   367
+	new_activity =
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   368
+		((trigger_data->mode & MODE_TX) ? dev_stats->tx_packets : 0) +
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   369
+		((trigger_data->mode & MODE_RX) ? dev_stats->rx_packets : 0);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   370
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   371
+	if (trigger_data->mode & MODE_LINK) {
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   372
+		/* base state is ON (link present) */
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   373
+		/* if there's no link, we don't get this far
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   374
+		   and the LED is off */
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   375
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   376
+		/* OFF -> ON always */
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   377
+		/* ON -> OFF on activity */
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   378
+		if (trigger_data->led_cdev->brightness == LED_OFF)
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   379
+			led_set_brightness(trigger_data->led_cdev, LED_FULL);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   380
+		else if (trigger_data->last_activity != new_activity)
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   381
+			led_set_brightness(trigger_data->led_cdev, LED_OFF);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   382
+	} else {
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   383
+		/* base state is OFF */
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   384
+		/* ON -> OFF always */
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   385
+		/* OFF -> ON on activity */
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   386
+		if (trigger_data->led_cdev->brightness == LED_FULL)
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   387
+			led_set_brightness(trigger_data->led_cdev, LED_OFF);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   388
+		else if (trigger_data->last_activity != new_activity)
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   389
+			led_set_brightness(trigger_data->led_cdev, LED_FULL);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   390
+	}
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   391
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   392
+	trigger_data->last_activity = new_activity;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   393
+	mod_timer(&trigger_data->timer, jiffies + trigger_data->interval);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   394
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   395
+no_restart:
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   396
+	write_unlock(&trigger_data->lock);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   397
+}
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   398
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   399
+static void netdev_trig_activate(struct led_classdev *led_cdev)
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   400
+{
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   401
+	struct led_netdev_data *trigger_data;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   402
+	int rc;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   403
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   404
+	trigger_data = kzalloc(sizeof(struct led_netdev_data), GFP_KERNEL);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   405
+	if (!trigger_data)
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   406
+		return;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   407
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   408
+	rwlock_init(&trigger_data->lock);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   409
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   410
+	trigger_data->notifier.notifier_call = netdev_trig_notify;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   411
+	trigger_data->notifier.priority = 10;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   412
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   413
+	setup_timer(&trigger_data->timer, netdev_trig_timer,
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   414
+		    (unsigned long) trigger_data);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   415
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   416
+	trigger_data->led_cdev = led_cdev;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   417
+	trigger_data->net_dev = NULL;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   418
+	trigger_data->device_name[0] = 0;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   419
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   420
+	trigger_data->mode = 0;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   421
+	trigger_data->interval = msecs_to_jiffies(50);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   422
+	trigger_data->link_up = 0;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   423
+	trigger_data->last_activity = 0;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   424
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   425
+	led_cdev->trigger_data = trigger_data;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   426
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   427
+	rc = device_create_file(led_cdev->dev, &dev_attr_device_name);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   428
+	if (rc)
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   429
+		goto err_out;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   430
+	rc = device_create_file(led_cdev->dev, &dev_attr_mode);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   431
+	if (rc)
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   432
+		goto err_out_device_name;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   433
+	rc = device_create_file(led_cdev->dev, &dev_attr_interval);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   434
+	if (rc)
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   435
+		goto err_out_mode;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   436
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   437
+	register_netdevice_notifier(&trigger_data->notifier);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   438
+	return;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   439
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   440
+err_out_mode:
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   441
+	device_remove_file(led_cdev->dev, &dev_attr_mode);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   442
+err_out_device_name:
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   443
+	device_remove_file(led_cdev->dev, &dev_attr_device_name);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   444
+err_out:
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   445
+	led_cdev->trigger_data = NULL;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   446
+	kfree(trigger_data);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   447
+}
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   448
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   449
+static void netdev_trig_deactivate(struct led_classdev *led_cdev)
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   450
+{
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   451
+	struct led_netdev_data *trigger_data = led_cdev->trigger_data;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   452
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   453
+	if (trigger_data) {
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   454
+		unregister_netdevice_notifier(&trigger_data->notifier);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   455
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   456
+		device_remove_file(led_cdev->dev, &dev_attr_device_name);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   457
+		device_remove_file(led_cdev->dev, &dev_attr_mode);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   458
+		device_remove_file(led_cdev->dev, &dev_attr_interval);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   459
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   460
+		write_lock(&trigger_data->lock);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   461
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   462
+		if (trigger_data->net_dev) {
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   463
+			dev_put(trigger_data->net_dev);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   464
+			trigger_data->net_dev = NULL;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   465
+		}
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   466
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   467
+		write_unlock(&trigger_data->lock);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   468
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   469
+		del_timer_sync(&trigger_data->timer);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   470
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   471
+		kfree(trigger_data);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   472
+	}
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   473
+}
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   474
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   475
+static struct led_trigger netdev_led_trigger = {
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   476
+	.name	  = "netdev",
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   477
+	.activate = netdev_trig_activate,
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   478
+	.deactivate = netdev_trig_deactivate,
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   479
+};
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   480
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   481
+static int __init netdev_trig_init(void)
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   482
+{
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   483
+	return led_trigger_register(&netdev_led_trigger);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   484
+}
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   485
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   486
+static void __exit netdev_trig_exit(void)
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   487
+{
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   488
+	led_trigger_unregister(&netdev_led_trigger);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   489
+}
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   490
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   491
+module_init(netdev_trig_init);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   492
+module_exit(netdev_trig_exit);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   493
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   494
+MODULE_AUTHOR("Oliver Jowett <oliver@opencloud.com>");
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   495
+MODULE_DESCRIPTION("Netdev LED trigger");
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   496
+MODULE_LICENSE("GPL");
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   497
diff -purN linux-3.11.orig/drivers/leds/trigger/ledtrig-sata-disk.c linux-3.11/drivers/leds/trigger/ledtrig-sata-disk.c
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   498
--- linux-3.11.orig/drivers/leds/trigger/ledtrig-sata-disk.c	1970-01-01 01:00:00.000000000 +0100
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   499
+++ linux-3.11/drivers/leds/trigger/ledtrig-sata-disk.c	2013-09-12 23:10:19.343331257 +0200
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   500
@@ -0,0 +1,64 @@
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   501
+/*
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   502
+ * LED SATA-Disk Activity Trigger
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   503
+ *
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   504
+ * Copyright 2006 Openedhand Ltd.
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   505
+ *
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   506
+ * Author: Richard Purdie <rpurdie@openedhand.com>
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   507
+ *
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   508
+ * This program is free software; you can redistribute it and/or modify
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   509
+ * it under the terms of the GNU General Public License version 2 as
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   510
+ * published by the Free Software Foundation.
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   511
+ *
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   512
+ */
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   513
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   514
+#include <linux/module.h>
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   515
+#include <linux/jiffies.h>
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   516
+#include <linux/kernel.h>
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   517
+#include <linux/init.h>
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   518
+#include <linux/timer.h>
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   519
+#include <linux/leds.h>
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   520
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   521
+static void ledtrig_sata_timerfunc(unsigned long data);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   522
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   523
+DEFINE_LED_TRIGGER(ledtrig_sata);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   524
+static DEFINE_TIMER(ledtrig_sata_timer, ledtrig_sata_timerfunc, 0, 0);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   525
+static int sata_activity;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   526
+static int sata_lastactivity;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   527
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   528
+void ledtrig_sata_activity(void)
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   529
+{
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   530
+	sata_activity++;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   531
+	if (!timer_pending(&ledtrig_sata_timer))
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   532
+		mod_timer(&ledtrig_sata_timer, jiffies + msecs_to_jiffies(10));
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   533
+}
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   534
+EXPORT_SYMBOL(ledtrig_sata_activity);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   535
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   536
+static void ledtrig_sata_timerfunc(unsigned long data)
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   537
+{
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   538
+	if (sata_lastactivity != sata_activity) {
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   539
+		sata_lastactivity = sata_activity;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   540
+		/* INT_MAX will set each LED to its maximum brightness */
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   541
+		led_trigger_event(ledtrig_sata, INT_MAX);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   542
+		mod_timer(&ledtrig_sata_timer, jiffies + msecs_to_jiffies(10));
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   543
+	} else {
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   544
+		led_trigger_event(ledtrig_sata, LED_OFF);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   545
+	}
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   546
+}
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   547
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   548
+static int __init ledtrig_sata_init(void)
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   549
+{
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   550
+	led_trigger_register_simple("sata-disk", &ledtrig_sata);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   551
+	return 0;
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   552
+}
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   553
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   554
+static void __exit ledtrig_sata_exit(void)
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   555
+{
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   556
+	led_trigger_unregister_simple(ledtrig_sata);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   557
+}
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   558
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   559
+module_init(ledtrig_sata_init);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   560
+module_exit(ledtrig_sata_exit);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   561
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   562
+MODULE_AUTHOR("Richard Purdie <rpurdie@openedhand.com>");
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   563
+MODULE_DESCRIPTION("LED IDE Disk Activity Trigger");
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   564
+MODULE_LICENSE("GPL");
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   565
diff -purN linux-3.11.orig/drivers/leds/trigger/Makefile linux-3.11/drivers/leds/trigger/Makefile
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   566
--- linux-3.11.orig/drivers/leds/trigger/Makefile	2013-09-02 22:46:10.000000000 +0200
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   567
+++ linux-3.11/drivers/leds/trigger/Makefile	2013-09-12 23:10:19.343331257 +0200
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   568
@@ -1,6 +1,8 @@
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   569
 obj-$(CONFIG_LEDS_TRIGGER_TIMER)	+= ledtrig-timer.o
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   570
 obj-$(CONFIG_LEDS_TRIGGER_ONESHOT)	+= ledtrig-oneshot.o
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   571
 obj-$(CONFIG_LEDS_TRIGGER_IDE_DISK)	+= ledtrig-ide-disk.o
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   572
+obj-$(CONFIG_LEDS_TRIGGER_SATA_DISK)	+= ledtrig-sata-disk.o
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   573
+obj-$(CONFIG_LEDS_TRIGGER_NETDEV)      += ledtrig-netdev.o 
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   574
 obj-$(CONFIG_LEDS_TRIGGER_HEARTBEAT)	+= ledtrig-heartbeat.o
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   575
 obj-$(CONFIG_LEDS_TRIGGER_BACKLIGHT)	+= ledtrig-backlight.o
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   576
 obj-$(CONFIG_LEDS_TRIGGER_GPIO)		+= ledtrig-gpio.o
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   577
diff -purN linux-3.11.orig/include/linux/leds.h linux-3.11/include/linux/leds.h
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   578
--- linux-3.11.orig/include/linux/leds.h	2013-09-02 22:46:10.000000000 +0200
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   579
+++ linux-3.11/include/linux/leds.h	2013-09-12 23:10:19.346664574 +0200
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   580
@@ -226,6 +226,12 @@ static inline void ledtrig_flash_ctrl(bo
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   581
 static inline void ledtrig_torch_ctrl(bool on) {}
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   582
 #endif
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   583
 
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   584
+#ifdef CONFIG_LEDS_TRIGGER_SATA_DISK
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   585
+extern void ledtrig_sata_activity(void);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   586
+#else
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   587
+#define ledtrig_sata_activity() do {} while(0)
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   588
+#endif
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   589
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   590
 /*
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   591
  * Generic LED platform data for describing LED names and default triggers.
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   592
  */
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   593
diff -purN linux-3.11.orig/drivers/ata/sata_mv.c linux-3.11/drivers/ata/sata_mv.c
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   594
--- linux-3.11.orig/drivers/ata/sata_mv.c	2013-09-02 22:46:10.000000000 +0200
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   595
+++ linux-3.11/drivers/ata/sata_mv.c	2013-09-12 23:10:19.343331257 +0200
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   596
@@ -71,6 +71,7 @@
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   597
 #include <scsi/scsi_cmnd.h>
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   598
 #include <scsi/scsi_device.h>
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   599
 #include <linux/libata.h>
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   600
+#include <linux/leds.h>
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   601
 
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   602
 #define DRV_NAME	"sata_mv"
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   603
 #define DRV_VERSION	"1.28"
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   604
@@ -1156,6 +1157,8 @@ static void mv_start_edma(struct ata_por
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   605
 {
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   606
 	int want_ncq = (protocol == ATA_PROT_NCQ);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   607
 
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   608
+	ledtrig_sata_activity();
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   609
+
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   610
 	if (pp->pp_flags & MV_PP_FLAG_EDMA_EN) {
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   611
 		int using_ncq = ((pp->pp_flags & MV_PP_FLAG_NCQ_EN) != 0);
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   612
 		if (want_ncq != using_ncq)
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   613
--- linux-3.11/arch/arm/mach-kirkwood/dns320l-setup.c.orig	2013-10-15 18:55:07.894007006 +0200
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   614
+++ linux-3.11/arch/arm/mach-kirkwood/dns320l-setup.c	2013-10-15 18:55:33.193954386 +0200
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   615
@@ -155,12 +155,12 @@ static struct gpio_led dns320l_led_pins[
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   616
 	{
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   617
 	    .name   = "dns320l:blue:sata0",
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   618
 	    .gpio   = DNS320L_GPIO_LED_SATA0_BLUE,
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   619
-	    .default_trigger = "ide-disk"
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   620
+	    .default_trigger = "sata-disk"
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   621
 	},
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   622
 	{
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   623
 	    .name   = "dns320l:blue:sata1",
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   624
 	    .gpio   = DNS320L_GPIO_LED_SATA1_BLUE,
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   625
-	    .default_trigger = "ide-disk"
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   626
+	    .default_trigger = "sata-disk"
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   627
 	},
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   628
 	{
35c0804c8ca2 Add Arch PKGBUILD scripts to build linux-dns320l based on Linux 3.11.1
Andreas Boehler <andreas _AT_ aboehler.at>
parents:
diff changeset
   629
 	    .name   = "dns320l:red:sata0",