Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e56425b1 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* 'timers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  posix-timers.c: Don't export local functions
  clocksource: start CMT at clocksource resume
  clocksource: add suspend callback
  clocksource: add argument to resume callback
  ntp: Cleanup xtime references in ntp.c
  ntp: Make time_esterror and time_maxerror static
parents 786f8ba2 6622e670
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -61,7 +61,7 @@ unsigned long long sched_clock(void)

#ifdef CONFIG_PARAVIRT
static void
paravirt_clocksource_resume(void)
paravirt_clocksource_resume(struct clocksource *cs)
{
	if (pv_time_ops.clocksource_resume)
		pv_time_ops.clocksource_resume();
+1 −1
Original line number Diff line number Diff line
@@ -266,7 +266,7 @@ static void hpet_resume_device(void)
	force_hpet_resume();
}

static void hpet_resume_counter(void)
static void hpet_resume_counter(struct clocksource *cs)
{
	hpet_resume_device();
	hpet_restart_counter();
+1 −1
Original line number Diff line number Diff line
@@ -740,7 +740,7 @@ static cycle_t __vsyscall_fn vread_tsc(void)
}
#endif

static void resume_tsc(void)
static void resume_tsc(struct clocksource *cs)
{
	clocksource_tsc.cycle_last = 0;
}
+7 −28
Original line number Diff line number Diff line
@@ -40,7 +40,6 @@ struct sh_cmt_priv {
	struct platform_device *pdev;

	unsigned long flags;
	unsigned long flags_suspend;
	unsigned long match_value;
	unsigned long next_match_value;
	unsigned long max_match_value;
@@ -432,6 +431,11 @@ static void sh_cmt_clocksource_disable(struct clocksource *cs)
	sh_cmt_stop(cs_to_sh_cmt(cs), FLAG_CLOCKSOURCE);
}

static void sh_cmt_clocksource_resume(struct clocksource *cs)
{
	sh_cmt_start(cs_to_sh_cmt(cs), FLAG_CLOCKSOURCE);
}

static int sh_cmt_register_clocksource(struct sh_cmt_priv *p,
				       char *name, unsigned long rating)
{
@@ -442,6 +446,8 @@ static int sh_cmt_register_clocksource(struct sh_cmt_priv *p,
	cs->read = sh_cmt_clocksource_read;
	cs->enable = sh_cmt_clocksource_enable;
	cs->disable = sh_cmt_clocksource_disable;
	cs->suspend = sh_cmt_clocksource_disable;
	cs->resume = sh_cmt_clocksource_resume;
	cs->mask = CLOCKSOURCE_MASK(sizeof(unsigned long) * 8);
	cs->flags = CLOCK_SOURCE_IS_CONTINUOUS;
	pr_info("sh_cmt: %s used as clock source\n", cs->name);
@@ -674,38 +680,11 @@ static int __devexit sh_cmt_remove(struct platform_device *pdev)
	return -EBUSY; /* cannot unregister clockevent and clocksource */
}

static int sh_cmt_suspend(struct device *dev)
{
	struct platform_device *pdev = to_platform_device(dev);
	struct sh_cmt_priv *p = platform_get_drvdata(pdev);

	/* save flag state and stop CMT channel */
	p->flags_suspend = p->flags;
	sh_cmt_stop(p, p->flags);
	return 0;
}

static int sh_cmt_resume(struct device *dev)
{
	struct platform_device *pdev = to_platform_device(dev);
	struct sh_cmt_priv *p = platform_get_drvdata(pdev);

	/* start CMT channel from saved state */
	sh_cmt_start(p, p->flags_suspend);
	return 0;
}

static struct dev_pm_ops sh_cmt_dev_pm_ops = {
	.suspend = sh_cmt_suspend,
	.resume = sh_cmt_resume,
};

static struct platform_driver sh_cmt_device_driver = {
	.probe		= sh_cmt_probe,
	.remove		= __devexit_p(sh_cmt_remove),
	.driver		= {
		.name	= "sh_cmt",
		.pm	= &sh_cmt_dev_pm_ops,
	}
};

+4 −1
Original line number Diff line number Diff line
@@ -154,6 +154,7 @@ extern u64 timecounter_cyc2time(struct timecounter *tc,
 * @max_idle_ns:	max idle time permitted by the clocksource (nsecs)
 * @flags:		flags describing special properties
 * @vread:		vsyscall based read
 * @suspend:		suspend function for the clocksource, if necessary
 * @resume:		resume function for the clocksource, if necessary
 */
struct clocksource {
@@ -172,7 +173,8 @@ struct clocksource {
	u64 max_idle_ns;
	unsigned long flags;
	cycle_t (*vread)(void);
	void (*resume)(void);
	void (*suspend)(struct clocksource *cs);
	void (*resume)(struct clocksource *cs);
#ifdef CONFIG_IA64
	void *fsys_mmio;        /* used by fsyscall asm code */
#define CLKSRC_FSYS_MMIO_SET(mmio, addr)      ((mmio) = (addr))
@@ -277,6 +279,7 @@ extern void clocksource_unregister(struct clocksource*);
extern void clocksource_touch_watchdog(void);
extern struct clocksource* clocksource_get_next(void);
extern void clocksource_change_rating(struct clocksource *cs, int rating);
extern void clocksource_suspend(void);
extern void clocksource_resume(void);
extern struct clocksource * __init __weak clocksource_default_clock(void);
extern void clocksource_mark_unstable(struct clocksource *cs);
Loading