Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752881Ab0KDTaJ (ORCPT ); Thu, 4 Nov 2010 15:30:09 -0400 Received: from mail-bw0-f46.google.com ([209.85.214.46]:44206 "EHLO mail-bw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752468Ab0KDTaH (ORCPT ); Thu, 4 Nov 2010 15:30:07 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=jHyDaP+V7X4N9rN6VO6enLLrNQwuX9wItG5DBNmVfypmA2JLDVDWOrz5TFX3HI3qW/ DoKxn/AOCK8lINQDdg/GvolPxDwXEBoD5Me4x9v3kSWZoH+7gywU/59Jt1MOkhuksHUj 6xLak9LueHKp6XqyBHlOp8bx0aP0hdN6UxUNw= Date: Thu, 4 Nov 2010 20:30:04 +0100 From: Richard Cochran To: linux-kernel@vger.kernel.org Cc: linux-api@vger.kernel.org, Alan Cox , Arnd Bergmann , Christoph Lameter , John Stultz , Peter Zijlstra , Thomas Gleixner Subject: [PATCH RFC 6/8] clock device: convert timer_delete Message-ID: <9572b12e091e4dbab43e7c883e633fdb314fe574.1288897199.git.richard.cochran@omicron.at> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2223 Lines: 72 This patch lets the timer_delete system call use dynamic clock devices. Signed-off-by: Richard Cochran --- include/linux/clockdevice.h | 1 + kernel/posix-timers.c | 7 +++++++ kernel/time/clockdevice.c | 18 ++++++++++++++++++ 3 files changed, 26 insertions(+), 0 deletions(-) diff --git a/include/linux/clockdevice.h b/include/linux/clockdevice.h index 3201a28..592bd5e 100644 --- a/include/linux/clockdevice.h +++ b/include/linux/clockdevice.h @@ -107,5 +107,6 @@ struct clock_device *clockid_to_clock_device(clockid_t id); * The following functions are only to be called from posix-timers.c */ int clock_device_timer_create(struct clock_device *clk, struct k_itimer *kit); +int clock_device_timer_delete(struct clock_device *clk, struct k_itimer *kit); #endif diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c index 42efbe9..5feb565 100644 --- a/kernel/posix-timers.c +++ b/kernel/posix-timers.c @@ -857,6 +857,13 @@ static inline int common_timer_del(struct k_itimer *timer) static inline int timer_delete_hook(struct k_itimer *timer) { + struct clock_device *clk_dev; + + clk_dev = clockid_to_clock_device(timer->it_clock); + + if (clk_dev) + return clock_device_timer_delete(clk_dev, timer); + return CLOCK_DISPATCH(timer->it_clock, timer_del, (timer)); } diff --git a/kernel/time/clockdevice.c b/kernel/time/clockdevice.c index 166cc30..27d13a4 100644 --- a/kernel/time/clockdevice.c +++ b/kernel/time/clockdevice.c @@ -281,3 +281,21 @@ int clock_device_timer_create(struct clock_device *clk, struct k_itimer *kit) mutex_unlock(&clk->mux); return err; } + +int clock_device_timer_delete(struct clock_device *clk, struct k_itimer *kit) +{ + int err; + + mutex_lock(&clk->mux); + + if (clk->zombie) + err = -ENODEV; + else if (!clk->ops->timer_delete) + err = -EOPNOTSUPP; + else + err = clk->ops->timer_delete(clk->priv, kit); + + mutex_unlock(&clk->mux); + + return err; +} -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/