X-Git-Url: http://git.rohieb.name/openwrt.git/blobdiff_plain/6c853478d6a9ef2ebf74d438fc343ae0b5f0e786..55772106df5081ba35e492d6ab85f5cb4cee4af0:/target/linux/generic/files/drivers/net/phy/swconfig.c diff --git a/target/linux/generic/files/drivers/net/phy/swconfig.c b/target/linux/generic/files/drivers/net/phy/swconfig.c index 88fa244bc..1f4491ac5 100644 --- a/target/linux/generic/files/drivers/net/phy/swconfig.c +++ b/target/linux/generic/files/drivers/net/phy/swconfig.c @@ -33,6 +33,8 @@ #define SWCONFIG_DEVNAME "switch%d" +#include "swconfig_leds.c" + MODULE_AUTHOR("Felix Fietkau "); MODULE_LICENSE("GPL"); @@ -863,6 +865,7 @@ register_switch(struct switch_dev *dev, struct net_device *netdev) struct switch_dev *sdev; const int max_switches = 8 * sizeof(unsigned long); unsigned long in_use = 0; + int err; int i; INIT_LIST_HEAD(&dev->dev_list); @@ -894,8 +897,10 @@ register_switch(struct switch_dev *dev, struct net_device *netdev) } i = find_first_zero_bit(&in_use, max_switches); - if (i == max_switches) + if (i == max_switches) { + swconfig_unlock(); return -ENFILE; + } /* fill device name */ snprintf(dev->devname, IFNAMSIZ, SWCONFIG_DEVNAME, i); @@ -903,6 +908,10 @@ register_switch(struct switch_dev *dev, struct net_device *netdev) list_add(&dev->dev_list, &swdevs); swconfig_unlock(); + err = swconfig_create_led_trigger(dev); + if (err) + return err; + return 0; } EXPORT_SYMBOL_GPL(register_switch); @@ -910,6 +919,7 @@ EXPORT_SYMBOL_GPL(register_switch); void unregister_switch(struct switch_dev *dev) { + swconfig_destroy_led_trigger(dev); kfree(dev->portbuf); spin_lock(&dev->lock); swconfig_lock();