From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757322AbcC2PO6 (ORCPT ); Tue, 29 Mar 2016 11:14:58 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:63374 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751842AbcC2PO5 (ORCPT ); Tue, 29 Mar 2016 11:14:57 -0400 From: Arnd Bergmann To: linaro-kernel@lists.linaro.org Cc: Viresh Kumar , Rafael Wysocki , arnd.bergmann@linaro.org, k.kozlowski@samsung.com, kgene.kim@samsung.com, heiko@sntech.de, xf@rock-chips.com, mmcclint@codeaurora.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH V1 Resend 2/3] cpufreq: dt: Add generic platform-device creation support Date: Tue, 29 Mar 2016 17:14:33 +0200 Message-ID: <5412084.gVvuDFzkvo@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: <2f2947872d41ecccc393d6ae95eafc72f205e03c.1459233524.git.viresh.kumar@linaro.org> References: <2f2947872d41ecccc393d6ae95eafc72f205e03c.1459233524.git.viresh.kumar@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:DAGZllPXdZyUPxUpZBAo7KRUtRvDLx7Sgabt3SLCGi1lv4+t7LR 5XrOj8kr1Am7PNxX0/T1IypMlnSRJXd8DnpFTsKLhDEo3s5FXDqT9NoXA31rgJj5rc9guF/ 2wSmHOLP0jbbiBfm/au30KeH0KQHQyX9qPyybQI4fPz/2PIeloTJJ7xYNPUG305LDGStWuY KTXTEthOxIVhtkA4B7BCw== X-UI-Out-Filterresults: notjunk:1;V01:K0:EEUIdot65xI=:hA/UuL+sYUp+3f7sd3j/t4 XGJ+twD7dBCzgFd3rgbMy6Em9PKOW5XFnFL7JqMj1ko6qqEcTv9SanqCOcHPAwTASkfRYtMHQ vE1+BmTFLjmeBvbwJE2Ad/LR+yI1J7OjTsuGvvI4hKopYbuMRYwDqv6qJD3GamXxbHPGqBM7U AQT4Rs0tRV6bG29iBBkg+OMTpPkNaC5lW0OACNCFXprj5418SAa8MTC5mY4emoefqyapRUQwY R9sPBXOPmayfEmaQlLjkRABnpkg32ZfNc/BcI3SsP79TSTleAXAOKn/PTwGID+rNik/xOqYXw kGvLkYH6czHTFwJBuKSIxAN7an1pmsuh+Xc38DBb8LSGq6vxb2FaevHX8rngf7dHml16rBGUS oF+qxvuZxkVoYX+CjJFghMqrGf+sxofyQ8H90l28M2ONVBJ8LPCm2m9JPX/yoBB35T1v5iBC7 mMNZGYbu1f3IhykVNVWmK70E/V5OLk5fR7N1/6nvhzU0vnBhGNa2yiwWyFqw8OkKx6mS3dmvv vOghQb/WBC7XYaHCFjCJ7WHYIn4wqMn1dea63GodWJ3i6YCW1ovEa6DNBseSaob9b5095QETh shmuUPVkWNX6a0X4NWfCwlL6csnltMuA7leaKmjw0H1A57qJF3QFk0OQzcyY8RYApj76SHY+E rCas67FMAHIQ0y1ROOOtqa81DInTBP+EhkZN8O6A5mIvCTdar6ZsQswoRg2QezxsmCcGUA4ih v5CFY4P3wLotEAKv Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday 29 March 2016 12:09:48 Viresh Kumar wrote: > Multiple platforms are using the generic cpufreq-dt driver now, and all > of them are required to create a platform device with name "cpufreq-dt", > in order to get the cpufreq-dt probed. > > Many of them do it from platform code, others have special drivers just > to do that. > > It would be more sensible to do this at a generic place, where all such > platform can mark their entries. > > This patch adds a separate file to get this device created. Currently > the compat list of platforms that we support is empty, and will be > filled in as and when we move platforms to use it. > > It always compiles as part of the kernel and so doesn't need a > module-exit operation. > > Signed-off-by: Viresh Kumar > Reviewed-by: Krzysztof Kozlowski > --- > drivers/cpufreq/Kconfig | 11 +++++++++ > drivers/cpufreq/Makefile | 1 + > drivers/cpufreq/cpufreq-dt-platdev.c | 48 ++++++++++++++++++++++++++++++++++++ > 3 files changed, 60 insertions(+) > create mode 100644 drivers/cpufreq/cpufreq-dt-platdev.c > > diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig > index a7f45853c103..08573d54105b 100644 > --- a/drivers/cpufreq/Kconfig > +++ b/drivers/cpufreq/Kconfig > @@ -191,6 +191,7 @@ config CPUFREQ_DT > depends on HAVE_CLK && OF > # if CPU_THERMAL is on and THERMAL=m, CPUFREQ_DT cannot be =y: > depends on !CPU_THERMAL || THERMAL > + select CPUFREQ_DT_PLATDEV > select PM_OPP > help > This adds a generic DT based cpufreq driver for frequency management. > @@ -199,6 +200,16 @@ config CPUFREQ_DT > > If in doubt, say N. > > +config CPUFREQ_DT_PLATDEV > + bool > + depends on CPUFREQ_DT The 'depends on' line is redundant as you always 'select' the code from CPUFREQ_DT. Since they are always set together, you can also just drop the new symbol, or put the new code into the same file. > +struct cpufreq_dt_compat { > + const char *compatible; > + const void *data; > + size_t size; > +}; > + > +static struct cpufreq_dt_compat compat[] = { > +}; The 'data' here is alway 'struct cpufreq_dt_platform_data' or NULL, and the size can be derived from that. If we add this into the opp platform interfaces, both can go away. > +static int __init cpufreq_dt_platdev_init(void) > +{ > + struct platform_device *pdev; > + int i; > + > + for (i = 0; i < ARRAY_SIZE(compat); i++) { > + if (!of_machine_is_compatible(compat[i].compatible)) > + continue; > + > + pdev = platform_device_register_data(NULL, "cpufreq-dt", -1, > + compat[i].data, > + compat[i].size); > + and then this can become if (of_device_match(of_root, compat)) platform_device_register_simple(NULL, "cpufreq-dt", 0, NULL, 0); Arnd