Google luky.org euqset.org

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] release_pcibus_dev() crash


On Thu, Jan 13, 2005 at 02:12:15PM -0600, John Rose wrote:
> > So, does the patch below fix the problem for you?
> > (warning, not even compile tested)
> 
> Unfortunately, the class device attribute and pci_remove_legacy_files()
> are statically defined in probe.c.  The patch below augments yours to account
> for this.
> 
> This set of changes also fixes the crash.  I'll let you decide if explicitly
> cleaning up these files is worth exporting this stuff outside of probe.c.  
> Also, suggestions are welcome for a cleaner way to do this, I'm not totally
> comfortable with the ifdef's and inlines :)

Yeah, I don't think some of it is correct :)

> @@ -70,7 +70,7 @@ static void pci_remove_legacy_files(stru
>  }
>  #else /* !HAVE_PCI_LEGACY */
>  static inline void pci_create_legacy_files(struct pci_bus *bus) { return; }
> -static inline void pci_remove_legacy_files(struct pci_bus *bus) { return; }
> +inline void pci_remove_legacy_files(struct pci_bus *bus) { return; }
>  #endif /* HAVE_PCI_LEGACY */

Why make it inline?  I don't think that will work with gcc 4.

> -static CLASS_DEVICE_ATTR(cpuaffinity, S_IRUGO, pci_bus_show_cpuaffinity, NULL);
> +CLASS_DEVICE_ATTR(cpuaffinity, S_IRUGO, pci_bus_show_cpuaffinity, NULL);

That's fine with me.

>  /*
>   * PCI Bus Class
> @@ -95,10 +95,6 @@ static void release_pcibus_dev(struct cl
>  {
>  	struct pci_bus *pci_bus = to_pci_bus(class_dev);
>  
> -	pci_remove_legacy_files(pci_bus);
> -	class_device_remove_file(&pci_bus->class_dev,
> -				 &class_device_attr_cpuaffinity);
> -	sysfs_remove_link(&pci_bus->class_dev.kobj, "bridge");
>  	if (pci_bus->bridge)
>  		put_device(pci_bus->bridge);
>  	kfree(pci_bus);
> diff -puN drivers/pci/remove.c~01_release_pcibus_dev drivers/pci/remove.c
> --- 2_6_linus_2/drivers/pci/remove.c~01_release_pcibus_dev	2005-01-13 13:42:39.000000000 -0600
> +++ 2_6_linus_2-johnrose/drivers/pci/remove.c	2005-01-13 13:47:18.000000000 -0600
> @@ -61,15 +61,18 @@ int pci_remove_device_safe(struct pci_de
>  }
>  EXPORT_SYMBOL(pci_remove_device_safe);
>  
> -void pci_remove_bus(struct pci_bus *b)
> +void pci_remove_bus(struct pci_bus *pci_bus)
>  {
> -	pci_proc_detach_bus(b);
> +	pci_proc_detach_bus(pci_bus);
>  
>  	spin_lock(&pci_bus_lock);
> -	list_del(&b->node);
> +	list_del(&pci_bus->node);
>  	spin_unlock(&pci_bus_lock);
> -
> -	class_device_unregister(&b->class_dev);
> +	pci_remove_legacy_files(pci_bus);
> +	class_device_remove_file(&pci_bus->class_dev,
> +		&class_device_attr_cpuaffinity);
> +	sysfs_remove_link(&pci_bus->class_dev.kobj, "bridge");
> +	class_device_unregister(&pci_bus->class_dev);
>  }
>  EXPORT_SYMBOL(pci_remove_bus);
>  
> diff -puN include/linux/pci.h~01_release_pcibus_dev include/linux/pci.h
> --- 2_6_linus_2/include/linux/pci.h~01_release_pcibus_dev	2005-01-13 13:53:28.000000000 -0600
> +++ 2_6_linus_2-johnrose/include/linux/pci.h	2005-01-13 13:58:06.000000000 -0600

No, put these in drivers/pci/pci.h instead.

Care to redo this?

thanks,

greg k-h
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


$B$3$N>pJs$,$"$J$?$NC5$7$F$$?$b$N$+$I$&$+A*Br$7$F$/$@$5$!#(B
yes/$B$^$5$K$3$l$@!*(B   no/$B0c$&$J$!(B   part/$B0lIt8+$D$+$C$?(B   try/$B$3$l$G;n$7$F$_$k(B

$B$"$J$?$,C5$7$F$$?>pJs$O$I$N$h$&$J$3$H$+!"$4<+M3$K5-F~2<$5$!#FC$K!V$^$5$K$3$l$@!*!W$H8@$&>l9g$O5-F~$r$*4j$$7$^$9!#(B
$BNc(B:$B!VJ#?t$N%^%7%s$+$i(BCATV$B7PM3$G(Bipmasquerade$B$rMxMQ$7$F(BWeb$B$r;2>H$7$?$>l9g$N@_Dj$K$D$$F!W(B
Follow-Ups: References: