]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - include/linux/clocksource.h
PCI Hotplug: convert acpi_pci_detect_ejectable() to take an acpi_handle
[karo-tx-linux.git] / include / linux / clocksource.h
index 5a40d14daa9fab04bf641c1a11d82a1610ff7753..1219be4fb42e8f2a86e9e1268dfe7958fde8263c 100644 (file)
@@ -288,7 +288,20 @@ static inline cycle_t clocksource_read(struct clocksource *cs)
  */
 static inline int clocksource_enable(struct clocksource *cs)
 {
-       return cs->enable ? cs->enable(cs) : 0;
+       int ret = 0;
+
+       if (cs->enable)
+               ret = cs->enable(cs);
+
+       /*
+        * The frequency may have changed while the clocksource
+        * was disabled. If so the code in ->enable() must update
+        * the mult value to reflect the new frequency. Make sure
+        * mult_orig follows this change.
+        */
+       cs->mult_orig = cs->mult;
+
+       return ret;
 }
 
 /**
@@ -301,6 +314,13 @@ static inline int clocksource_enable(struct clocksource *cs)
  */
 static inline void clocksource_disable(struct clocksource *cs)
 {
+       /*
+        * Save mult_orig in mult so clocksource_enable() can
+        * restore the value regardless if ->enable() updates
+        * the value of mult or not.
+        */
+       cs->mult = cs->mult_orig;
+
        if (cs->disable)
                cs->disable(cs);
 }