package/broadcom-diag: use broadcast_uevent
[openwrt/openwrt.git] / package / broadcom-diag / src / diag.c
index 11b8f425d960822f33812b4bba94a89e3d43a1df..766a906da055c66c4ce423a65ff31eb32889d7b8 100644 (file)
@@ -30,8 +30,8 @@
 #include <linux/workqueue.h>
 #include <linux/skbuff.h>
 #include <linux/netlink.h>
+#include <linux/kobject.h>
 #include <net/sock.h>
-extern struct sock *uevent_sock;
 extern u64 uevent_next_seqnum(void);
 
 #include "gpio.h"
@@ -110,6 +110,7 @@ enum {
 
        /* Netgear */
        WGT634U,
+       WNR834BV2,
 
        /* Trendware */
        TEW411BRPP,
@@ -266,7 +267,7 @@ static struct platform_t __initdata platforms[] = {
                .name           = "Linksys WRT54G3GV2-VF",
                .buttons        = {
                        { .name = "reset",      .gpio = 1 << 6 },
-                       { .name = "3g",         .gpio = 1 << 4 },
+                       { .name = "3g",         .gpio = 1 << 5 },
                },
                .leds           = {
                        { .name = "power",      .gpio = 1 << 1, .polarity = NORMAL },
@@ -754,6 +755,17 @@ static struct platform_t __initdata platforms[] = {
                        { .name = "power",      .gpio = 1 << 3, .polarity = NORMAL },
                },
        },
+       [WNR834BV2] = {
+               .name           = "Netgear WNR834B V2",
+               .buttons        = {
+                       { .name = "reset",      .gpio = 1 << 6 },
+               },
+               .leds           = {
+                       { .name = "power",      .gpio = 1 << 2, .polarity = NORMAL },
+                       { .name = "diag",       .gpio = 1 << 3, .polarity = NORMAL },
+                       { .name = "connected",  .gpio = 1 << 7, .polarity = NORMAL },
+               },
+       },
        /* Trendware */
        [TEW411BRPP] = {
                .name           = "Trendware TEW411BRP+",
@@ -1035,6 +1047,12 @@ static struct platform_t __init *platform_detect(void)
                        return &platforms[WDNetCenter];
                }
 
+               if ((!strcmp(boardnum, "08") || !strcmp(boardnum, "01")) &&
+                               !strcmp(boardtype,"0x0472") && !strcmp(getvar("cardbus"), "1")) { /* Netgear WNR834B  V1 and V2*/
+                       /* TODO: Check for version. Default platform is V2 for now. */
+                       return &platforms[WNR834BV2];
+               }
+
        } else { /* PMON based - old stuff */
                if ((simple_strtoul(getvar("GemtekPmonVer"), NULL, 0) == 9) &&
                        (simple_strtoul(getvar("et0phyaddr"), NULL, 0) == 30)) {
@@ -1101,7 +1119,7 @@ static struct platform_t __init *platform_detect(void)
                return &platforms[TEW411BRPP];
        }
 
-       if (startswith(boardnum, "04FN52")) /* SimpleTech SimpleShare */
+       if (startswith(boardnum, "04FN")) /* SimpleTech SimpleShare */
                return &platforms[STI_NAS];
 
        if (!strcmp(getvar("boardnum"), "10") && !strcmp(getvar("boardrev"), "0x13")) /* D-Link DWL-3150 */
@@ -1151,9 +1169,6 @@ static void hotplug_button(struct work_struct *work)
        struct event_t *event = container_of(work, struct event_t, wq);
        char *s;
 
-       if (!uevent_sock)
-               return;
-
        event->skb = alloc_skb(2048, GFP_KERNEL);
 
        s = skb_put(event->skb, strlen(event->action) + 2);
@@ -1161,7 +1176,7 @@ static void hotplug_button(struct work_struct *work)
        fill_event(event);
 
        NETLINK_CB(event->skb).dst_group = 1;
-       netlink_broadcast(uevent_sock, event->skb, 0, 1, GFP_KERNEL);
+       broadcast_uevent(event->skb, 0, 1, GFP_KERNEL);
 
        kfree(event);
 }