clockevents.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674
  1. /*
  2. * linux/kernel/time/clockevents.c
  3. *
  4. * This file contains functions which manage clock event devices.
  5. *
  6. * Copyright(C) 2005-2006, Thomas Gleixner <tglx@linutronix.de>
  7. * Copyright(C) 2005-2007, Red Hat, Inc., Ingo Molnar
  8. * Copyright(C) 2006-2007, Timesys Corp., Thomas Gleixner
  9. *
  10. * This code is licenced under the GPL version 2. For details see
  11. * kernel-base/COPYING.
  12. */
  13. #include <linux/clockchips.h>
  14. #include <linux/hrtimer.h>
  15. #include <linux/init.h>
  16. #include <linux/module.h>
  17. #include <linux/smp.h>
  18. #include <linux/device.h>
  19. #include "tick-internal.h"
  20. /* The registered clock event devices */
  21. static LIST_HEAD(clockevent_devices);
  22. static LIST_HEAD(clockevents_released);
  23. /* Protection for the above */
  24. static DEFINE_RAW_SPINLOCK(clockevents_lock);
  25. /* Protection for unbind operations */
  26. static DEFINE_MUTEX(clockevents_mutex);
  27. struct ce_unbind {
  28. struct clock_event_device *ce;
  29. int res;
  30. };
  31. /**
  32. * clockevents_delta2ns - Convert a latch value (device ticks) to nanoseconds
  33. * @latch: value to convert
  34. * @evt: pointer to clock event device descriptor
  35. *
  36. * Math helper, returns latch value converted to nanoseconds (bound checked)
  37. */
  38. u64 clockevent_delta2ns(unsigned long latch, struct clock_event_device *evt)
  39. {
  40. u64 clc = (u64) latch << evt->shift;
  41. if (unlikely(!evt->mult)) {
  42. evt->mult = 1;
  43. WARN_ON(1);
  44. }
  45. do_div(clc, evt->mult);
  46. if (clc < 1000)
  47. clc = 1000;
  48. if (clc > KTIME_MAX)
  49. clc = KTIME_MAX;
  50. return clc;
  51. }
  52. EXPORT_SYMBOL_GPL(clockevent_delta2ns);
  53. /**
  54. * clockevents_set_mode - set the operating mode of a clock event device
  55. * @dev: device to modify
  56. * @mode: new mode
  57. *
  58. * Must be called with interrupts disabled !
  59. */
  60. void clockevents_set_mode(struct clock_event_device *dev,
  61. enum clock_event_mode mode)
  62. {
  63. if (dev->mode != mode) {
  64. dev->set_mode(mode, dev);
  65. dev->mode = mode;
  66. /*
  67. * A nsec2cyc multiplicator of 0 is invalid and we'd crash
  68. * on it, so fix it up and emit a warning:
  69. */
  70. if (mode == CLOCK_EVT_MODE_ONESHOT) {
  71. if (unlikely(!dev->mult)) {
  72. dev->mult = 1;
  73. WARN_ON(1);
  74. }
  75. }
  76. }
  77. }
  78. /**
  79. * clockevents_shutdown - shutdown the device and clear next_event
  80. * @dev: device to shutdown
  81. */
  82. void clockevents_shutdown(struct clock_event_device *dev)
  83. {
  84. clockevents_set_mode(dev, CLOCK_EVT_MODE_SHUTDOWN);
  85. dev->next_event.tv64 = KTIME_MAX;
  86. }
  87. #ifdef CONFIG_GENERIC_CLOCKEVENTS_MIN_ADJUST
  88. /* Limit min_delta to a jiffie */
  89. #define MIN_DELTA_LIMIT (NSEC_PER_SEC / HZ)
  90. /**
  91. * clockevents_increase_min_delta - raise minimum delta of a clock event device
  92. * @dev: device to increase the minimum delta
  93. *
  94. * Returns 0 on success, -ETIME when the minimum delta reached the limit.
  95. */
  96. static int clockevents_increase_min_delta(struct clock_event_device *dev)
  97. {
  98. /* Nothing to do if we already reached the limit */
  99. if (dev->min_delta_ns >= MIN_DELTA_LIMIT) {
  100. printk(KERN_WARNING "CE: Reprogramming failure. Giving up\n");
  101. dev->next_event.tv64 = KTIME_MAX;
  102. return -ETIME;
  103. }
  104. if (dev->min_delta_ns < 5000)
  105. dev->min_delta_ns = 5000;
  106. else
  107. dev->min_delta_ns += dev->min_delta_ns >> 1;
  108. if (dev->min_delta_ns > MIN_DELTA_LIMIT)
  109. dev->min_delta_ns = MIN_DELTA_LIMIT;
  110. printk(KERN_WARNING "CE: %s increased min_delta_ns to %llu nsec\n",
  111. dev->name ? dev->name : "?",
  112. (unsigned long long) dev->min_delta_ns);
  113. return 0;
  114. }
  115. /**
  116. * clockevents_program_min_delta - Set clock event device to the minimum delay.
  117. * @dev: device to program
  118. *
  119. * Returns 0 on success, -ETIME when the retry loop failed.
  120. */
  121. static int clockevents_program_min_delta(struct clock_event_device *dev)
  122. {
  123. unsigned long long clc;
  124. int64_t delta;
  125. int i;
  126. for (i = 0;;) {
  127. delta = dev->min_delta_ns;
  128. dev->next_event = ktime_add_ns(ktime_get(), delta);
  129. if (dev->mode == CLOCK_EVT_MODE_SHUTDOWN)
  130. return 0;
  131. dev->retries++;
  132. clc = ((unsigned long long) delta * dev->mult) >> dev->shift;
  133. if (dev->set_next_event((unsigned long) clc, dev) == 0)
  134. return 0;
  135. if (++i > 2) {
  136. /*
  137. * We tried 3 times to program the device with the
  138. * given min_delta_ns. Try to increase the minimum
  139. * delta, if that fails as well get out of here.
  140. */
  141. if (clockevents_increase_min_delta(dev))
  142. return -ETIME;
  143. i = 0;
  144. }
  145. }
  146. }
  147. #else /* CONFIG_GENERIC_CLOCKEVENTS_MIN_ADJUST */
  148. /**
  149. * clockevents_program_min_delta - Set clock event device to the minimum delay.
  150. * @dev: device to program
  151. *
  152. * Returns 0 on success, -ETIME when the retry loop failed.
  153. */
  154. static int clockevents_program_min_delta(struct clock_event_device *dev)
  155. {
  156. unsigned long long clc;
  157. int64_t delta;
  158. delta = dev->min_delta_ns;
  159. dev->next_event = ktime_add_ns(ktime_get(), delta);
  160. if (dev->mode == CLOCK_EVT_MODE_SHUTDOWN)
  161. return 0;
  162. dev->retries++;
  163. clc = ((unsigned long long) delta * dev->mult) >> dev->shift;
  164. return dev->set_next_event((unsigned long) clc, dev);
  165. }
  166. #endif /* CONFIG_GENERIC_CLOCKEVENTS_MIN_ADJUST */
  167. /**
  168. * clockevents_program_event - Reprogram the clock event device.
  169. * @dev: device to program
  170. * @expires: absolute expiry time (monotonic clock)
  171. * @force: program minimum delay if expires can not be set
  172. *
  173. * Returns 0 on success, -ETIME when the event is in the past.
  174. */
  175. int clockevents_program_event(struct clock_event_device *dev, ktime_t expires,
  176. bool force)
  177. {
  178. unsigned long long clc;
  179. int64_t delta;
  180. int rc;
  181. if (unlikely(expires.tv64 < 0)) {
  182. WARN_ON_ONCE(1);
  183. return -ETIME;
  184. }
  185. dev->next_event = expires;
  186. if (dev->mode == CLOCK_EVT_MODE_SHUTDOWN)
  187. return 0;
  188. /* Shortcut for clockevent devices that can deal with ktime. */
  189. if (dev->features & CLOCK_EVT_FEAT_KTIME)
  190. return dev->set_next_ktime(expires, dev);
  191. delta = ktime_to_ns(ktime_sub(expires, ktime_get()));
  192. if (delta <= 0)
  193. return force ? clockevents_program_min_delta(dev) : -ETIME;
  194. delta = min(delta, (int64_t) dev->max_delta_ns);
  195. delta = max(delta, (int64_t) dev->min_delta_ns);
  196. clc = ((unsigned long long) delta * dev->mult) >> dev->shift;
  197. rc = dev->set_next_event((unsigned long) clc, dev);
  198. return (rc && force) ? clockevents_program_min_delta(dev) : rc;
  199. }
  200. /*
  201. * Called after a notify add to make devices available which were
  202. * released from the notifier call.
  203. */
  204. static void clockevents_notify_released(void)
  205. {
  206. struct clock_event_device *dev;
  207. while (!list_empty(&clockevents_released)) {
  208. dev = list_entry(clockevents_released.next,
  209. struct clock_event_device, list);
  210. list_del(&dev->list);
  211. list_add(&dev->list, &clockevent_devices);
  212. tick_check_new_device(dev);
  213. }
  214. }
  215. /*
  216. * Try to install a replacement clock event device
  217. */
  218. static int clockevents_replace(struct clock_event_device *ced)
  219. {
  220. struct clock_event_device *dev, *newdev = NULL;
  221. list_for_each_entry(dev, &clockevent_devices, list) {
  222. if (dev == ced || dev->mode != CLOCK_EVT_MODE_UNUSED)
  223. continue;
  224. if (!tick_check_replacement(newdev, dev))
  225. continue;
  226. if (!try_module_get(dev->owner))
  227. continue;
  228. if (newdev)
  229. module_put(newdev->owner);
  230. newdev = dev;
  231. }
  232. if (newdev) {
  233. tick_install_replacement(newdev);
  234. list_del_init(&ced->list);
  235. }
  236. return newdev ? 0 : -EBUSY;
  237. }
  238. /*
  239. * Called with clockevents_mutex and clockevents_lock held
  240. */
  241. static int __clockevents_try_unbind(struct clock_event_device *ced, int cpu)
  242. {
  243. /* Fast track. Device is unused */
  244. if (ced->mode == CLOCK_EVT_MODE_UNUSED) {
  245. list_del_init(&ced->list);
  246. return 0;
  247. }
  248. return ced == per_cpu(tick_cpu_device, cpu).evtdev ? -EAGAIN : -EBUSY;
  249. }
  250. /*
  251. * SMP function call to unbind a device
  252. */
  253. static void __clockevents_unbind(void *arg)
  254. {
  255. struct ce_unbind *cu = arg;
  256. int res;
  257. raw_spin_lock(&clockevents_lock);
  258. res = __clockevents_try_unbind(cu->ce, smp_processor_id());
  259. if (res == -EAGAIN)
  260. res = clockevents_replace(cu->ce);
  261. cu->res = res;
  262. raw_spin_unlock(&clockevents_lock);
  263. }
  264. /*
  265. * Issues smp function call to unbind a per cpu device. Called with
  266. * clockevents_mutex held.
  267. */
  268. static int clockevents_unbind(struct clock_event_device *ced, int cpu)
  269. {
  270. struct ce_unbind cu = { .ce = ced, .res = -ENODEV };
  271. smp_call_function_single(cpu, __clockevents_unbind, &cu, 1);
  272. return cu.res;
  273. }
  274. /*
  275. * Unbind a clockevents device.
  276. */
  277. int clockevents_unbind_device(struct clock_event_device *ced, int cpu)
  278. {
  279. int ret;
  280. mutex_lock(&clockevents_mutex);
  281. ret = clockevents_unbind(ced, cpu);
  282. mutex_unlock(&clockevents_mutex);
  283. return ret;
  284. }
  285. EXPORT_SYMBOL_GPL(clockevents_unbind);
  286. /**
  287. * clockevents_register_device - register a clock event device
  288. * @dev: device to register
  289. */
  290. void clockevents_register_device(struct clock_event_device *dev)
  291. {
  292. unsigned long flags;
  293. BUG_ON(dev->mode != CLOCK_EVT_MODE_UNUSED);
  294. if (!dev->cpumask) {
  295. WARN_ON(num_possible_cpus() > 1);
  296. dev->cpumask = cpumask_of(smp_processor_id());
  297. }
  298. raw_spin_lock_irqsave(&clockevents_lock, flags);
  299. list_add(&dev->list, &clockevent_devices);
  300. tick_check_new_device(dev);
  301. clockevents_notify_released();
  302. raw_spin_unlock_irqrestore(&clockevents_lock, flags);
  303. }
  304. EXPORT_SYMBOL_GPL(clockevents_register_device);
  305. void clockevents_config(struct clock_event_device *dev, u32 freq)
  306. {
  307. u64 sec;
  308. if (!(dev->features & CLOCK_EVT_FEAT_ONESHOT))
  309. return;
  310. /*
  311. * Calculate the maximum number of seconds we can sleep. Limit
  312. * to 10 minutes for hardware which can program more than
  313. * 32bit ticks so we still get reasonable conversion values.
  314. */
  315. sec = dev->max_delta_ticks;
  316. do_div(sec, freq);
  317. if (!sec)
  318. sec = 1;
  319. else if (sec > 600 && dev->max_delta_ticks > UINT_MAX)
  320. sec = 600;
  321. clockevents_calc_mult_shift(dev, freq, sec);
  322. dev->min_delta_ns = clockevent_delta2ns(dev->min_delta_ticks, dev);
  323. dev->max_delta_ns = clockevent_delta2ns(dev->max_delta_ticks, dev);
  324. }
  325. /**
  326. * clockevents_config_and_register - Configure and register a clock event device
  327. * @dev: device to register
  328. * @freq: The clock frequency
  329. * @min_delta: The minimum clock ticks to program in oneshot mode
  330. * @max_delta: The maximum clock ticks to program in oneshot mode
  331. *
  332. * min/max_delta can be 0 for devices which do not support oneshot mode.
  333. */
  334. void clockevents_config_and_register(struct clock_event_device *dev,
  335. u32 freq, unsigned long min_delta,
  336. unsigned long max_delta)
  337. {
  338. dev->min_delta_ticks = min_delta;
  339. dev->max_delta_ticks = max_delta;
  340. clockevents_config(dev, freq);
  341. clockevents_register_device(dev);
  342. }
  343. EXPORT_SYMBOL_GPL(clockevents_config_and_register);
  344. /**
  345. * clockevents_update_freq - Update frequency and reprogram a clock event device.
  346. * @dev: device to modify
  347. * @freq: new device frequency
  348. *
  349. * Reconfigure and reprogram a clock event device in oneshot
  350. * mode. Must be called on the cpu for which the device delivers per
  351. * cpu timer events with interrupts disabled! Returns 0 on success,
  352. * -ETIME when the event is in the past.
  353. */
  354. int clockevents_update_freq(struct clock_event_device *dev, u32 freq)
  355. {
  356. clockevents_config(dev, freq);
  357. if (dev->mode != CLOCK_EVT_MODE_ONESHOT)
  358. return 0;
  359. return clockevents_program_event(dev, dev->next_event, false);
  360. }
  361. /*
  362. * Noop handler when we shut down an event device
  363. */
  364. void clockevents_handle_noop(struct clock_event_device *dev)
  365. {
  366. }
  367. /**
  368. * clockevents_exchange_device - release and request clock devices
  369. * @old: device to release (can be NULL)
  370. * @new: device to request (can be NULL)
  371. *
  372. * Called from the notifier chain. clockevents_lock is held already
  373. */
  374. void clockevents_exchange_device(struct clock_event_device *old,
  375. struct clock_event_device *new)
  376. {
  377. unsigned long flags;
  378. local_irq_save(flags);
  379. /*
  380. * Caller releases a clock event device. We queue it into the
  381. * released list and do a notify add later.
  382. */
  383. if (old) {
  384. module_put(old->owner);
  385. clockevents_set_mode(old, CLOCK_EVT_MODE_UNUSED);
  386. list_del(&old->list);
  387. list_add(&old->list, &clockevents_released);
  388. }
  389. if (new) {
  390. BUG_ON(new->mode != CLOCK_EVT_MODE_UNUSED);
  391. clockevents_shutdown(new);
  392. }
  393. local_irq_restore(flags);
  394. }
  395. /**
  396. * clockevents_suspend - suspend clock devices
  397. */
  398. void clockevents_suspend(void)
  399. {
  400. struct clock_event_device *dev;
  401. list_for_each_entry_reverse(dev, &clockevent_devices, list)
  402. if (dev->suspend)
  403. dev->suspend(dev);
  404. }
  405. /**
  406. * clockevents_resume - resume clock devices
  407. */
  408. void clockevents_resume(void)
  409. {
  410. struct clock_event_device *dev;
  411. list_for_each_entry(dev, &clockevent_devices, list)
  412. if (dev->resume)
  413. dev->resume(dev);
  414. }
  415. #ifdef CONFIG_GENERIC_CLOCKEVENTS
  416. /**
  417. * clockevents_notify - notification about relevant events
  418. */
  419. void clockevents_notify(unsigned long reason, void *arg)
  420. {
  421. struct clock_event_device *dev, *tmp;
  422. unsigned long flags;
  423. int cpu;
  424. raw_spin_lock_irqsave(&clockevents_lock, flags);
  425. switch (reason) {
  426. case CLOCK_EVT_NOTIFY_BROADCAST_ON:
  427. case CLOCK_EVT_NOTIFY_BROADCAST_OFF:
  428. case CLOCK_EVT_NOTIFY_BROADCAST_FORCE:
  429. tick_broadcast_on_off(reason, arg);
  430. break;
  431. case CLOCK_EVT_NOTIFY_BROADCAST_ENTER:
  432. case CLOCK_EVT_NOTIFY_BROADCAST_EXIT:
  433. tick_broadcast_oneshot_control(reason);
  434. break;
  435. case CLOCK_EVT_NOTIFY_CPU_DYING:
  436. tick_handover_do_timer(arg);
  437. break;
  438. case CLOCK_EVT_NOTIFY_SUSPEND:
  439. tick_suspend();
  440. tick_suspend_broadcast();
  441. break;
  442. case CLOCK_EVT_NOTIFY_RESUME:
  443. tick_resume();
  444. break;
  445. case CLOCK_EVT_NOTIFY_CPU_DEAD:
  446. tick_shutdown_broadcast_oneshot(arg);
  447. tick_shutdown_broadcast(arg);
  448. tick_shutdown(arg);
  449. /*
  450. * Unregister the clock event devices which were
  451. * released from the users in the notify chain.
  452. */
  453. list_for_each_entry_safe(dev, tmp, &clockevents_released, list)
  454. list_del(&dev->list);
  455. /*
  456. * Now check whether the CPU has left unused per cpu devices
  457. */
  458. cpu = *((int *)arg);
  459. list_for_each_entry_safe(dev, tmp, &clockevent_devices, list) {
  460. if (cpumask_test_cpu(cpu, dev->cpumask) &&
  461. cpumask_weight(dev->cpumask) == 1 &&
  462. !tick_is_broadcast_device(dev)) {
  463. BUG_ON(dev->mode != CLOCK_EVT_MODE_UNUSED);
  464. list_del(&dev->list);
  465. }
  466. }
  467. break;
  468. default:
  469. break;
  470. }
  471. raw_spin_unlock_irqrestore(&clockevents_lock, flags);
  472. }
  473. EXPORT_SYMBOL_GPL(clockevents_notify);
  474. #ifdef CONFIG_SYSFS
  475. struct bus_type clockevents_subsys = {
  476. .name = "clockevents",
  477. .dev_name = "clockevent",
  478. };
  479. static DEFINE_PER_CPU(struct device, tick_percpu_dev);
  480. static struct tick_device *tick_get_tick_dev(struct device *dev);
  481. static ssize_t sysfs_show_current_tick_dev(struct device *dev,
  482. struct device_attribute *attr,
  483. char *buf)
  484. {
  485. struct tick_device *td;
  486. ssize_t count = 0;
  487. raw_spin_lock_irq(&clockevents_lock);
  488. td = tick_get_tick_dev(dev);
  489. if (td && td->evtdev)
  490. count = snprintf(buf, PAGE_SIZE, "%s\n", td->evtdev->name);
  491. raw_spin_unlock_irq(&clockevents_lock);
  492. return count;
  493. }
  494. static DEVICE_ATTR(current_device, 0444, sysfs_show_current_tick_dev, NULL);
  495. /* We don't support the abomination of removable broadcast devices */
  496. static ssize_t sysfs_unbind_tick_dev(struct device *dev,
  497. struct device_attribute *attr,
  498. const char *buf, size_t count)
  499. {
  500. char name[CS_NAME_LEN];
  501. size_t ret = sysfs_get_uname(buf, name, count);
  502. struct clock_event_device *ce;
  503. if (ret < 0)
  504. return ret;
  505. ret = -ENODEV;
  506. mutex_lock(&clockevents_mutex);
  507. raw_spin_lock_irq(&clockevents_lock);
  508. list_for_each_entry(ce, &clockevent_devices, list) {
  509. if (!strcmp(ce->name, name)) {
  510. ret = __clockevents_try_unbind(ce, dev->id);
  511. break;
  512. }
  513. }
  514. raw_spin_unlock_irq(&clockevents_lock);
  515. /*
  516. * We hold clockevents_mutex, so ce can't go away
  517. */
  518. if (ret == -EAGAIN)
  519. ret = clockevents_unbind(ce, dev->id);
  520. mutex_unlock(&clockevents_mutex);
  521. return ret ? ret : count;
  522. }
  523. static DEVICE_ATTR(unbind_device, 0200, NULL, sysfs_unbind_tick_dev);
  524. #ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
  525. static struct device tick_bc_dev = {
  526. .init_name = "broadcast",
  527. .id = 0,
  528. .bus = &clockevents_subsys,
  529. };
  530. static struct tick_device *tick_get_tick_dev(struct device *dev)
  531. {
  532. return dev == &tick_bc_dev ? tick_get_broadcast_device() :
  533. &per_cpu(tick_cpu_device, dev->id);
  534. }
  535. static __init int tick_broadcast_init_sysfs(void)
  536. {
  537. int err = device_register(&tick_bc_dev);
  538. if (!err)
  539. err = device_create_file(&tick_bc_dev, &dev_attr_current_device);
  540. return err;
  541. }
  542. #else
  543. static struct tick_device *tick_get_tick_dev(struct device *dev)
  544. {
  545. return &per_cpu(tick_cpu_device, dev->id);
  546. }
  547. static inline int tick_broadcast_init_sysfs(void) { return 0; }
  548. #endif
  549. static int __init tick_init_sysfs(void)
  550. {
  551. int cpu;
  552. for_each_possible_cpu(cpu) {
  553. struct device *dev = &per_cpu(tick_percpu_dev, cpu);
  554. int err;
  555. dev->id = cpu;
  556. dev->bus = &clockevents_subsys;
  557. err = device_register(dev);
  558. if (!err)
  559. err = device_create_file(dev, &dev_attr_current_device);
  560. if (!err)
  561. err = device_create_file(dev, &dev_attr_unbind_device);
  562. if (err)
  563. return err;
  564. }
  565. return tick_broadcast_init_sysfs();
  566. }
  567. static int __init clockevents_init_sysfs(void)
  568. {
  569. int err = subsys_system_register(&clockevents_subsys, NULL);
  570. if (!err)
  571. err = tick_init_sysfs();
  572. return err;
  573. }
  574. device_initcall(clockevents_init_sysfs);
  575. #endif /* SYSFS */
  576. #endif /* GENERIC_CLOCK_EVENTS */