From patchwork Thu Jul 19 21:15:41 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tejun Heo X-Patchwork-Id: 1218701 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 2FA5FE007A for ; Thu, 19 Jul 2012 21:15:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752225Ab2GSVPs (ORCPT ); Thu, 19 Jul 2012 17:15:48 -0400 Received: from mail-pb0-f46.google.com ([209.85.160.46]:54738 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751951Ab2GSVPp (ORCPT ); Thu, 19 Jul 2012 17:15:45 -0400 Received: by mail-pb0-f46.google.com with SMTP id rp8so4950845pbb.19 for ; Thu, 19 Jul 2012 14:15:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=Pg6BlynSlMy3mYMtlET728eZV0BQMN6wotcfKB3fTRo=; b=uZtP8+vib0hppQdiSQ1m1rMXcvdM/MxXVq7YqYu8kd1CozWRa3ndLcKR0xs32l1BCD x08KYdjinOiWrlrP2ugsK8j0soI+gWcd8z0sPZNZarrIFvh7jIj3SWFmV9WH4+hSMiqU dJZZX6OsgvTiFtqvdT3yiizZiYdnaP3zK1H+ZPUf5V4Yd1Jiw0eEPLSoGeq07k6GFjFu ej8SvMf2k1Rd+SGLZ2WdISwqcOJ0hfH+yH64ZDX82fcROyKLw1o+O9jB/lju5iS4mUFI 4jZ3lwL4dOU7Rqf6rWIEjh7jj2XkgAvfjRm9LWGxFawIfWi0orppHOs0emAKL4NPmk7Z +J1g== Received: by 10.68.209.197 with SMTP id mo5mr8243166pbc.72.1342732545126; Thu, 19 Jul 2012 14:15:45 -0700 (PDT) Received: from google.com (wtj.mtv.corp.google.com [172.18.110.84]) by mx.google.com with ESMTPS id nh8sm2456553pbc.60.2012.07.19.14.15.43 (version=SSLv3 cipher=OTHER); Thu, 19 Jul 2012 14:15:44 -0700 (PDT) Date: Thu, 19 Jul 2012 14:15:41 -0700 From: Tejun Heo To: linux-kernel@vger.kernel.org Cc: Andrew Morton , Avi Kivity , kvm@vger.kernel.org, Andy Walls , ivtv-devel@ivtvdriver.org, linux-media@vger.kernel.org, Grant Likely , spi-devel-general@lists.sourceforge.net, Linus Torvalds Subject: [PATCH 1/2] kthread_worker: reorganize to prepare for flush_kthread_work() reimplementation Message-ID: <20120719211541.GB32763@google.com> References: <20120719211510.GA32763@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20120719211510.GA32763@google.com> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From c9bba34243a86fb3ac82d1bdd0ce4bf796b79559 Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Thu, 19 Jul 2012 13:52:53 -0700 Make the following two non-functional changes. * Separate out insert_kthread_work() from queue_kthread_work(). * Relocate struct kthread_flush_work and kthread_flush_work_fn() definitions above flush_kthread_work(). Signed-off-by: Tejun Heo Acked-by: Andy Walls --- kernel/kthread.c | 40 ++++++++++++++++++++++++---------------- 1 files changed, 24 insertions(+), 16 deletions(-) diff --git a/kernel/kthread.c b/kernel/kthread.c index 3d3de63..7b8a678 100644 --- a/kernel/kthread.c +++ b/kernel/kthread.c @@ -378,6 +378,17 @@ repeat: } EXPORT_SYMBOL_GPL(kthread_worker_fn); +/* insert @work before @pos in @worker */ +static void insert_kthread_work(struct kthread_worker *worker, + struct kthread_work *work, + struct list_head *pos) +{ + list_add_tail(&work->node, pos); + work->queue_seq++; + if (likely(worker->task)) + wake_up_process(worker->task); +} + /** * queue_kthread_work - queue a kthread_work * @worker: target kthread_worker @@ -395,10 +406,7 @@ bool queue_kthread_work(struct kthread_worker *worker, spin_lock_irqsave(&worker->lock, flags); if (list_empty(&work->node)) { - list_add_tail(&work->node, &worker->work_list); - work->queue_seq++; - if (likely(worker->task)) - wake_up_process(worker->task); + insert_kthread_work(worker, work, &worker->work_list); ret = true; } spin_unlock_irqrestore(&worker->lock, flags); @@ -406,6 +414,18 @@ bool queue_kthread_work(struct kthread_worker *worker, } EXPORT_SYMBOL_GPL(queue_kthread_work); +struct kthread_flush_work { + struct kthread_work work; + struct completion done; +}; + +static void kthread_flush_work_fn(struct kthread_work *work) +{ + struct kthread_flush_work *fwork = + container_of(work, struct kthread_flush_work, work); + complete(&fwork->done); +} + /** * flush_kthread_work - flush a kthread_work * @work: work to flush @@ -436,18 +456,6 @@ void flush_kthread_work(struct kthread_work *work) } EXPORT_SYMBOL_GPL(flush_kthread_work); -struct kthread_flush_work { - struct kthread_work work; - struct completion done; -}; - -static void kthread_flush_work_fn(struct kthread_work *work) -{ - struct kthread_flush_work *fwork = - container_of(work, struct kthread_flush_work, work); - complete(&fwork->done); -} - /** * flush_kthread_worker - flush all current works on a kthread_worker * @worker: worker to flush