From patchwork Mon Sep 30 05:13:55 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 20698 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f198.google.com (mail-ve0-f198.google.com [209.85.128.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 96C7125B8B for ; Mon, 30 Sep 2013 05:24:24 +0000 (UTC) Received: by mail-ve0-f198.google.com with SMTP id c14sf4742426vea.9 for ; Sun, 29 Sep 2013 22:24:24 -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=OEHpMh7yb5YzkM9U+DsJ+uSyw0rIbn1xx8vf5lfhK/U=; b=HcKqy9zuNNk3DbL7tBpov5J+okeLMdxaEtV9bTq3l5JAz/yiyKzPLFJjzRh5DtLGsI EqkRdz/WiUqEasay0GCzONpq0+V3gsWPUHo02MU2FEw9kMSRTNznwOySMLYi9K89nErZ CDpOBIF92VgvKxWgzQDtda2izZBrd79+d3i5MV/3C9uKkmrsg5CDWG72OTY+w+9UImOJ 8KdnWcJBSO3PcNKgw9/6zP7X0T4GrdjMeJDh5fhIhJ5PqoeBVgf42JIC9o+ucqL3EKFA LpXKGgztIxdYbPUrZeU25xdKBcGjI3BB2HEoyyfOX4/yxzHWcHKxImTvENO1C2Dy3Wy0 bPXA== X-Received: by 10.224.51.68 with SMTP id c4mr9882131qag.7.1380518664427; Sun, 29 Sep 2013 22:24:24 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.128.229 with SMTP id nr5ls2046632qeb.94.gmail; Sun, 29 Sep 2013 22:24:24 -0700 (PDT) X-Received: by 10.58.73.202 with SMTP id n10mr20698197vev.7.1380518664322; Sun, 29 Sep 2013 22:24:24 -0700 (PDT) Received: from mail-ve0-f176.google.com (mail-ve0-f176.google.com [209.85.128.176]) by mx.google.com with ESMTPS id bb4si5346957vcb.75.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 29 Sep 2013 22:24:24 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.176 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.176; Received: by mail-ve0-f176.google.com with SMTP id jx11so3640205veb.35 for ; Sun, 29 Sep 2013 22:23:54 -0700 (PDT) X-Gm-Message-State: ALoCoQmzYT6k9zvV0AHmE1mDuYRiRoy7QxAglFV3vFZglKAedwTzGfuSRQTMkrm0UrCOa3NC+pDj X-Received: by 10.220.16.73 with SMTP id n9mr133659vca.24.1380518634244; Sun, 29 Sep 2013 22:23:54 -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 u4csp84883vcz; Sun, 29 Sep 2013 22:23:53 -0700 (PDT) X-Received: by 10.50.136.137 with SMTP id qa9mr12433869igb.42.1380518633315; Sun, 29 Sep 2013 22:23:53 -0700 (PDT) Received: from hanjun-Latitude-D630 ([218.17.215.175]) by mx.google.com with ESMTPS id k5si22612547icw.64.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 29 Sep 2013 22:23:53 -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 r8U5JukK005377; Mon, 30 Sep 2013 13:19:56 +0800 Received: (from hanjun@localhost) by hanjun-Latitude-D630 (8.14.4/8.14.4/Submit) id r8U5JtoA005376; Mon, 30 Sep 2013 13:19:55 +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 4/4] spi: introduce helper macro initcall_spi_driver() Date: Mon, 30 Sep 2013 13:13:55 +0800 Message-Id: <1380518035-5319-5-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.128.176 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_spi_driver() which based on initcall_driver() for spi driver to eliminate boilerplate code. Signed-off-by: Hanjun Guo --- include/linux/spi/spi.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 887116d..8bf8690 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -221,6 +221,17 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv) spi_unregister_driver) /** + * initcall_spi_driver() - Helper macro for registering a SPI driver + * for buid-in module with doing nothing special in driver + * xxx_initcall/module_exit. This eliminates a lot of boilerplate. + * @__type: initcall type + * @__spi_driver: spi_driver struct + */ +#define initcall_spi_driver(__type, __spi_driver) \ + initcall_driver(__type, __spi_driver, spi_register_driver, \ + spi_unregister_driver) + +/** * struct spi_master - interface to SPI master controller * @dev: device interface to this driver * @list: link with the global spi_master list