[lm-sensors] [PATCH 2/3] hwmon: (coretemp) some cleanup work

Chen Gong gong.chen at linux.intel.com
Mon Jul 19 04:50:33 CEST 2010


cleanup some redundant codes in coretemp.c.

Signed-off-by: Chen Gong <gong.chen at linux.intel.com>
---
 drivers/hwmon/coretemp.c |   16 +++-------------
 1 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
index 9232c4e..423ece5 100644
--- a/drivers/hwmon/coretemp.c
+++ b/drivers/hwmon/coretemp.c
@@ -54,12 +54,12 @@ struct coretemp_data {
 	const char *name;
 	u32 id;
 	u16 core_id;
+	u8 alarm;
 	char valid;		/* zero until following fields are valid */
 	unsigned long last_updated;	/* in jiffies */
 	int temp;
 	int tjmax;
 	int ttarget;
-	u8 alarm;
 };
 
 /*
@@ -308,7 +308,7 @@ static int __devinit coretemp_probe(struct platform_device *pdev)
 #ifdef CONFIG_SMP
 	data->core_id = c->cpu_core_id;
 #endif
-	data->name = "coretemp";
+	data->name = DRVNAME;
 	mutex_init(&data->update_lock);
 
 	/* test if we can access the THERM_STATUS MSR */
@@ -543,8 +543,7 @@ static int __init coretemp_init(void)
 		if (c->cpuid_level >= 6 && (cpuid_eax(0x06) & 0x01)) {
 			err = coretemp_device_add(i);
 			if (err)
-				goto exit_devices_unreg;
-
+				goto exit;
 		} else {
 			printk(KERN_INFO DRVNAME ": CPU (model=0x%x)"
 				" has no thermal sensor.\n", c->x86_model);
@@ -555,15 +554,6 @@ static int __init coretemp_init(void)
 	register_hotcpu_notifier(&coretemp_cpu_notifier);
 #endif
 	return 0;
-
-exit_devices_unreg:
-	mutex_lock(&pdev_list_mutex);
-	list_for_each_entry_safe(p, n, &pdev_list, list) {
-		platform_device_unregister(p->pdev);
-		list_del(&p->list);
-		kfree(p);
-	}
-	mutex_unlock(&pdev_list_mutex);
 exit:
 	return err;
 }
-- 
1.7.2.rc3





More information about the lm-sensors mailing list