/* Device is about to be destroyed: clean up.  */
void ipv6_mc_destroy_dev(struct inet6_dev *idev)
/* Device is about to be destroyed: clean up.  */
void ipv6_mc_destroy_dev(struct inet6_dev *idev)
{
	struct ifmcaddr6 *i;
	ipv6_mc_down(idev);
	__ipv6_dev_mc_dec(idev, &in6addr_linklocal_allnodes);
	if (idev->cnf.forwarding)
		__ipv6_dev_mc_dec(idev, &in6addr_linklocal_allrouters);
	write_lock_bh(&idev->lock);
	while ((i = idev->mc_list) != NULL) {
		idev->mc_list = i->next;
		write_unlock_bh(&idev->lock);
		igmp6_group_dropped(i);
		ma_put(i);
		write_lock_bh(&idev->lock);
	}
	write_unlock_bh(&idev->lock);
}