- clocksource-shift-helper.patch removed from -mm tree

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

 



The patch titled
     clocksource: shift helper
has been removed from the -mm tree.  Its filename was
     clocksource-shift-helper.patch

This patch was dropped because an updated version will be merged

The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/

------------------------------------------------------
Subject: clocksource: shift helper
From: Daniel Walker <dwalker@xxxxxxxxxx>

This is a little helper I pulled from the mips tree.  I've seen a couple of
bogus shift values, and this helper calculates the shift.  This should move
the shift selection away from the user, and systematically pick the value base
on the hz.

I also modified the acpi_pm timer to use this new interface.  The original
shift was 22 , and after this patch it's increased to 23.  Which should make
the clocksource slightly more accurate, but shouldn't have much of a visible
effect.

Signed-off-by: Daniel Walker <dwalker@xxxxxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: john stultz <johnstul@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 drivers/clocksource/acpi_pm.c |    5 ++++-
 include/linux/acpi_pmtmr.h    |    5 +++--
 include/linux/clocksource.h   |   21 +++++++++++++++++++++
 3 files changed, 28 insertions(+), 3 deletions(-)

diff -puN drivers/clocksource/acpi_pm.c~clocksource-shift-helper drivers/clocksource/acpi_pm.c
--- a/drivers/clocksource/acpi_pm.c~clocksource-shift-helper
+++ a/drivers/clocksource/acpi_pm.c
@@ -72,7 +72,7 @@ static struct clocksource clocksource_ac
 	.read		= acpi_pm_read,
 	.mask		= (cycle_t)ACPI_PM_MASK,
 	.mult		= 0, /*to be calculated*/
-	.shift		= 22,
+	.shift		= 0,
 	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
 
 };
@@ -183,6 +183,9 @@ static int __init init_acpi_pm_clocksour
 	if (!pmtmr_ioport)
 		return -ENODEV;
 
+	clocksource_acpi_pm.shift =
+		clocksource_hz2shift(ACPI_PM_BITS, PMTMR_TICKS_PER_SEC);
+
 	clocksource_acpi_pm.mult = clocksource_hz2mult(PMTMR_TICKS_PER_SEC,
 						clocksource_acpi_pm.shift);
 
diff -puN include/linux/acpi_pmtmr.h~clocksource-shift-helper include/linux/acpi_pmtmr.h
--- a/include/linux/acpi_pmtmr.h~clocksource-shift-helper
+++ a/include/linux/acpi_pmtmr.h
@@ -7,10 +7,11 @@
 #define PMTMR_TICKS_PER_SEC 3579545
 
 /* limit it to 24 bits */
-#define ACPI_PM_MASK CLOCKSOURCE_MASK(24)
+#define ACPI_PM_BITS	24
+#define ACPI_PM_MASK CLOCKSOURCE_MASK(ACPI_PM_BITS)
 
 /* Overrun value */
-#define ACPI_PM_OVRRUN	(1<<24)
+#define ACPI_PM_OVRRUN	(1 << ACPI_PM_BITS)
 
 #ifdef CONFIG_X86_PM_TIMER
 
diff -puN include/linux/clocksource.h~clocksource-shift-helper include/linux/clocksource.h
--- a/include/linux/clocksource.h~clocksource-shift-helper
+++ a/include/linux/clocksource.h
@@ -159,6 +159,27 @@ static inline u32 clocksource_hz2mult(u3
 }
 
 /**
+ * clocksource_hz2shift - calculates shift from hz and # of bits
+ * @bits:		Number of bits this clocksource uses
+ * @hz:			Clocksource frequency in Hz
+ *
+ * Helper functions that calculates the best shift value
+ * based on the hz and # of bits of any given clock.
+ */
+static inline u32 clocksource_hz2shift(u32 bits, u32 hz)
+{
+	u64 temp;
+
+	for (; bits > 0; bits--) {
+		temp = (u64) NSEC_PER_SEC << bits;
+		do_div(temp, hz);
+		if ((temp >> 32) == 0)
+			break;
+	}
+	return bits;
+}
+
+/**
  * clocksource_read: - Access the clocksource's current cycle value
  * @cs:		pointer to clocksource being read
  *
_

Patches currently in -mm which might be from dwalker@xxxxxxxxxx are

linux-next.patch
macintosh-therm_pm72-driver_lock-semaphore-to-mutex.patch
macintosh-qindfarm_smu_sat-semaphore-to-mutex.patch
machintosh-adb-driver-adb_handler_sem-semaphore-to-mutex.patch
clocksource-shift-helper.patch
profile-likely-unlikely-macros.patch
likely_prof-changed-to-use-proc_create.patch
likeliness-accounting-change-and-cleanup.patch

--
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux