ledtrig-netdev: reset link status & stats after changing device_name
authorRafał Miłecki <zajec5@gmail.com>
Wed, 23 Dec 2015 17:13:04 +0000 (17:13 +0000)
committerRafał Miłecki <zajec5@gmail.com>
Wed, 23 Dec 2015 17:13:04 +0000 (17:13 +0000)
Previously switching to non-existing device (interface) could result in
leaving LED on.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Backport of r47990

SVN-Revision: 47992

target/linux/generic/files/drivers/leds/ledtrig-netdev.c

index 4e0844a5974d64d8d0c3129ae39a228ccd7b6649..4e0fd667b0000a58169fc79f347edc5d6f91ecba 100644 (file)
@@ -122,6 +122,8 @@ static ssize_t led_device_name_store(struct device *dev,
        strcpy(trigger_data->device_name, buf);
        if (size > 0 && trigger_data->device_name[size-1] == '\n')
                trigger_data->device_name[size-1] = 0;
+       trigger_data->link_up = 0;
+       trigger_data->last_activity = 0;
 
        if (trigger_data->device_name[0] != 0) {
                /* check for existing device to update from */