Skip to content

Commit

Permalink
tipc: Remove support for TIPC mode change callback
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Allan Stephens authored and David S. Miller committed Dec 2, 2010
1 parent 528c771 commit a5c2af9
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 53 deletions.
2 changes: 1 addition & 1 deletion net/tipc/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ int tipc_cfg_init(void)
struct tipc_name_seq seq;
int res;

res = tipc_attach(&mng.user_ref, NULL, NULL);
res = tipc_attach(&mng.user_ref);
if (res)
goto failed;

Expand Down
2 changes: 1 addition & 1 deletion net/tipc/subscr.c
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ int tipc_subscr_start(void)
INIT_LIST_HEAD(&topsrv.subscriber_list);

spin_lock_bh(&topsrv.lock);
res = tipc_attach(&topsrv.user_ref, NULL, NULL);
res = tipc_attach(&topsrv.user_ref);
if (res) {
spin_unlock_bh(&topsrv.lock);
return res;
Expand Down
50 changes: 2 additions & 48 deletions net/tipc/user_reg.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,11 @@
/**
* struct tipc_user - registered TIPC user info
* @next: index of next free registry entry (or -1 for an allocated entry)
* @callback: ptr to routine to call when TIPC mode changes (NULL if none)
* @usr_handle: user-defined value passed to callback routine
* @ports: list of user ports owned by the user
*/

struct tipc_user {
int next;
tipc_mode_event callback;
void *usr_handle;
struct list_head ports;
};

Expand Down Expand Up @@ -94,42 +90,13 @@ static int reg_init(void)
return users ? 0 : -ENOMEM;
}

/**
* reg_callback - inform TIPC user about current operating mode
*/

static void reg_callback(struct tipc_user *user_ptr)
{
tipc_mode_event cb;
void *arg;

spin_lock_bh(&reg_lock);
cb = user_ptr->callback;
arg = user_ptr->usr_handle;
spin_unlock_bh(&reg_lock);

if (cb)
cb(arg, tipc_mode, tipc_own_addr);
}

/**
* tipc_reg_start - activate TIPC user registry
*/

int tipc_reg_start(void)
{
u32 u;
int res;

if ((res = reg_init()))
return res;

for (u = 1; u <= MAX_USERID; u++) {
if (users[u].callback)
tipc_k_signal((Handler)reg_callback,
(unsigned long)&users[u]);
}
return 0;
return reg_init();
}

/**
Expand All @@ -138,15 +105,9 @@ int tipc_reg_start(void)

void tipc_reg_stop(void)
{
int id;

if (!users)
return;

for (id = 1; id <= MAX_USERID; id++) {
if (users[id].callback)
reg_callback(&users[id]);
}
kfree(users);
users = NULL;
}
Expand All @@ -157,12 +118,10 @@ void tipc_reg_stop(void)
* NOTE: This routine may be called when TIPC is inactive.
*/

int tipc_attach(u32 *userid, tipc_mode_event cb, void *usr_handle)
int tipc_attach(u32 *userid)
{
struct tipc_user *user_ptr;

if ((tipc_mode == TIPC_NOT_RUNNING) && !cb)
return -ENOPROTOOPT;
if (!users)
reg_init();

Expand All @@ -177,13 +136,9 @@ int tipc_attach(u32 *userid, tipc_mode_event cb, void *usr_handle)
user_ptr->next = -1;
spin_unlock_bh(&reg_lock);

user_ptr->callback = cb;
user_ptr->usr_handle = usr_handle;
INIT_LIST_HEAD(&user_ptr->ports);
atomic_inc(&tipc_user_count);

if (cb && (tipc_mode != TIPC_NOT_RUNNING))
tipc_k_signal((Handler)reg_callback, (unsigned long)user_ptr);
return 0;
}

Expand All @@ -207,7 +162,6 @@ void tipc_detach(u32 userid)
}

user_ptr = &users[userid];
user_ptr->callback = NULL;
INIT_LIST_HEAD(&ports_temp);
list_splice(&user_ptr->ports, &ports_temp);
user_ptr->next = next_free_user;
Expand Down
4 changes: 1 addition & 3 deletions net/tipc/user_reg.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@
int tipc_reg_start(void);
void tipc_reg_stop(void);

typedef void (*tipc_mode_event)(void *usr_handle, int mode, u32 addr);

int tipc_attach(unsigned int *userref, tipc_mode_event, void *usr_handle);
int tipc_attach(unsigned int *userref);
void tipc_detach(unsigned int userref);

int tipc_reg_add_port(struct user_port *up_ptr);
Expand Down

0 comments on commit a5c2af9

Please sign in to comment.