Changeset 47962


Ignore:
Timestamp:
2015-12-23T11:17:09+01:00 (2 years ago)
Author:
rmilecki
Message:

ledtrig-netdev: update base driver instead of patching it for every kernel

All supported kernels require patching ledtrig-netdev in the same way,
so it's safe to just move these changes to the base version of this
driver. We needed these patches for some old kernels 2.6.36 and 3.11.

Signed-off-by: Rafał Miłecki <zajec5@…>

Location:
trunk/target/linux/generic
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/target/linux/generic/files/drivers/leds/ledtrig-netdev.c

    r41293 r47962  
    2323#include <linux/spinlock.h> 
    2424#include <linux/device.h> 
    25 #include <linux/sysdev.h> 
    2625#include <linux/netdevice.h> 
    2726#include <linux/timer.h> 
     
    255254                              void *dv) 
    256255{ 
    257         struct net_device *dev = dv; 
     256        struct net_device *dev = netdev_notifier_info_to_dev((struct netdev_notifier_info *) dv); 
    258257        struct led_netdev_data *trigger_data = container_of(nb, struct led_netdev_data, notifier); 
    259258 
     
    295294{ 
    296295        struct led_netdev_data *trigger_data = (struct led_netdev_data *)arg; 
    297         const struct net_device_stats *dev_stats; 
     296        struct rtnl_link_stats64 *dev_stats; 
    298297        unsigned new_activity; 
     298        struct rtnl_link_stats64 temp; 
    299299 
    300300        write_lock(&trigger_data->lock); 
     
    306306        } 
    307307 
    308         dev_stats = dev_get_stats(trigger_data->net_dev); 
     308        dev_stats = dev_get_stats(trigger_data->net_dev, &temp); 
    309309        new_activity = 
    310310                ((trigger_data->mode & MODE_TX) ? dev_stats->tx_packets : 0) + 
  • trunk/target/linux/generic/patches-3.18/831-ledtrig_netdev.patch

    r43093 r47962  
    2020 obj-$(CONFIG_LEDS_TRIGGER_MORSE)       += ledtrig-morse.o 
    2121+obj-$(CONFIG_LEDS_TRIGGER_NETDEV)      += ledtrig-netdev.o 
    22 --- a/drivers/leds/ledtrig-netdev.c 
    23 +++ b/drivers/leds/ledtrig-netdev.c 
    24 @@ -22,7 +22,6 @@ 
    25  #include <linux/list.h> 
    26  #include <linux/spinlock.h> 
    27  #include <linux/device.h> 
    28 -#include <linux/sysdev.h> 
    29  #include <linux/netdevice.h> 
    30  #include <linux/timer.h> 
    31  #include <linux/ctype.h> 
    32 @@ -254,7 +253,7 @@ static int netdev_trig_notify(struct not 
    33                               unsigned long evt, 
    34                               void *dv) 
    35  { 
    36 -       struct net_device *dev = dv; 
    37 +       struct net_device *dev = netdev_notifier_info_to_dev((struct netdev_notifier_info *) dv); 
    38         struct led_netdev_data *trigger_data = container_of(nb, struct led_netdev_data, notifier); 
    39   
    40         if (evt != NETDEV_UP && evt != NETDEV_DOWN && evt != NETDEV_CHANGE && evt != NETDEV_REGISTER && evt != NETDEV_UNREGISTER) 
    41 @@ -294,8 +293,9 @@ done: 
    42  static void netdev_trig_timer(unsigned long arg) 
    43  { 
    44         struct led_netdev_data *trigger_data = (struct led_netdev_data *)arg; 
    45 -       const struct net_device_stats *dev_stats; 
    46 +       struct rtnl_link_stats64 *dev_stats; 
    47         unsigned new_activity; 
    48 +       struct rtnl_link_stats64 temp; 
    49   
    50         write_lock(&trigger_data->lock); 
    51   
    52 @@ -305,7 +305,7 @@ static void netdev_trig_timer(unsigned l 
    53                 goto no_restart; 
    54         } 
    55   
    56 -       dev_stats = dev_get_stats(trigger_data->net_dev); 
    57 +       dev_stats = dev_get_stats(trigger_data->net_dev, &temp); 
    58         new_activity = 
    59                 ((trigger_data->mode & MODE_TX) ? dev_stats->tx_packets : 0) + 
    60                 ((trigger_data->mode & MODE_RX) ? dev_stats->rx_packets : 0); 
  • trunk/target/linux/generic/patches-4.1/831-ledtrig_netdev.patch

    r46112 r47962  
    2020 obj-$(CONFIG_LEDS_TRIGGER_MORSE)       += ledtrig-morse.o 
    2121+obj-$(CONFIG_LEDS_TRIGGER_NETDEV)      += ledtrig-netdev.o 
    22 --- a/drivers/leds/ledtrig-netdev.c 
    23 +++ b/drivers/leds/ledtrig-netdev.c 
    24 @@ -22,7 +22,6 @@ 
    25  #include <linux/list.h> 
    26  #include <linux/spinlock.h> 
    27  #include <linux/device.h> 
    28 -#include <linux/sysdev.h> 
    29  #include <linux/netdevice.h> 
    30  #include <linux/timer.h> 
    31  #include <linux/ctype.h> 
    32 @@ -254,7 +253,7 @@ static int netdev_trig_notify(struct not 
    33                               unsigned long evt, 
    34                               void *dv) 
    35  { 
    36 -       struct net_device *dev = dv; 
    37 +       struct net_device *dev = netdev_notifier_info_to_dev((struct netdev_notifier_info *) dv); 
    38         struct led_netdev_data *trigger_data = container_of(nb, struct led_netdev_data, notifier); 
    39   
    40         if (evt != NETDEV_UP && evt != NETDEV_DOWN && evt != NETDEV_CHANGE && evt != NETDEV_REGISTER && evt != NETDEV_UNREGISTER) 
    41 @@ -294,8 +293,9 @@ done: 
    42  static void netdev_trig_timer(unsigned long arg) 
    43  { 
    44         struct led_netdev_data *trigger_data = (struct led_netdev_data *)arg; 
    45 -       const struct net_device_stats *dev_stats; 
    46 +       struct rtnl_link_stats64 *dev_stats; 
    47         unsigned new_activity; 
    48 +       struct rtnl_link_stats64 temp; 
    49   
    50         write_lock(&trigger_data->lock); 
    51   
    52 @@ -305,7 +305,7 @@ static void netdev_trig_timer(unsigned l 
    53                 goto no_restart; 
    54         } 
    55   
    56 -       dev_stats = dev_get_stats(trigger_data->net_dev); 
    57 +       dev_stats = dev_get_stats(trigger_data->net_dev, &temp); 
    58         new_activity = 
    59                 ((trigger_data->mode & MODE_TX) ? dev_stats->tx_packets : 0) + 
    60                 ((trigger_data->mode & MODE_RX) ? dev_stats->rx_packets : 0); 
  • trunk/target/linux/generic/patches-4.3/831-ledtrig_netdev.patch

    r47182 r47962  
    2020 obj-$(CONFIG_LEDS_TRIGGER_MORSE)       += ledtrig-morse.o 
    2121+obj-$(CONFIG_LEDS_TRIGGER_NETDEV)      += ledtrig-netdev.o 
    22 --- a/drivers/leds/ledtrig-netdev.c 
    23 +++ b/drivers/leds/ledtrig-netdev.c 
    24 @@ -22,7 +22,6 @@ 
    25  #include <linux/list.h> 
    26  #include <linux/spinlock.h> 
    27  #include <linux/device.h> 
    28 -#include <linux/sysdev.h> 
    29  #include <linux/netdevice.h> 
    30  #include <linux/timer.h> 
    31  #include <linux/ctype.h> 
    32 @@ -254,7 +253,7 @@ static int netdev_trig_notify(struct not 
    33                               unsigned long evt, 
    34                               void *dv) 
    35  { 
    36 -       struct net_device *dev = dv; 
    37 +       struct net_device *dev = netdev_notifier_info_to_dev((struct netdev_notifier_info *) dv); 
    38         struct led_netdev_data *trigger_data = container_of(nb, struct led_netdev_data, notifier); 
    39   
    40         if (evt != NETDEV_UP && evt != NETDEV_DOWN && evt != NETDEV_CHANGE && evt != NETDEV_REGISTER && evt != NETDEV_UNREGISTER) 
    41 @@ -294,8 +293,9 @@ done: 
    42  static void netdev_trig_timer(unsigned long arg) 
    43  { 
    44         struct led_netdev_data *trigger_data = (struct led_netdev_data *)arg; 
    45 -       const struct net_device_stats *dev_stats; 
    46 +       struct rtnl_link_stats64 *dev_stats; 
    47         unsigned new_activity; 
    48 +       struct rtnl_link_stats64 temp; 
    49   
    50         write_lock(&trigger_data->lock); 
    51   
    52 @@ -305,7 +305,7 @@ static void netdev_trig_timer(unsigned l 
    53                 goto no_restart; 
    54         } 
    55   
    56 -       dev_stats = dev_get_stats(trigger_data->net_dev); 
    57 +       dev_stats = dev_get_stats(trigger_data->net_dev, &temp); 
    58         new_activity = 
    59                 ((trigger_data->mode & MODE_TX) ? dev_stats->tx_packets : 0) + 
    60                 ((trigger_data->mode & MODE_RX) ? dev_stats->rx_packets : 0); 
  • trunk/target/linux/generic/patches-4.4/831-ledtrig_netdev.patch

    r47701 r47962  
    2020 obj-$(CONFIG_LEDS_TRIGGER_MORSE)       += ledtrig-morse.o 
    2121+obj-$(CONFIG_LEDS_TRIGGER_NETDEV)      += ledtrig-netdev.o 
    22 --- a/drivers/leds/ledtrig-netdev.c 
    23 +++ b/drivers/leds/ledtrig-netdev.c 
    24 @@ -22,7 +22,6 @@ 
    25  #include <linux/list.h> 
    26  #include <linux/spinlock.h> 
    27  #include <linux/device.h> 
    28 -#include <linux/sysdev.h> 
    29  #include <linux/netdevice.h> 
    30  #include <linux/timer.h> 
    31  #include <linux/ctype.h> 
    32 @@ -254,7 +253,7 @@ static int netdev_trig_notify(struct not 
    33                               unsigned long evt, 
    34                               void *dv) 
    35  { 
    36 -       struct net_device *dev = dv; 
    37 +       struct net_device *dev = netdev_notifier_info_to_dev((struct netdev_notifier_info *) dv); 
    38         struct led_netdev_data *trigger_data = container_of(nb, struct led_netdev_data, notifier); 
    39   
    40         if (evt != NETDEV_UP && evt != NETDEV_DOWN && evt != NETDEV_CHANGE && evt != NETDEV_REGISTER && evt != NETDEV_UNREGISTER) 
    41 @@ -294,8 +293,9 @@ done: 
    42  static void netdev_trig_timer(unsigned long arg) 
    43  { 
    44         struct led_netdev_data *trigger_data = (struct led_netdev_data *)arg; 
    45 -       const struct net_device_stats *dev_stats; 
    46 +       struct rtnl_link_stats64 *dev_stats; 
    47         unsigned new_activity; 
    48 +       struct rtnl_link_stats64 temp; 
    49   
    50         write_lock(&trigger_data->lock); 
    51   
    52 @@ -305,7 +305,7 @@ static void netdev_trig_timer(unsigned l 
    53                 goto no_restart; 
    54         } 
    55   
    56 -       dev_stats = dev_get_stats(trigger_data->net_dev); 
    57 +       dev_stats = dev_get_stats(trigger_data->net_dev, &temp); 
    58         new_activity = 
    59                 ((trigger_data->mode & MODE_TX) ? dev_stats->tx_packets : 0) + 
    60                 ((trigger_data->mode & MODE_RX) ? dev_stats->rx_packets : 0); 
Note: See TracChangeset for help on using the changeset viewer.