Subject: Re: [RFC PATCH 7/7 v2] ppc: add dynamic dma window support

From: Benjamin Herrenschmidt <[email-masked]>
Date: Thu, 09 Dec 2010 15:17:06 +1100

On Tue, 2010-10-26 at 20:35 -0700, Nishanth Aravamudan wrote:

No much comments... I'm amazed how complex he firmware folks managed to
make this ... 

>  static int iommu_reconfig_notifier(struct notifier_block *nb, unsigned long action, void *node)
>  {
>  	int err = NOTIFY_OK;
>  	struct device_node *np = node;
>  	struct pci_dn *pci = PCI_DN(np);
> +	struct direct_window *window;
>  
>  	switch (action) {
>  	case PSERIES_RECONFIG_REMOVE:
>  		if (pci && pci->iommu_table)
>  			iommu_free_table(pci->iommu_table, np->full_name);
> +
> +		spin_lock(&direct_window_list_lock);
> +		list_for_each_entry(window, &direct_window_list, list) {
> +			if (window->device == np) {
> +				list_del(&window->list);
> +				break;
> +			}
> +		}
> +		spin_unlock(&direct_window_list_lock);

Should you also kfree the window ?

Cheers,
Ben.