* [patch 04/39] sound: Use hrtimer_resolution instead of hrtimer_get_res()
[not found] <20150414203303.702062272@linutronix.de>
@ 2015-04-14 21:08 ` Thomas Gleixner
2015-04-16 8:07 ` Takashi Iwai
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Gleixner @ 2015-04-14 21:08 UTC (permalink / raw)
To: LKML
Cc: alsa-devel, Peter Zijlstra, Frederic Weisbecker, Marcelo Tosatti,
Takashi Iwai, Viresh Kumar, Preeti U Murthy, Ingo Molnar
[-- Attachment #1: sound-use-hrtimer-resolution.patch --]
[-- Type: text/plain, Size: 2534 bytes --]
No point in converting a timespec now that the value is directly
accessible. Get rid of the null check while at it. Resolution is
guaranteed to be > 0.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org
---
sound/core/hrtimer.c | 9 +--------
sound/drivers/pcsp/pcsp.c | 15 ++++++---------
2 files changed, 7 insertions(+), 17 deletions(-)
Index: tip/sound/core/hrtimer.c
===================================================================
--- tip.orig/sound/core/hrtimer.c
+++ tip/sound/core/hrtimer.c
@@ -121,16 +121,9 @@ static struct snd_timer *mytimer;
static int __init snd_hrtimer_init(void)
{
struct snd_timer *timer;
- struct timespec tp;
int err;
- hrtimer_get_res(CLOCK_MONOTONIC, &tp);
- if (tp.tv_sec > 0 || !tp.tv_nsec) {
- pr_err("snd-hrtimer: Invalid resolution %u.%09u",
- (unsigned)tp.tv_sec, (unsigned)tp.tv_nsec);
- return -EINVAL;
- }
- resolution = tp.tv_nsec;
+ resolution = hrtimer_resolution;
/* Create a new timer and set up the fields */
err = snd_timer_global_new("hrtimer", SNDRV_TIMER_GLOBAL_HRTIMER,
Index: tip/sound/drivers/pcsp/pcsp.c
===================================================================
--- tip.orig/sound/drivers/pcsp/pcsp.c
+++ tip/sound/drivers/pcsp/pcsp.c
@@ -42,16 +42,13 @@ struct snd_pcsp pcsp_chip;
static int snd_pcsp_create(struct snd_card *card)
{
static struct snd_device_ops ops = { };
- struct timespec tp;
- int err;
- int div, min_div, order;
-
- hrtimer_get_res(CLOCK_MONOTONIC, &tp);
+ unsigned int resolution = hrtimer_resolution;
+ int err, div, min_div, order;
if (!nopcm) {
- if (tp.tv_sec || tp.tv_nsec > PCSP_MAX_PERIOD_NS) {
+ if (resolution > PCSP_MAX_PERIOD_NS) {
printk(KERN_ERR "PCSP: Timer resolution is not sufficient "
- "(%linS)\n", tp.tv_nsec);
+ "(%linS)\n", resolution);
printk(KERN_ERR "PCSP: Make sure you have HPET and ACPI "
"enabled.\n");
printk(KERN_ERR "PCSP: Turned into nopcm mode.\n");
@@ -59,13 +56,13 @@ static int snd_pcsp_create(struct snd_ca
}
}
- if (loops_per_jiffy >= PCSP_MIN_LPJ && tp.tv_nsec <= PCSP_MIN_PERIOD_NS)
+ if (loops_per_jiffy >= PCSP_MIN_LPJ && resolution <= PCSP_MIN_PERIOD_NS)
min_div = MIN_DIV;
else
min_div = MAX_DIV;
#if PCSP_DEBUG
printk(KERN_DEBUG "PCSP: lpj=%li, min_div=%i, res=%li\n",
- loops_per_jiffy, min_div, tp.tv_nsec);
+ loops_per_jiffy, min_div, resolution);
#endif
div = MAX_DIV / min_div;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch 04/39] sound: Use hrtimer_resolution instead of hrtimer_get_res()
2015-04-14 21:08 ` [patch 04/39] sound: Use hrtimer_resolution instead of hrtimer_get_res() Thomas Gleixner
@ 2015-04-16 8:07 ` Takashi Iwai
2015-04-16 9:08 ` Thomas Gleixner
0 siblings, 1 reply; 3+ messages in thread
From: Takashi Iwai @ 2015-04-16 8:07 UTC (permalink / raw)
To: Thomas Gleixner
Cc: alsa-devel, Peter Zijlstra, Viresh Kumar, LKML, Ingo Molnar,
Frederic Weisbecker, Preeti U Murthy, Marcelo Tosatti
At Tue, 14 Apr 2015 21:08:30 -0000,
Thomas Gleixner wrote:
>
> No point in converting a timespec now that the value is directly
> accessible. Get rid of the null check while at it. Resolution is
> guaranteed to be > 0.
>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Cc: Jaroslav Kysela <perex@perex.cz>
> Cc: Takashi Iwai <tiwai@suse.de>
Would you like me picking up this through sound git tree, or apply the
whole set through tip? In the latter case, feel free to take my ack:
Acked-by: Takashi Iwai <tiwai@suse.de>
thanks,
Takashi
> Cc: alsa-devel@alsa-project.org
> ---
> sound/core/hrtimer.c | 9 +--------
> sound/drivers/pcsp/pcsp.c | 15 ++++++---------
> 2 files changed, 7 insertions(+), 17 deletions(-)
>
> Index: tip/sound/core/hrtimer.c
> ===================================================================
> --- tip.orig/sound/core/hrtimer.c
> +++ tip/sound/core/hrtimer.c
> @@ -121,16 +121,9 @@ static struct snd_timer *mytimer;
> static int __init snd_hrtimer_init(void)
> {
> struct snd_timer *timer;
> - struct timespec tp;
> int err;
>
> - hrtimer_get_res(CLOCK_MONOTONIC, &tp);
> - if (tp.tv_sec > 0 || !tp.tv_nsec) {
> - pr_err("snd-hrtimer: Invalid resolution %u.%09u",
> - (unsigned)tp.tv_sec, (unsigned)tp.tv_nsec);
> - return -EINVAL;
> - }
> - resolution = tp.tv_nsec;
> + resolution = hrtimer_resolution;
>
> /* Create a new timer and set up the fields */
> err = snd_timer_global_new("hrtimer", SNDRV_TIMER_GLOBAL_HRTIMER,
> Index: tip/sound/drivers/pcsp/pcsp.c
> ===================================================================
> --- tip.orig/sound/drivers/pcsp/pcsp.c
> +++ tip/sound/drivers/pcsp/pcsp.c
> @@ -42,16 +42,13 @@ struct snd_pcsp pcsp_chip;
> static int snd_pcsp_create(struct snd_card *card)
> {
> static struct snd_device_ops ops = { };
> - struct timespec tp;
> - int err;
> - int div, min_div, order;
> -
> - hrtimer_get_res(CLOCK_MONOTONIC, &tp);
> + unsigned int resolution = hrtimer_resolution;
> + int err, div, min_div, order;
>
> if (!nopcm) {
> - if (tp.tv_sec || tp.tv_nsec > PCSP_MAX_PERIOD_NS) {
> + if (resolution > PCSP_MAX_PERIOD_NS) {
> printk(KERN_ERR "PCSP: Timer resolution is not sufficient "
> - "(%linS)\n", tp.tv_nsec);
> + "(%linS)\n", resolution);
> printk(KERN_ERR "PCSP: Make sure you have HPET and ACPI "
> "enabled.\n");
> printk(KERN_ERR "PCSP: Turned into nopcm mode.\n");
> @@ -59,13 +56,13 @@ static int snd_pcsp_create(struct snd_ca
> }
> }
>
> - if (loops_per_jiffy >= PCSP_MIN_LPJ && tp.tv_nsec <= PCSP_MIN_PERIOD_NS)
> + if (loops_per_jiffy >= PCSP_MIN_LPJ && resolution <= PCSP_MIN_PERIOD_NS)
> min_div = MIN_DIV;
> else
> min_div = MAX_DIV;
> #if PCSP_DEBUG
> printk(KERN_DEBUG "PCSP: lpj=%li, min_div=%i, res=%li\n",
> - loops_per_jiffy, min_div, tp.tv_nsec);
> + loops_per_jiffy, min_div, resolution);
> #endif
>
> div = MAX_DIV / min_div;
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch 04/39] sound: Use hrtimer_resolution instead of hrtimer_get_res()
2015-04-16 8:07 ` Takashi Iwai
@ 2015-04-16 9:08 ` Thomas Gleixner
0 siblings, 0 replies; 3+ messages in thread
From: Thomas Gleixner @ 2015-04-16 9:08 UTC (permalink / raw)
To: Takashi Iwai
Cc: LKML, Peter Zijlstra, Ingo Molnar, Preeti U Murthy, Viresh Kumar,
Marcelo Tosatti, Frederic Weisbecker, Jaroslav Kysela, alsa-devel
On Thu, 16 Apr 2015, Takashi Iwai wrote:
> At Tue, 14 Apr 2015 21:08:30 -0000,
> Thomas Gleixner wrote:
> >
> > No point in converting a timespec now that the value is directly
> > accessible. Get rid of the null check while at it. Resolution is
> > guaranteed to be > 0.
> >
> > Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> > Cc: Jaroslav Kysela <perex@perex.cz>
> > Cc: Takashi Iwai <tiwai@suse.de>
>
> Would you like me picking up this through sound git tree, or apply the
> whole set through tip? In the latter case, feel free to take my ack:
> Acked-by: Takashi Iwai <tiwai@suse.de>
I pick it up as it has a dependency on core code changes.
Thanks,
tglx
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-04-16 9:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20150414203303.702062272@linutronix.de>
2015-04-14 21:08 ` [patch 04/39] sound: Use hrtimer_resolution instead of hrtimer_get_res() Thomas Gleixner
2015-04-16 8:07 ` Takashi Iwai
2015-04-16 9:08 ` Thomas Gleixner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox