[Cbe-oss-dev] [PATCH 1/3] spu_base: remove cleanup_spu_base

Christoph Hellwig hch at lst.de
Thu Apr 5 04:49:27 EST 2007


spu_base.c is always built into the kernel image, so there is no need
for a cleanup function.  And some of the things it does are in the
way for my following patches, so I'd rather get rid of it ASAP.


Signed-off-by: Christoph Hellwig <hch at lst.de>

Index: linux-2.6/arch/powerpc/platforms/cell/spu_base.c
===================================================================
--- linux-2.6.orig/arch/powerpc/platforms/cell/spu_base.c	2007-04-04 15:37:04.000000000 +0200
+++ linux-2.6/arch/powerpc/platforms/cell/spu_base.c	2007-04-04 15:42:33.000000000 +0200
@@ -554,12 +554,6 @@ static int spu_create_sysdev(struct spu 
 	return 0;
 }
 
-static void spu_destroy_sysdev(struct spu *spu)
-{
-	sysfs_remove_device_from_node(&spu->sysdev, spu->node);
-	sysdev_unregister(&spu->sysdev);
-}
-
 static int __init create_spu(void *data)
 {
 	struct spu *spu;
@@ -615,34 +609,6 @@ out:
 	return ret;
 }
 
-static void destroy_spu(struct spu *spu)
-{
-	list_del_init(&spu->list);
-	list_del_init(&spu->be_list);
-	list_del_init(&spu->full_list);
-
-	spu_destroy_sysdev(spu);
-	spu_free_irqs(spu);
-	spu_destroy_spu(spu);
-	kfree(spu);
-}
-
-static void cleanup_spu_base(void)
-{
-	struct spu *spu, *tmp;
-	int node;
-
-	mutex_lock(&spu_mutex);
-	for (node = 0; node < MAX_NUMNODES; node++) {
-		list_for_each_entry_safe(spu, tmp, &be_spu_info[node].free_spus,
-									list)
-			destroy_spu(spu);
-	}
-	mutex_unlock(&spu_mutex);
-	sysdev_class_unregister(&spu_sysdev_class);
-}
-module_exit(cleanup_spu_base);
-
 struct be_spu_info be_spu_info[MAX_NUMNODES];
 EXPORT_SYMBOL_GPL(be_spu_info);
 
@@ -780,16 +746,15 @@ static void init_aff_fw_vicinity(void)
 
 static int __init init_spu_base(void)
 {
-	int i, ret;
-	long root;
+	int i, ret = 0;
 
 	if (!spu_management_ops)
-		return 0;
+		goto out;
 
 	/* create sysdev class for spus */
 	ret = sysdev_class_register(&spu_sysdev_class);
 	if (ret)
-		return ret;
+		goto out;
 
 	for (i = 0; i < MAX_NUMNODES; i++) {
 		INIT_LIST_HEAD(&be_spu_info[i].spus);
@@ -800,8 +765,7 @@ static int __init init_spu_base(void)
 	if (ret) {
 		printk(KERN_WARNING "%s: Error initializing spus\n",
 			__FUNCTION__);
-		cleanup_spu_base();
-		return ret;
+		goto out_unregister_sysdev_class;
 	}
 
 	xmon_register_spus(&spu_full_list);
@@ -809,11 +773,16 @@ static int __init init_spu_base(void)
 	if (of_has_vicinity()) {
 		init_aff_fw_vicinity();
 	} else {
-		root = of_get_flat_dt_root();
+		long root = of_get_flat_dt_root();
 		if (of_flat_dt_is_compatible(root, "IBM,CPBW-1.0"))
 			init_aff_QS20_harcoded();
 	}
 
+	return 0;
+
+ out_unregister_sysdev_class:
+	sysdev_class_unregister(&spu_sysdev_class);
+ out:
 	return ret;
 }
 module_init(init_spu_base);



More information about the cbe-oss-dev mailing list