Re: 2.6.16-rc6-mm1 : Setting clocksource results in error

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

 



On Tue, 2006-03-14 at 09:35 +0100, Alexander Gran wrote:
> I'm still fiddeling with my way to slow netbeans debugger. I just tried to 
> change the clocksource. That resulted in an error, but apparently worked. Is 
> that expected behaviour:
> root@t40:/sys/devices/system/clocksource/clocksource0# l
> insgesamt 0
> -rw------- 1 root root 4,0K 2006-03-14 09:31 available_clocksource
> -rw------- 1 root root    0 2006-03-14 09:31 current_clocksource
> root@t40:/sys/devices/system/clocksource/clocksource0# cat 
> available_clocksource
> acpi_pm jiffies tsc pit
> root@t40:/sys/devices/system/clocksource/clocksource0# echo acpi_pm > 
> current_clocksource
> -su: echo: write error: Das Argument ist ungültig
> root@t40:/sys/devices/system/clocksource/clocksource0# cat current_clocksource
> acpi_pm

Huh. Interesting.

Oh! I see it, we're stripping the \n from the name and returning a count
value one less then what was given.

You can verify it by noticing "echo -n tsc > current_clocksource" does
not give the error.

This small fix should resolve it.

Thanks for the bug report!
-john

Signed-off-by: John Stultz <[email protected]>

diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index d2ce2c3..fe22f64 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -220,6 +220,7 @@ sysfs_show_current_clocksources(struct s
 static ssize_t sysfs_override_clocksource(struct sys_device *dev,
 					  const char *buf, size_t count)
 {
+	size_t ret = count;
 	/* strings from sysfs write are not 0 terminated! */
 	if (count >= sizeof(override_name))
 		return -EINVAL;
@@ -241,7 +242,7 @@ static ssize_t sysfs_override_clocksourc
 
 	spin_unlock_irq(&clocksource_lock);
 
-	return count;
+	return ret;
 }
 
 /**



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

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux