All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@codeaurora.org>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: LKML <linux-kernel@vger.kernel.org>,
	John Stultz <john.stultz@linaro.org>, Ingo Molnar <mingo@elte.hu>,
	Magnus Damm <magnus.damm@gmail.com>
Subject: Re: [patch 13/15] clockevents: Provide sysfs interface
Date: Fri, 26 Apr 2013 15:37:29 -0700	[thread overview]
Message-ID: <20130426223729.GA782@sboyd-linux.qualcomm.com> (raw)
In-Reply-To: <20130425143436.371634778@linutronix.de>

On 04/25, Thomas Gleixner wrote:
> Provide a simple sysfs interface for the clockevent devices. Show the
> current active clockevent device.
> 

Neat. Does this do anything about clockevents that aren't in use
for the tick devices or broadcast device?

> Index: tip/kernel/time/clockevents.c
> ===================================================================
> --- tip.orig/kernel/time/clockevents.c
> +++ tip/kernel/time/clockevents.c
> @@ -460,4 +461,89 @@ void clockevents_notify(unsigned long re
>  	raw_spin_unlock_irqrestore(&clockevents_lock, flags);
>  }
>  EXPORT_SYMBOL_GPL(clockevents_notify);
> +
> +#ifdef CONFIG_SYSFS
> +struct bus_type clockevents_subsys = {
> +	.name		= "clockevents",
> +	.dev_name       = "clockevent",
> +};
> +
> +static DEFINE_PER_CPU(struct device, tick_percpu_dev);
> +static struct tick_device *tick_get_tick_dev(struct device *dev);
> +
> +static ssize_t sysfs_show_current_tick_dev(struct device *dev,
> +					   struct device_attribute *attr,
> +					   char *buf)
> +{
> +	struct tick_device *td;
> +	ssize_t count = 0;
> +
> +	raw_spin_lock_irq(&clockevents_lock);
> +	td = tick_get_tick_dev(dev);
> +	if (td && td->evtdev)
> +		count = snprintf(buf, PAGE_SIZE, "%s\n", td->evtdev->name);
> +	raw_spin_unlock_irq(&clockevents_lock);
> +	return count;
> +}
> +static DEVICE_ATTR(current_device, 0444, sysfs_show_current_tick_dev, NULL);
> +
> +#ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
> +static struct device tick_bc_dev = {
> +	.init_name	= "broadcast",
> +	.id		= 0,
> +	.bus		= &clockevents_subsys,
> +};
> +
> +static struct tick_device *tick_get_tick_dev(struct device *dev)
> +{
> +	return dev == &tick_bc_dev ? tick_get_broadcast_device() :
> +		&per_cpu(tick_cpu_device, dev->id);
> +}
> +
> +static int tick_broadcast_init_sysfs(void)

__init?

> +{
> +	int err = device_register(&tick_bc_dev);
> +
> +	if (!err)
> +		err = device_create_file(&tick_bc_dev, &dev_attr_current_device);
> +	return err;
> +}
> +#else
> +static struct tick_device *tick_get_tick_dev(struct device *dev)
> +{
> +	return &per_cpu(tick_cpu_device, dev->id);
> +}
> +static inline int tick_broadcast_init_sysfs(void) { return 0; }
>  #endif
> +
> +int __init tick_init_sysfs(void)

static?

> +{
> +	int cpu;
> +
> +	for_each_possible_cpu(cpu) {
> +		struct device *dev = &per_cpu(tick_percpu_dev, cpu);
> +		int err;
> +
> +		dev->id = cpu;
> +		dev->bus = &clockevents_subsys;
> +		err = device_register(dev);
> +		if (!err)
> +			err = device_create_file(dev, &dev_attr_current_device);
> +		if (err)
> +			return err;
> +	}
> +	return tick_broadcast_init_sysfs();
> +}

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

  reply	other threads:[~2013-04-26 22:37 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-25 20:31 [patch 00/15] clocksource/events: Overhaul (un)registration Thomas Gleixner
2013-04-25 20:31 ` [patch 02/15] clocksource: Always verify highres capability Thomas Gleixner
2013-04-30  0:34   ` John Stultz
2013-05-27  9:42   ` [tip:timers/core] " tip-bot for Thomas Gleixner
2013-04-25 20:31 ` [patch 01/15] clocksource: apb_timer: Remove unsused function Thomas Gleixner
2013-04-26 12:43   ` Jamie Iles
2013-04-30  0:32   ` John Stultz
2013-05-27  9:41   ` [tip:timers/core] " tip-bot for Thomas Gleixner
2013-04-25 20:31 ` [patch 03/15] clocksource: Let timekeeping_notify return success/error Thomas Gleixner
2013-04-30  0:37   ` John Stultz
2013-05-27  9:43   ` [tip:timers/core] " tip-bot for Thomas Gleixner
2013-04-25 20:31 ` [patch 04/15] clocksource: Add module refcount Thomas Gleixner
2013-04-30  0:51   ` John Stultz
2013-05-27  9:45   ` [tip:timers/core] " tip-bot for Thomas Gleixner
2013-04-25 20:31 ` [patch 06/15] clocksource: Split out user string input Thomas Gleixner
2013-04-29 23:29   ` John Stultz
2013-05-15  9:41     ` Thomas Gleixner
2013-05-27  9:47   ` [tip:timers/core] " tip-bot for Thomas Gleixner
2013-04-25 20:31 ` [patch 05/15] clocksource: Allow clocksource select to skip current clocksource Thomas Gleixner
2013-04-30  1:00   ` John Stultz
2013-05-15  9:42     ` Thomas Gleixner
2013-05-27  9:46   ` [tip:timers/core] " tip-bot for Thomas Gleixner
2013-04-25 20:31 ` [patch 08/15] clocksource: Let clocksource_unregister() return success/error Thomas Gleixner
2013-04-30  1:01   ` John Stultz
2013-05-27  9:50   ` [tip:timers/core] " tip-bot for Thomas Gleixner
2013-04-25 20:31 ` [patch 07/15] clocksource: Provide unbind interface in sysfs Thomas Gleixner
2013-04-30  1:11   ` John Stultz
2013-05-15  9:47     ` Thomas Gleixner
2013-05-15 16:53       ` John Stultz
2013-05-15 18:41         ` Thomas Gleixner
2013-05-27  9:48   ` [tip:timers/core] " tip-bot for Thomas Gleixner
2013-04-25 20:31 ` [patch 09/15] clockevents: Get rid of the notifier chain Thomas Gleixner
2013-05-27  9:51   ` [tip:timers/core] " tip-bot for Thomas Gleixner
2013-04-25 20:31 ` [patch 11/15] clockevents: Move the tick_notify() switch case to clockevents_notify() Thomas Gleixner
2013-05-27  9:54   ` [tip:timers/core] " tip-bot for Thomas Gleixner
2013-04-25 20:31 ` [patch 10/15] clockevents: Simplify locking Thomas Gleixner
2013-05-27  9:52   ` [tip:timers/core] " tip-bot for Thomas Gleixner
2013-04-25 20:31 ` [patch 12/15] clockevents: Add module refcount Thomas Gleixner
2013-05-27  9:55   ` [tip:timers/core] " tip-bot for Thomas Gleixner
2013-04-25 20:31 ` [patch 13/15] clockevents: Provide sysfs interface Thomas Gleixner
2013-04-26 22:37   ` Stephen Boyd [this message]
2013-05-15  9:50     ` Thomas Gleixner
2013-05-15 22:30       ` Stephen Boyd
2013-05-27  9:56   ` [tip:timers/core] " tip-bot for Thomas Gleixner
2013-04-25 20:31 ` [patch 15/15] clockevents: Implement unbind functionality Thomas Gleixner
2013-05-27  9:59   ` [tip:timers/core] " tip-bot for Thomas Gleixner
2013-04-25 20:31 ` [patch 14/15] clockevents: Split out selection logic Thomas Gleixner
2013-05-27  9:57   ` [tip:timers/core] " tip-bot for Thomas Gleixner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130426223729.GA782@sboyd-linux.qualcomm.com \
    --to=sboyd@codeaurora.org \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.