Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp1064341ybd; Wed, 26 Jun 2019 10:33:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqwh0yqo0NUGT2WKqFVxBqnKil7iQzm4syAW8LhxVEouOrzZvBNNfVt+zU/p327UhY4AKkfn X-Received: by 2002:a17:90a:ac11:: with SMTP id o17mr247215pjq.134.1561570409573; Wed, 26 Jun 2019 10:33:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561570409; cv=none; d=google.com; s=arc-20160816; b=dG0kOcwlRpqqRCZvsLcHGNamwW77w67PHCR3wgITulkBZjsfGMBmtnLAP4rF9w9DUH MrcWyXrsXrsDmHdsYjCI/JO+0qBwulWy/Nh6b7JrV/1iRuXZviKmWbhQPsUcsXOhA5ar FVaMGcfe2+GfvY/x+LJwcUFsehOuPy+2JQovo3Ttl/XUfJtRDt9WSeQe/Dcyw4NvP9AS AvgFDz1qggjV5ygFNlGykw2Ql25GuTHtsEv8l/kxvjAGvh9YprjT+GlRe8CZShAbMOvi 31nSWGX2DJS/kO1Qvqzo8AsMIIkmUjfJZ5QeMdAIyP74eUoH+2oxZ1Atpvule+HzPbLS UfFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject; bh=KWkapAzuTX+gOelx/jwdzBi48jWLf3yt8zLgUN7PVi8=; b=I/g66g2wgnNdxjToN8neN+og7dPS1iy6IaqM1NuAcymdQpu4Bt7e22WtTP+T14oW0v 9Z0+/N37DEbOuURrTY3mGwdemD+I6HKoDJkVvCKbootLakh6wOO4iRfdjf2vT1JULWMN 9w9zFsvqFFaEAcHRDYyT6Va+EHkxH24kkuX0wp/23qHwksbvTSmjrHeqYpEP19jpWJ1A /O29fVjakFoVBQEShFPGkUfkKDg9LZv18ZovKZqqYW5ajt1ut99NYqBIs2lczIvESyDT DVo3Iqtp2hEYovRfCO+DjSCNihheDRkXiqi5Dc9+Fr4NTbjw25hthZCFo65yzSHmoNpT OYHA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i9si17782750pfr.6.2019.06.26.10.33.13; Wed, 26 Jun 2019 10:33:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726447AbfFZRdC (ORCPT + 99 others); Wed, 26 Jun 2019 13:33:02 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:41971 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726042AbfFZRdB (ORCPT ); Wed, 26 Jun 2019 13:33:01 -0400 Received: from [192.168.1.110] ([77.4.50.183]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.183]) with ESMTPSA (Nemesis) id 1M6UVr-1hdirL1gd7-006uGv; Wed, 26 Jun 2019 19:27:06 +0200 Subject: Re: [PATCH 01/30] include: linux: platform_device: more helpers for declaring platform drivers To: =?UTF-8?Q?Uwe_Kleine-K=c3=b6nig?= , "Enrico Weigelt, metux IT consult" Cc: linux-kernel@vger.kernel.org, grygorii.strashko@ti.com, mcoquelin.stm32@gmail.com, thloh@altera.com, festevam@gmail.com, linus.walleij@linaro.org, khilman@kernel.org, patches@opensource.cirrus.com, bgolaszewski@baylibre.com, linux-omap@vger.kernel.org, linux-gpio@vger.kernel.org, linux-imx@nxp.com, kernel@pengutronix.de, ssantosh@kernel.org, linux-tegra@vger.kernel.org, andriy.shevchenko@linux.intel.com, shawnguo@kernel.org, s.hauer@pengutronix.de, alexandre.torgue@st.com References: <1560796871-18560-1-git-send-email-info@metux.net> <20190626061405.qsqq5na4oactuo6f@pengutronix.de> From: "Enrico Weigelt, metux IT consult" Organization: metux IT consult Message-ID: <30f541a7-ef9d-d687-ab76-22a4544258f8@metux.net> Date: Wed, 26 Jun 2019 19:27:02 +0200 User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20190626061405.qsqq5na4oactuo6f@pengutronix.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K1:4cVH4PkCtQv/LUwiS6UCMsXOnJKPoFgtu8YIQh2qre1SlC0rID3 iH0aKQ/MKkZJ2yEuVJpv7mEkC1UjMv1ovjIFymwEqaJMY5AQyXvkOzmTCMq13end5r0f9xS yMx11gxpvqiWbWj5JDclzAGEDJ/U+TuS0GJfpPcHqTpNdKo6+6kBrvObB6Qy47Oj5TZ6PPN S2g10gMfdY9wpMg6E4Uzg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:p7DzD82Py24=:LTBxbNA+enqTVtVo1asr5u fojJY6VPTEzYaSJmnoo2Q08KvoDIOijxX27ZhdAkutA8pG3r2+igrKbf0Fr1hVHFN+0+Zm563 xU3yBgs2kIQumCzDZakchFcCbHnWcLq1dDjHduz9l5x8WbJ/QjWvztmVLtLec6s3T/7wn9f4b hB94PAd14mx2OzyVmlsrfgS6p7iw5JWUcjH465pyFgPXWaa9f8VjH6xW5ux2bE6+rIMbpk5Ty junIYo1id38mTc1V85zeagLxg1x2WbqCQ08z0saH2UrLQj0TODg2fH+jgg1nULwKYD1b7QksU 5zYpMwlRIfQk33Hio6mvEahIFHMzJ4ehYRrJnkkp5az6d1WwBProOdeVWTK2qVW4zI/UFgwV6 NAeOZfNFAsRJkPSNeywmV1Ms6jLg5J6SLBAW/b8VSQxanNDKjFtGLiUsQPGGrygYRASQ/lYRp +u8tbOCLBQKNl9ZVrApeSLLH0ksCfzNH+cZ8GNJCnSQitkHKMCw3t+mOxAGy0aif6rXMPdz9Q m6ftp/V4ktJEzSCtvq1zGgc6rxZALGDd1jSCx8umIEuSe4utCYnm2NJIpJ58Mh496OnAihtyD CHxFOC3zGdx+8PQVDH4pHkwEXG6nvHZfDaSNdRY6hV/UUbFvjekhcfWq+1Ms87SGmTwRNl2hy ec01eIhUZI7jd9eRtU9P3gL6qFG8ol+BFr7lrNRSyVSKVmlZmvsK8AlDOczVKKRXRAsYW9qoc AjvunGTjxWWoot/j7F503lFwZ0SKs+7YtXKRyB+QgYf4oTlYrIKhATZrRkE= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 26.06.19 08:14, Uwe Kleine-König wrote: Hi, > Would it make sense to do something like: > > #define __module_platform_driver(__platform_driver, __initlvl) \ > static int __init __platform_driver##_init(void) \ > { \ > return platform_driver_register(&(__platform_driver)); \ > } \ > __initlvl ## _initcall(__platform_driver##_init); \ > static void __exit __platform_driver##_exit(void) \ > { \ > platform_driver_unregister(&(__platform_driver)); \ > } \ > module_exit(__platform_driver##_exit); > > #define postcore_platform_driver(__platform_driver) __module_platform_driver(__platform_driver, postcore) > #define subsys_platform_driver(__platform_driver) __module_platform_driver(__platform_driver, subsys) > ... > > Which would be more compact and makes the difference between these > macros a bit more obvious. yeah, could do that, but not sure whether it's really good for readability when we have so many nested macros :p OTOH, I didn't want to touch the existing macros for now, just trim down the actual init boilerplate, postponing further compactions for later. --mtx -- Enrico Weigelt, metux IT consult Free software and Linux embedded engineering info@metux.net -- +49-151-27565287