From patchwork Wed Sep 10 15:54:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Herrmann X-Patchwork-Id: 4878981 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id CDCCAC0338 for ; Wed, 10 Sep 2014 15:54:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8A90E2011E for ; Wed, 10 Sep 2014 15:54:56 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 5D325201C7 for ; Wed, 10 Sep 2014 15:54:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7423089FDD; Wed, 10 Sep 2014 08:54:54 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wg0-f44.google.com (mail-wg0-f44.google.com [74.125.82.44]) by gabe.freedesktop.org (Postfix) with ESMTP id 9D7B789FD4 for ; Wed, 10 Sep 2014 08:54:53 -0700 (PDT) Received: by mail-wg0-f44.google.com with SMTP id y10so4352805wgg.15 for ; Wed, 10 Sep 2014 08:54:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=76uS0NFyy6T7ch7ag8x0D2qFNW7/bQ5uzrEJxw9K6zM=; b=LvzwxdIXGUlRNmI3jy8JRhnRyj8oL/7+Bo1NC6IMPTeF2muNOIMVfwnZAn0hpcBIWH qCNFQoQLhVj4/8FIa79LO8aVegh7L4uiuVTI/G9hS49fSMqoS1UUD2uI2hv6L/U3hnzf +eOdO3WdpMIFJ3BEKwyW+iZ9eHAd1vB2srr1+QXebHVzg8bIU/9T3YIAbehvqhnR3/QK WO9/9ic9XUVBMCYbIw9pMEzg+9XUaNsdO0ZMiP9Xn7hScWuAaPozR5WEUlIa0TEfDYz+ x+AB6skGPHPO42/ifzhCJfJO+XeQyd6Wvkx3aT7f+wWIHHGfpjDPDVj5PApWWT7eFuRF pkWg== X-Received: by 10.180.160.229 with SMTP id xn5mr792937wib.64.1410364492709; Wed, 10 Sep 2014 08:54:52 -0700 (PDT) Received: from david-tp.localdomain (stgt-5f7015fa.pool.mediaWays.net. [95.112.21.250]) by mx.google.com with ESMTPSA id js2sm19046250wjc.9.2014.09.10.08.54.50 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 10 Sep 2014 08:54:51 -0700 (PDT) From: David Herrmann To: dri-devel@lists.freedesktop.org Subject: [PATCH RFC 1/4] backlight: use static initializers Date: Wed, 10 Sep 2014 17:54:20 +0200 Message-Id: <1410364463-12692-2-git-send-email-dh.herrmann@gmail.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1410364463-12692-1-git-send-email-dh.herrmann@gmail.com> References: <1410364463-12692-1-git-send-email-dh.herrmann@gmail.com> Cc: Matthew Garrett , Daniel Vetter , Bryan Wu , linux-kernel@vger.kernel.org, Lee Jones X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use static initializers instead of setting up global variables during runtime. This reduces code size and execution time. Signed-off-by: David Herrmann Reviewed-by: Jani Nikula --- drivers/video/backlight/backlight.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c index bddc8b1..726c6c6 100644 --- a/drivers/video/backlight/backlight.c +++ b/drivers/video/backlight/backlight.c @@ -21,9 +21,9 @@ #include #endif -static struct list_head backlight_dev_list; -static struct mutex backlight_dev_list_mutex; -static struct blocking_notifier_head backlight_notifier; +static LIST_HEAD(backlight_dev_list); +static DEFINE_MUTEX(backlight_dev_list_mutex); +static BLOCKING_NOTIFIER_HEAD(backlight_notifier); static const char *const backlight_types[] = { [BACKLIGHT_RAW] = "raw", @@ -582,9 +582,6 @@ static int __init backlight_class_init(void) backlight_class->dev_groups = bl_device_groups; backlight_class->pm = &backlight_class_dev_pm_ops; - INIT_LIST_HEAD(&backlight_dev_list); - mutex_init(&backlight_dev_list_mutex); - BLOCKING_INIT_NOTIFIER_HEAD(&backlight_notifier); return 0; }