[Cbe-oss-dev] [RFC v2] Cell: shutdown method for spu_sysdev_class

Geoff Levand geoffrey.levand at am.sony.com
Thu May 31 02:50:28 EST 2007


Add a shutdown method to spu_sysdev_class to allow proper spu resource
cleanup on system shutdown.  This is needed to support kexec on the PS3
platform.

Signed-off-by: Arnd Bergmann <arnd.bergmann at de.ibm.com>
Signed-off-by: Geoff Levand <geoffrey.levand at am.sony.com>
---
version 2: Removed kfree(spu) as suggested by Arnd and Christoph.

I'm just sending this out for reference.  I'll include it in my
series that I submit for 2.6.23 that will also have the PS3 kexec
support that depends on this.

 arch/powerpc/platforms/cell/spu_base.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

--- a/arch/powerpc/platforms/cell/spu_base.c
+++ b/arch/powerpc/platforms/cell/spu_base.c
@@ -462,8 +462,18 @@ void spu_free(struct spu *spu)
 }
 EXPORT_SYMBOL_GPL(spu_free);
 
+static int spu_shutdown(struct sys_device *sysdev)
+{
+	struct spu *spu = container_of(sysdev, struct spu, sysdev);
+
+	spu_free_irqs(spu);
+	spu_destroy_spu(spu);
+	return 0;
+}
+
 struct sysdev_class spu_sysdev_class = {
-	set_kset_name("spu")
+	set_kset_name("spu"),
+	.shutdown = spu_shutdown,
 };
 
 int spu_add_sysdev_attr(struct sysdev_attribute *attr)




More information about the cbe-oss-dev mailing list