Esempio n. 1
0
void cleanup_module(void)
{
	extern struct atm_mpoa_ops atm_mpoa_ops;
	struct mpoa_client *mpc, *tmp;
	struct atm_mpoa_qos *qos, *nextqos;
	struct lec_priv *priv;

	if (MOD_IN_USE) {
		printk("mpc.c: module in use\n");
		return;
	}
#ifdef CONFIG_PROC_FS
	mpc_proc_clean();
#endif

	del_timer(&mpc_timer);
	unregister_netdevice_notifier(&mpoa_notifier);
	atm_mpoa_ops.mpoad_attach = NULL;
	atm_mpoa_ops.vcc_attach = NULL;

	mpc = mpcs;
	mpcs = NULL;
	while (mpc != NULL) {
		tmp = mpc->next;
		if (mpc->dev != NULL) {
			stop_mpc(mpc);
			priv = (struct lec_priv *)mpc->dev->priv;
			if (priv->lane2_ops != NULL)
				priv->lane2_ops->associate_indicator = NULL;
		}
		ddprintk("mpoa: cleanup_module: about to clear caches\n");
		mpc->in_ops->destroy_cache(mpc);
		mpc->eg_ops->destroy_cache(mpc);
		ddprintk("mpoa: cleanup_module: caches cleared\n");
		kfree(mpc->mps_macs);
		memset(mpc, 0, sizeof(struct mpoa_client));
		ddprintk("mpoa: cleanup_module: about to kfree %p\n", mpc);
		kfree(mpc);
		ddprintk("mpoa: cleanup_module: next mpc is at %p\n", tmp);
		mpc = tmp;
	}

	qos = qos_head;
	qos_head = NULL;
	while (qos != NULL) {
		nextqos = qos->next;
		dprintk("mpoa: cleanup_module: freeing qos entry %p\n", qos);
		kfree(qos);
		qos = nextqos;
	}

	return;
}
Esempio n. 2
0
static void __exit atm_mpoa_cleanup(void)
{
	struct mpoa_client *mpc, *tmp;
	struct atm_mpoa_qos *qos, *nextqos;
	struct lec_priv *priv;

	mpc_proc_clean();

	del_timer(&mpc_timer);
	unregister_netdevice_notifier(&mpoa_notifier);
	deregister_atm_ioctl(&atm_ioctl_ops);

	mpc = mpcs;
	mpcs = NULL;
	while (mpc != NULL) {
		tmp = mpc->next;
		if (mpc->dev != NULL) {
			stop_mpc(mpc);
			priv = netdev_priv(mpc->dev);
			if (priv->lane2_ops != NULL)
				priv->lane2_ops->associate_indicator = NULL;
		}
		ddprintk("about to clear caches\n");
		mpc->in_ops->destroy_cache(mpc);
		mpc->eg_ops->destroy_cache(mpc);
		ddprintk("caches cleared\n");
		kfree(mpc->mps_macs);
		memset(mpc, 0, sizeof(struct mpoa_client));
		ddprintk("about to kfree %p\n", mpc);
		kfree(mpc);
		ddprintk("next mpc is at %p\n", tmp);
		mpc = tmp;
	}

	qos = qos_head;
	qos_head = NULL;
	while (qos != NULL) {
		nextqos = qos->next;
		dprintk("freeing qos entry %p\n", qos);
		kfree(qos);
		qos = nextqos;
	}

	return;
}