stop build when an error occurs and when BUILDLOG is set (#5160)
[openwrt.git] / package / ar7-atm / patches / 170-add-hotplug-status.patch
1 diff -urN sangam_atm-D7.03.01.00.orig/tn7dsl.c sangam_atm-D7.03.01.00/tn7dsl.c
2 --- sangam_atm-D7.03.01.00.orig/tn7dsl.c 2008-01-05 03:11:03.000000000 +0100
3 +++ sangam_atm-D7.03.01.00/tn7dsl.c 2008-01-06 18:13:24.000000000 +0000
4 @@ -109,6 +109,11 @@
5 #include <linux/vmalloc.h>
6 #include <linux/file.h>
7 #include <linux/firmware.h>
8 +#include <linux/skbuff.h>
9 +#include <linux/netlink.h>
10 +#include <net/sock.h>
11 +#include <linux/kobject.h>
12 +#include <asm/uaccess.h>
13
14 #include <asm/io.h>
15 #include <asm/ar7/ar7.h>
16 @@ -296,6 +301,8 @@
17 /* externs */
18 extern struct atm_dev *mydev;
19 extern unsigned int oamFarLBCount[4];
20 +extern struct sock *uevent_sock;
21 +extern u64 uevent_next_seqnum(void);
22
23 /* module wide declars */
24 static PITIDSLHW_T pIhw;
25 @@ -333,6 +340,75 @@
26 return 0;
27 }
28
29 +static inline void add_msg(struct sk_buff *skb, char *msg)
30 +{
31 + char *scratch;
32 + scratch = skb_put(skb, strlen(msg) + 1);
33 + sprintf(scratch, msg);
34 +}
35 +
36 +static void hotplug_dsl_status(void)
37 +{
38 + struct sk_buff *skb;
39 + size_t len;
40 + char *scratch, *dsl_status;
41 + char buf[128];
42 + u64 seq;
43 +
44 + if (!uevent_sock) {
45 + printk("avsar: unable to create netlink socket!\n");
46 + return;
47 + }
48 +
49 + switch (pIhw->AppData.bState)
50 + {
51 + case RSTATE_TEST:
52 + dsl_status="TEST";
53 + break;
54 + case RSTATE_IDLE:
55 + dsl_status="IDLE";
56 + break;
57 + case RSTATE_INIT:
58 + dsl_status="INIT";
59 + break;
60 + case RSTATE_HS:
61 + dsl_status="HANDSHAKE";
62 + break;
63 + case RSTATE_RTDL:
64 + dsl_status="RETRAIN";
65 + break;
66 + case RSTATE_SHOWTIME:
67 + dsl_status="SHOWTIME";
68 + break;
69 + default:
70 + dsl_status="UNKNOWN";
71 + }
72 +
73 + /* allocate message with the maximum possible size */
74 + len = strlen(dsl_status) +2;
75 + skb = alloc_skb(len + 2048, GFP_KERNEL);
76 + if (!skb)
77 + return;
78 +
79 + /* add header */
80 + scratch = skb_put(skb, len);
81 + sprintf(scratch, "%s@",dsl_status);
82 +
83 + /* copy keys to our continuous event payload buffer */
84 + add_msg(skb, "HOME=/");
85 + add_msg(skb, "PATH=/sbin:/bin:/usr/sbin:/usr/bin");
86 + add_msg(skb, "SUBSYSTEM=atm");
87 + add_msg(skb, "DEVICENAME=avsar0");
88 + snprintf(buf, 128, "ACTION=%s", dsl_status);
89 + add_msg(skb, buf);
90 + seq = uevent_next_seqnum();
91 + snprintf(buf, 128, "SEQNUM=%llu", (unsigned long long)seq);
92 + add_msg(skb, buf);
93 +
94 + NETLINK_CB(skb).dst_group = 1;
95 + netlink_broadcast(uevent_sock, skb, 0, 1, GFP_KERNEL);
96 +}
97 +
98
99 int os_atoi(const char *pStr)
100 {
101 @@ -2558,7 +2634,7 @@
102
103 inline int tn7dsl_handle_interrupt(void)
104 {
105 - int intsrc;
106 + int intsrc,curState;
107 unsigned char cMsgRa[6];
108 short margin;
109 extern unsigned int def_sar_inter_pace; //Sorry
110 @@ -2573,7 +2649,7 @@
111
112 if (nohost_flag) return 0;
113
114 -
115 + curState=pIhw->AppData.bState;
116 dslhal_api_handleTrainingInterrupt(pIhw, intsrc);
117
118 if(pIhw->lConnected == TC_SYNC)
119 @@ -2704,8 +2780,8 @@
120 }
121
122 #endif
123 -
124 }
125 + if(pIhw->AppData.bState != curState) hotplug_dsl_status();
126
127 //UR8_MERGE_START CQ10442 Manjula K
128 if (pIhw->AppData.SRA)
This page took 0.06017 seconds and 5 git commands to generate.