/* A nasty problem arises if we count the number of DAMA connections wrong, especially when connections on the device already existed and our network node (or the sysop) decides to turn on DAMA Master mode. We thus flag the 'real' slave connections with ax25->dama_slave=1 and look on every disconnect if still slave connections exist.  */
static int ax25_check_dama_slave(ax25_dev *ax25_dev)
/* A nasty problem arises if we count the number of DAMA connections wrong, especially when connections on the device already existed and our network node (or the sysop) decides to turn on DAMA Master mode. We thus flag the 'real' slave connections with ax25->dama_slave=1 and look on every disconnect if still slave connections exist.  */
static int ax25_check_dama_slave(ax25_dev *ax25_dev)
{
	ax25_cb *ax25;
	int res = 0;
	struct hlist_node *node;
	spin_lock(&ax25_list_lock);
	ax25_for_each(ax25, node, &ax25_list)
		if (ax25->ax25_dev == ax25_dev && (ax25->condition & AX25_COND_DAMA_MODE) && ax25->state > AX25_STATE_1) {
			res = 1;
			break;
		}
	spin_unlock(&ax25_list_lock);
	return res;
}