From patchwork Mon Sep 30 05:13:54 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 20697 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f70.google.com (mail-vb0-f70.google.com [209.85.212.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2AD5E25B8B for ; Mon, 30 Sep 2013 05:22:56 +0000 (UTC) Received: by mail-vb0-f70.google.com with SMTP id h10sf4625415vbh.9 for ; Sun, 29 Sep 2013 22:22:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:x-gm-message-state:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=f4tiMPbHz7svvrA39LAJODvtjy/AkfklGpzvh/Cn6U4=; b=IXH7JfLpeYuEHM3r+fRhWOlCag7yI6p0rQJIRrVGinD39+FZA7wMR7XbRAQz50D6Ov iNSJOfcvkNFbZJk1ktvOQ16UNeYZ2N7L7lU2Bco0ME1palIFnYggmSRmqYJHZQKV/hRr omU1azOrH5qLLgtlNxdu1YWBvcH8FpJeswLO1a38rR519Brj4FofqP5I9s9woUhOxj6w 3mVeHH5IKOZxCTAzgbMRfkMzExv/EvM9U3TTA4ifsqrQMkDP+p6mrsGs8un6kbZetz5c 2R09EZoC5BLpDzAXtmP2SSaVpx1ogRLX4akHm8BdwLUKdc9SejYXmsd8rWCi0uePg2re Zo8A== X-Received: by 10.236.18.196 with SMTP id l44mr3320072yhl.52.1380518575808; Sun, 29 Sep 2013 22:22:55 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.64.38 with SMTP id l6ls2018636qes.89.gmail; Sun, 29 Sep 2013 22:22:55 -0700 (PDT) X-Received: by 10.52.243.138 with SMTP id wy10mr340949vdc.2.1380518575718; Sun, 29 Sep 2013 22:22:55 -0700 (PDT) Received: from mail-vb0-f53.google.com (mail-vb0-f53.google.com [209.85.212.53]) by mx.google.com with ESMTPS id b5si5336823vel.138.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 29 Sep 2013 22:22:55 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.53 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.53; Received: by mail-vb0-f53.google.com with SMTP id i3so3357209vbh.26 for ; Sun, 29 Sep 2013 22:22:25 -0700 (PDT) X-Gm-Message-State: ALoCoQm4gHecqEEEFapZ+d8L6SdblbMpLpDC2+ocHLDYMXZ2T8OH2qCzN0DkljrCQe/qUc+HmHX2 X-Received: by 10.58.218.225 with SMTP id pj1mr85879vec.24.1380518545639; Sun, 29 Sep 2013 22:22:25 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp84836vcz; Sun, 29 Sep 2013 22:22:25 -0700 (PDT) X-Received: by 10.236.4.72 with SMTP id 48mr22330702yhi.43.1380518545189; Sun, 29 Sep 2013 22:22:25 -0700 (PDT) Received: from hanjun-Latitude-D630 ([218.17.215.175]) by mx.google.com with ESMTPS id s50si7741523yhm.132.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 29 Sep 2013 22:22:25 -0700 (PDT) Received-SPF: neutral (google.com: 218.17.215.175 is neither permitted nor denied by best guess record for domain of hanjun@hanjun-latitude-d630) client-ip=218.17.215.175; Received: from hanjun-Latitude-D630 (localhost [127.0.0.1]) by hanjun-Latitude-D630 (8.14.4/8.14.4/Debian-2ubuntu2) with ESMTP id r8U5IpEi005373; Mon, 30 Sep 2013 13:18:51 +0800 Received: (from hanjun@localhost) by hanjun-Latitude-D630 (8.14.4/8.14.4/Submit) id r8U5IooP005371; Mon, 30 Sep 2013 13:18:50 +0800 From: Hanjun Guo To: Greg Kroah-Hartman , Wolfram Sang , Mark Brown Cc: "Rafael J. Wysocki" , Fabio Porcedda , Grant Likely , Linus Walleij , Libo Chen , linux-i2c@vger.kernel.org, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, patches@linaro.org, linaro-kernel@lists.linaro.org, linaro-acpi@lists.linaro.org, Hanjun Guo Subject: [PATCH 3/4] i2c: introduce helper macro initcall_i2c_driver() Date: Mon, 30 Sep 2013 13:13:54 +0800 Message-Id: <1380518035-5319-4-git-send-email-hanjun.guo@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1380518035-5319-1-git-send-email-hanjun.guo@linaro.org> References: <1380518035-5319-1-git-send-email-hanjun.guo@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: hanjun.guo@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.53 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Introduce a helper macro initcall_i2c_driver() which based on initcall_driver() for i2c driver to eliminate boilerplate code. Signed-off-by: Hanjun Guo --- include/linux/i2c.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 2ab11dc..1b87e64 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -542,6 +542,17 @@ static inline int i2c_adapter_id(struct i2c_adapter *adap) module_driver(__i2c_driver, i2c_add_driver, \ i2c_del_driver) +/** + * initcall_i2c_driver() - Helper macro for registering a I2C driver + * for buid-in module with doing nothing special in driver + * xxx_initcall/module_exit. This eliminates a lot of boilerplate. + * @__type: initcall type + * @__i2c_driver: i2c_driver struct + */ +#define initcall_i2c_driver(__type, __i2c_driver) \ + initcall_driver(__type, __i2c_driver, i2c_add_driver, \ + i2c_del_driver) + #endif /* I2C */ #if IS_ENABLED(CONFIG_OF)