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

Re: [PATCH] DevFS support for /dev/cpu/X/(cpuid|msr)


Once again, this shit does not belong in N drivers; it is core code.

	-hpa


Richard Gooch wrote:

> Matt Dainty writes:
> 
>>Please find attached a patch to add support for devfs to the i386 cpuid and
>>msr drivers. Not only that, but it fixes a problem with loading these
>>drivers as modules in that the exit hooks on the module never run, (simply
>>changing the function prototypes to include 'static' seems to fix this).
>>
>>Patch is against 2.4.17. SMP environment isn't tested, but I can't see any
>>reason why it wouldn't work...
>>
> 
> Looks mostly reasonable, except for:
> 
> 
>>-void __exit cpuid_exit(void)
>>+static void __exit cpuid_exit(void)
>> {
>>-  unregister_chrdev(CPUID_MAJOR, "cpu/cpuid");
>>+  int i;
>>+  devfs_handle_t parent;
>>+
>>+  for(i = 0; i < NR_CPUS; i++) {
>>+    parent = devfs_get_parent(devfs_handle[i]);
>>+    devfs_unregister(devfs_handle[i]);
>>+    if(devfs_get_first_child(parent) == NULL)
>>+      devfs_unregister(parent);
>>+  }
>>+  devfs_unregister_chrdev(CPUID_MAJOR, "cpu/%d/cpuid");
>> }
>>
> 
> There is no need to remove the parent /dev/cpu/%d directory, and in
> fact it's better not to. All you need is this simpler loop:
> 	for(i = 0; i < NR_CPUS; i++)
> 		devfs_unregister(devfs_handle[i]);
> 
> You do something similar in the MSR driver.
> 
> 				Regards,
> 
> 					Richard....
> Permanent: rgooch _at_ atnf.csiro.au
> Current:   rgooch _at_ ras.ucalgary.ca
> 


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


この情報があなたの探していたものかどうか選択してください。
yes/まさにこれだ!   no/違うなぁ   part/一部見つかった   try/これで試してみる

あなたが探していた情報はどのようなことか、ご自由に記入下さい。特に「まさにこれだ!」と言う場合は記入をお願いします。
例:「複数のマシンからCATV経由でipmasqueradeを利用してWebを参照したい場合の設定について」
Follow-Ups: References: