[generic] rtl8366: fix rtl8366_smi_detect() after r29677
[openwrt.git] / target / linux / generic / files / drivers / net / phy / swconfig.c
index 88fa244..1f4491a 100644 (file)
@@ -33,6 +33,8 @@
 
 #define SWCONFIG_DEVNAME       "switch%d"
 
 
 #define SWCONFIG_DEVNAME       "switch%d"
 
+#include "swconfig_leds.c"
+
 MODULE_AUTHOR("Felix Fietkau <nbd@openwrt.org>");
 MODULE_LICENSE("GPL");
 
 MODULE_AUTHOR("Felix Fietkau <nbd@openwrt.org>");
 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;
        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);
        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);
 
        }
        i = find_first_zero_bit(&in_use, max_switches);
 
-       if (i == max_switches)
+       if (i == max_switches) {
+               swconfig_unlock();
                return -ENFILE;
                return -ENFILE;
+       }
 
        /* fill device name */
        snprintf(dev->devname, IFNAMSIZ, SWCONFIG_DEVNAME, i);
 
        /* 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();
 
        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);
        return 0;
 }
 EXPORT_SYMBOL_GPL(register_switch);
@@ -910,6 +919,7 @@ EXPORT_SYMBOL_GPL(register_switch);
 void
 unregister_switch(struct switch_dev *dev)
 {
 void
 unregister_switch(struct switch_dev *dev)
 {
+       swconfig_destroy_led_trigger(dev);
        kfree(dev->portbuf);
        spin_lock(&dev->lock);
        swconfig_lock();
        kfree(dev->portbuf);
        spin_lock(&dev->lock);
        swconfig_lock();
This page took 0.022985 seconds and 4 git commands to generate.