From patchwork Mon Sep 30 05:13:53 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 20695 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f72.google.com (mail-vb0-f72.google.com [209.85.212.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id DC3AA25B8B for ; Mon, 30 Sep 2013 05:22:02 +0000 (UTC) Received: by mail-vb0-f72.google.com with SMTP id f12sf4628852vbg.11 for ; Sun, 29 Sep 2013 22:22:02 -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=hCpbHOR1f+qGi1BYPwfqIyxmiDuSLRTJpAN5jo4NTTQ=; b=mYnt7CuOm9W5ootMIRHIJn5DyYqedbNuuB0u2xn7gikCEUJ8gXfbgQsewkANLQVC+C ZXXoU94DY3T9NT6Bbc76EVsfBkEjALN2mdumxBoXZZ7lGPDWKub916fkEmkrI0Rsw/cr vvuvgE69BJyfwXudRrzULo1bBuxEv3RftbXbtjfvnegbMeJDgOjKiUh+fk0FM+nBP036 5mwp+uf7dHAQgP/rGwWm8ofevX/3QLDiIgY0r5Xg+FA+ZQ96IOvOjQjnibfny/XTqxLd P0BFvV/NJH8+/ICCGIOZVbaiqRWgUHkmGP+OTh2lW31JgBVJmrwsZlP1UtWjgH0umRYc wUqA== X-Received: by 10.224.126.137 with SMTP id c9mr22285245qas.2.1380518522446; Sun, 29 Sep 2013 22:22:02 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.84.201 with SMTP id b9ls1932302qez.62.gmail; Sun, 29 Sep 2013 22:22:02 -0700 (PDT) X-Received: by 10.58.201.73 with SMTP id jy9mr5032424vec.20.1380518522352; Sun, 29 Sep 2013 22:22:02 -0700 (PDT) Received: from mail-ve0-f170.google.com (mail-ve0-f170.google.com [209.85.128.170]) by mx.google.com with ESMTPS id fx15si5340033vec.110.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 29 Sep 2013 22:22:02 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.170 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.170; Received: by mail-ve0-f170.google.com with SMTP id c14so3756726vea.29 for ; Sun, 29 Sep 2013 22:21:32 -0700 (PDT) X-Gm-Message-State: ALoCoQkTZTikyU7CH5ysTjq1qDQNHblFpg36YHRVKvv4Kkif2wml7uo4S3rKb7mqzieMJe35xZDc X-Received: by 10.220.16.73 with SMTP id n9mr124641vca.24.1380518492260; Sun, 29 Sep 2013 22:21:32 -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 u4csp84803vcz; Sun, 29 Sep 2013 22:21:31 -0700 (PDT) X-Received: by 10.236.142.210 with SMTP id i58mr22360135yhj.33.1380518491751; Sun, 29 Sep 2013 22:21:31 -0700 (PDT) Received: from hanjun-Latitude-D630 ([218.17.215.175]) by mx.google.com with ESMTPS id c44si7733182yhc.222.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 29 Sep 2013 22:21:31 -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 r8U5Hl8d005368; Mon, 30 Sep 2013 13:17:47 +0800 Received: (from hanjun@localhost) by hanjun-Latitude-D630 (8.14.4/8.14.4/Submit) id r8U5Hkmd005363; Mon, 30 Sep 2013 13:17:46 +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 2/4] platform device: introduce helper macro initcall_platform_driver() Date: Mon, 30 Sep 2013 13:13:53 +0800 Message-Id: <1380518035-5319-3-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.170 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_platform_driver() which based on initcall_driver() for platform driver to eliminate boilerplate code. Signed-off-by: Hanjun Guo --- include/linux/platform_device.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h index ce8e4ff..0f37f9d 100644 --- a/include/linux/platform_device.h +++ b/include/linux/platform_device.h @@ -218,6 +218,17 @@ static inline void platform_set_drvdata(struct platform_device *pdev, module_driver(__platform_driver, platform_driver_register, \ platform_driver_unregister) +/* initcall_platform_driver() - Helper macro for drivers that don't do + * anything special in build-in module xxx_initcall/exit. This eliminates + * a lot of boilerplate. Each driver may only use this macro once, and + * calling it replaces xxx_initcall() and module_exit() + * @__type: initcall type + * @__platform_driver: platform driver struct + */ +#define initcall_platform_driver(__type, __platform_driver) \ + initcall_driver(__type, __platform_driver, platform_driver_register, \ + latform_driver_unregister) + /* module_platform_driver_probe() - Helper macro for drivers that don't do * anything special in module init/exit. This eliminates a lot of * boilerplate. Each module may only use this macro once, and