24 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
26 #include <linux/module.h>
28 #include <linux/slab.h>
35 #include <linux/list.h>
39 #include <asm/processor.h>
42 #define DRVNAME "via_cputemp"
73 ret =
sprintf(buf,
"Core %d\n", data->
id);
88 return sprintf(buf,
"%lu\n", ((
unsigned long)eax & 0xffffff) * 1000);
110 static struct attribute *via_cputemp_attributes[] = {
111 &sensor_dev_attr_name.dev_attr.attr,
112 &sensor_dev_attr_temp1_label.dev_attr.attr,
113 &sensor_dev_attr_temp1_input.dev_attr.attr,
118 .attrs = via_cputemp_attributes,
137 data->
name =
"via_cputemp";
159 "Unable to access TEMPERATURE MSR, giving up\n");
163 platform_set_drvdata(pdev, data);
181 dev_err(&pdev->
dev,
"Class registration failed (%d)\n",
211 .probe = via_cputemp_probe,
224 static int __cpuinit via_cputemp_device_add(
unsigned int cpu)
233 pr_err(
"Device allocation failed\n");
237 pdev_entry = kzalloc(
sizeof(
struct pdev_entry),
GFP_KERNEL);
240 goto exit_device_put;
245 pr_err(
"Device addition failed (%d)\n", err);
246 goto exit_device_free;
265 static void __cpuinit via_cputemp_device_remove(
unsigned int cpu)
267 struct pdev_entry *
p;
283 unsigned long action,
void *hcpu)
285 unsigned int cpu = (
unsigned long) hcpu;
290 via_cputemp_device_add(cpu);
293 via_cputemp_device_remove(cpu);
300 .notifier_call = via_cputemp_cpu_callback,
311 static int __init via_cputemp_init(
void)
337 via_cputemp_device_add(i);
340 #ifndef CONFIG_HOTPLUG_CPU
341 if (list_empty(&pdev_list)) {
344 goto exit_driver_unreg;
352 #ifndef CONFIG_HOTPLUG_CPU
360 static void __exit via_cputemp_exit(
void)
362 struct pdev_entry *
p, *
n;