list_for_each_entry(rcvr, &(user->intf->cmd_rcvrs), link) { if ((rcvr->netfn == netfn) && (rcvr->cmd == cmd)) { rv = 0; list_del(&rcvr->link); kfree(rcvr); break; }
rcvr = find_cmd_rcvr(intf, netfn, cmd); if ((rcvr) && (rcvr->user == user)) { list_del_rcu(&rcvr->link); spin_unlock_irq(&intf->cmd_rcvrs_lock); synchronize_rcu(); kfree(rcvr); return 0; } else { spin_unlock_irq(&intf->cmd_rcvrs_lock); return -ENOENT;
int ipmi_unregister_for_cmd(ipmi_user_t   user,			    unsigned char netfn,			    unsigned char cmd){	unsigned long    flags;	struct cmd_rcvr  *rcvr;	int              rv = -ENOENT;	read_lock(&(user->intf->users_lock));	write_lock_irqsave(&(user->intf->cmd_rcvr_lock), flags);	/* Make sure the command/netfn is not already registered. */	list_for_each_entry(rcvr, &(user->intf->cmd_rcvrs), link) {		if ((rcvr->netfn == netfn) && (rcvr->cmd == cmd)) {			rv = 0;			list_del(&rcvr->link);			kfree(rcvr);			break;		}	}	write_unlock_irqrestore(&(user->intf->cmd_rcvr_lock), flags);	read_unlock(&(user->intf->users_lock));	return rv;}