From patchwork Sat Jul 11 03:17:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vaishali Thakkar X-Patchwork-Id: 6769701 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id CB135C05AC for ; Sat, 11 Jul 2015 06:11:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5B2D92070A for ; Sat, 11 Jul 2015 06:11:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 84E74206B5 for ; Sat, 11 Jul 2015 06:11:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752655AbbGKGKB (ORCPT ); Sat, 11 Jul 2015 02:10:01 -0400 Received: from mail-pa0-f44.google.com ([209.85.220.44]:33840 "EHLO mail-pa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752632AbbGKGKA (ORCPT ); Sat, 11 Jul 2015 02:10:00 -0400 Received: by pabvl15 with SMTP id vl15so178460836pab.1; Fri, 10 Jul 2015 23:10:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=/RLuca47FrPYROLzJUGnZrVmFZ/stKDx9pCm3nDwq7w=; b=l/8aYM5m1JVL71pn3jnKdsE/zqHVRa+QDZL4V4szpQuwT9TXzgZ3a7/fmxue1B2xIg lMikilQbPIvCmDXto8kB5VsEDOSW6+0jIS2inq6OkHzXBNZdSCfeMjg0Re1BL+RhtqLP V2roLMPsvuCTsMzSFyd5fXxf12EWw/znmuW/sedqKnwiN1QHUBEz34QFcKwWfItD3gGn Qtb+3dPHFD/DEi2l/Mztxhza/f9MjAa+feLISygdiOqVoY0HNndUHa71xdobEAHbvDOc nGP/bJSulkz/9gl8MM4npMP60GIstB4yxWBmrKSabrADYSVOvz7fSEkjSLnTA3Rb+MxX MUzA== X-Received: by 10.68.69.6 with SMTP id a6mr48081908pbu.132.1436584664960; Fri, 10 Jul 2015 20:17:44 -0700 (PDT) Received: from vaishali-Ideapad-Z570 ([150.107.241.44]) by smtp.gmail.com with ESMTPSA id ho2sm10751335pbb.14.2015.07.10.20.17.42 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 10 Jul 2015 20:17:43 -0700 (PDT) Date: Sat, 11 Jul 2015 08:47:37 +0530 From: Vaishali Thakkar To: Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] [media] rc/keymaps: Add helper macro for rc_map_list boilerplate Message-ID: <20150711031737.GA12067@vaishali-Ideapad-Z570> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, 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 For simple modules that contain a single rc_map_list without any additional setup code then ends up being a block of duplicated boilerplate. This patch adds a new macro, module_rc_map_list(), which replaces the module_init()/module_exit() registrations with template functions. Signed-off-by: Vaishali Thakkar --- include/media/rc-map.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/media/rc-map.h b/include/media/rc-map.h index 27763d5..07e765d 100644 --- a/include/media/rc-map.h +++ b/include/media/rc-map.h @@ -96,6 +96,16 @@ struct rc_map_list { struct rc_map map; }; +/** + * module_rc_map_list() - Helper macro for registering a RC drivers + * @__rc_map_list: rc_map_list struct + * Helper macro for RC drivers which do not do anything special in module + * init/exit. This eliminates a lot of boilerplate. Each module may only + * use this macro once, and calling it replaces module_init() and module_exit() + */ +#define module_rc_map_list(__rc_map_list) \ + module_driver(__rc_map_list, rc_map_register, rc_map_unregister) + /* Routines from rc-map.c */ int rc_map_register(struct rc_map_list *map);