aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorAllan Stephens <Allan.Stephens@windriver.com>2010-11-30 07:00:58 -0500
committerDavid S. Miller <davem@davemloft.net>2010-12-02 16:34:04 -0500
commita5c2af9922a94a875c5f4b2dcd357a1c399b7ea6 (patch)
treee88b61206f57ccca821f7dd479d24b39279946e3 /net
parent528c771e87c3fa661bc6983b5bf0ba464d9f7c3a (diff)
tipc: Remove support for TIPC mode change callback
Eliminates support for the callback routine invoked when TIPC changes its mode of operation from inactive to standalone or from standalone to networked. This callback was part of TIPC's obsolete native API and is not used by TIPC internally. Signed-off-by: Allan Stephens <Allan.Stephens@windriver.com> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/tipc/config.c2
-rw-r--r--net/tipc/subscr.c2
-rw-r--r--net/tipc/user_reg.c50
-rw-r--r--net/tipc/user_reg.h4
4 files changed, 5 insertions, 53 deletions
diff --git a/net/tipc/config.c b/net/tipc/config.c
index 2ee5a9a3cebf..bdde39f0436b 100644
--- a/net/tipc/config.c
+++ b/net/tipc/config.c
@@ -560,7 +560,7 @@ int tipc_cfg_init(void)
560 struct tipc_name_seq seq; 560 struct tipc_name_seq seq;
561 int res; 561 int res;
562 562
563 res = tipc_attach(&mng.user_ref, NULL, NULL); 563 res = tipc_attach(&mng.user_ref);
564 if (res) 564 if (res)
565 goto failed; 565 goto failed;
566 566
diff --git a/net/tipc/subscr.c b/net/tipc/subscr.c
index e7fb38ba577d..e13c89aeb6d2 100644
--- a/net/tipc/subscr.c
+++ b/net/tipc/subscr.c
@@ -549,7 +549,7 @@ int tipc_subscr_start(void)
549 INIT_LIST_HEAD(&topsrv.subscriber_list); 549 INIT_LIST_HEAD(&topsrv.subscriber_list);
550 550
551 spin_lock_bh(&topsrv.lock); 551 spin_lock_bh(&topsrv.lock);
552 res = tipc_attach(&topsrv.user_ref, NULL, NULL); 552 res = tipc_attach(&topsrv.user_ref);
553 if (res) { 553 if (res) {
554 spin_unlock_bh(&topsrv.lock); 554 spin_unlock_bh(&topsrv.lock);
555 return res; 555 return res;
diff --git a/net/tipc/user_reg.c b/net/tipc/user_reg.c
index 506928803162..2e2702e2049c 100644
--- a/net/tipc/user_reg.c
+++ b/net/tipc/user_reg.c
@@ -50,15 +50,11 @@
50/** 50/**
51 * struct tipc_user - registered TIPC user info 51 * struct tipc_user - registered TIPC user info
52 * @next: index of next free registry entry (or -1 for an allocated entry) 52 * @next: index of next free registry entry (or -1 for an allocated entry)
53 * @callback: ptr to routine to call when TIPC mode changes (NULL if none)
54 * @usr_handle: user-defined value passed to callback routine
55 * @ports: list of user ports owned by the user 53 * @ports: list of user ports owned by the user
56 */ 54 */
57 55
58struct tipc_user { 56struct tipc_user {
59 int next; 57 int next;
60 tipc_mode_event callback;
61 void *usr_handle;
62 struct list_head ports; 58 struct list_head ports;
63}; 59};
64 60
@@ -95,41 +91,12 @@ static int reg_init(void)
95} 91}
96 92
97/** 93/**
98 * reg_callback - inform TIPC user about current operating mode
99 */
100
101static void reg_callback(struct tipc_user *user_ptr)
102{
103 tipc_mode_event cb;
104 void *arg;
105
106 spin_lock_bh(&reg_lock);
107 cb = user_ptr->callback;
108 arg = user_ptr->usr_handle;
109 spin_unlock_bh(&reg_lock);
110
111 if (cb)
112 cb(arg, tipc_mode, tipc_own_addr);
113}
114
115/**
116 * tipc_reg_start - activate TIPC user registry 94 * tipc_reg_start - activate TIPC user registry
117 */ 95 */
118 96
119int tipc_reg_start(void) 97int tipc_reg_start(void)
120{ 98{
121 u32 u; 99 return reg_init();
122 int res;
123
124 if ((res = reg_init()))
125 return res;
126
127 for (u = 1; u <= MAX_USERID; u++) {
128 if (users[u].callback)
129 tipc_k_signal((Handler)reg_callback,
130 (unsigned long)&users[u]);
131 }
132 return 0;
133} 100}
134 101
135/** 102/**
@@ -138,15 +105,9 @@ int tipc_reg_start(void)
138 105
139void tipc_reg_stop(void) 106void tipc_reg_stop(void)
140{ 107{
141 int id;
142
143 if (!users) 108 if (!users)
144 return; 109 return;
145 110
146 for (id = 1; id <= MAX_USERID; id++) {
147 if (users[id].callback)
148 reg_callback(&users[id]);
149 }
150 kfree(users); 111 kfree(users);
151 users = NULL; 112 users = NULL;
152} 113}
@@ -157,12 +118,10 @@ void tipc_reg_stop(void)
157 * NOTE: This routine may be called when TIPC is inactive. 118 * NOTE: This routine may be called when TIPC is inactive.
158 */ 119 */
159 120
160int tipc_attach(u32 *userid, tipc_mode_event cb, void *usr_handle) 121int tipc_attach(u32 *userid)
161{ 122{
162 struct tipc_user *user_ptr; 123 struct tipc_user *user_ptr;
163 124
164 if ((tipc_mode == TIPC_NOT_RUNNING) && !cb)
165 return -ENOPROTOOPT;
166 if (!users) 125 if (!users)
167 reg_init(); 126 reg_init();
168 127
@@ -177,13 +136,9 @@ int tipc_attach(u32 *userid, tipc_mode_event cb, void *usr_handle)
177 user_ptr->next = -1; 136 user_ptr->next = -1;
178 spin_unlock_bh(&reg_lock); 137 spin_unlock_bh(&reg_lock);
179 138
180 user_ptr->callback = cb;
181 user_ptr->usr_handle = usr_handle;
182 INIT_LIST_HEAD(&user_ptr->ports); 139 INIT_LIST_HEAD(&user_ptr->ports);
183 atomic_inc(&tipc_user_count); 140 atomic_inc(&tipc_user_count);
184 141
185 if (cb && (tipc_mode != TIPC_NOT_RUNNING))
186 tipc_k_signal((Handler)reg_callback, (unsigned long)user_ptr);
187 return 0; 142 return 0;
188} 143}
189 144
@@ -207,7 +162,6 @@ void tipc_detach(u32 userid)
207 } 162 }
208 163
209 user_ptr = &users[userid]; 164 user_ptr = &users[userid];
210 user_ptr->callback = NULL;
211 INIT_LIST_HEAD(&ports_temp); 165 INIT_LIST_HEAD(&ports_temp);
212 list_splice(&user_ptr->ports, &ports_temp); 166 list_splice(&user_ptr->ports, &ports_temp);
213 user_ptr->next = next_free_user; 167 user_ptr->next = next_free_user;
diff --git a/net/tipc/user_reg.h b/net/tipc/user_reg.h
index a05981fb9176..109eed0d6de3 100644
--- a/net/tipc/user_reg.h
+++ b/net/tipc/user_reg.h
@@ -42,9 +42,7 @@
42int tipc_reg_start(void); 42int tipc_reg_start(void);
43void tipc_reg_stop(void); 43void tipc_reg_stop(void);
44 44
45typedef void (*tipc_mode_event)(void *usr_handle, int mode, u32 addr); 45int tipc_attach(unsigned int *userref);
46
47int tipc_attach(unsigned int *userref, tipc_mode_event, void *usr_handle);
48void tipc_detach(unsigned int userref); 46void tipc_detach(unsigned int userref);
49 47
50int tipc_reg_add_port(struct user_port *up_ptr); 48int tipc_reg_add_port(struct user_port *up_ptr);