clk: new APIs to handle all available clocks
Subsystems (4)
v2 cover clk: new APIs to handle all available clocks
This patch series is a continue of discussion from here,
https://patchwork.kernel.org/patch/9986293/
that some users may want to handle all available clocks from device tree without need to know the detailed clock information likes clock numbers and names. This is useful in writing some generic drivers to handle clock part.
Note:
This patch series is tested on MX6Q SDB cpufreq driver with a minor change to switch to use clk_bulk_get_all.
But patch 4 only test compiling. Hopefully someone could help test the function.
v1->v2:
* add clk_bulk_{get|put}_all() which only supports DT platform currently
* remove _all variants and the wrapper struct clk_bulk
* make of_clk_bulk_get and of_clk_bulk_get_all private until someone proves they need it because they don't have a struct device pointer.
Dong Aisheng (4):
clk: bulk: add of_clk_bulk_get()
clk: add new APIs to operate on all available clocks
clk: add managed version of clk_bulk_get_all
video: simplefb: switch to use clk_bulk API to simplify clock
operations
drivers/clk/clk-bulk.c | 89 ++++++++++++++++++++++++++++++++++++++++++ drivers/clk/clk-devres.c | 24 ++++++++++++ drivers/video/fbdev/simplefb.c | 69 ++++++-------------------------- include/linux/clk.h | 65 +++++++++++++++++++++++++++++- 4 files changed, 190 insertions(+), 57 deletions(-)
Signature · 1 line
2.7.4
PATCH v2 1/4 clk: bulk: add of_clk_bulk_get()
'clock-names' property is optional in DT, so of_clk_bulk_get() is introduced here to handle this for DT users without 'clock-names' specified. Later clk_bulk_get_all() will be implemented on top of it and this API will be kept private until someone proves they need it because they don't have a struct device pointer.
--- drivers/clk/clk-bulk.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
drivers/clk/clk-bulk.c +32 -0
@@ -19,6 +19,38 @@#include <linux/clk.h> #include <linux/device.h> #include <linux/export.h> +#include <linux/of.h> + +#if defined(CONFIG_OF ) && defined(CONFIG_COMMON_CLK ) +static int __must_check of_clk_bulk_get (struct device_node *np,int num_clks, +struct clk_bulk_data *clks) +{ +int ret; +int i; + +for (i =0 ; i < num_clks; i++) + clks[i].clk =NULL ; + +for (i =0 ; i < num_clks; i++) { + clks[i].clk =of_clk_get (np, i); +if (IS_ERR (clks[i].clk)) { + ret =PTR_ERR (clks[i].clk); +pr_err ("%pOF: Failed to get clk index: %d ret: %d\n" , + np, i, ret); + clks[i].clk =NULL ; + goto err; + } + } + +return 0 ; + +err: +clk_bulk_put (i, clks); + +return ret; +} +EXPORT_SYMBOL (of_clk_bulk_get); +#endif void clk_bulk_put (int num_clks,struct clk_bulk_data *clks) {
Signature · 1 line
2.7.4
Stephen Boyd
maintainerRe: [PATCH V2 1/4] clk: bulk: add of_clk_bulk_get()
Quoting Dong Aisheng (2018-03-20 20:19:48)
drivers/clk/clk-bulk.c line 24
Quoted 11 lines
drivers/clk/clk-bulk.c +3
-0@@ -19,6 +19,38 @@#include <linux/clk.h> #include <linux/device.h> #include <linux/export.h> +#include <linux/of.h> + +#if defined(CONFIG_OF ) && defined(CONFIG_COMMON_CLK )
Do we need these defines? of_clk_get() is a stub function when these configs are false.
Quoted 18 lines
drivers/clk/clk-bulk.c +18
-0+static int __must_check of_clk_bulk_get (struct device_node *np,int num_clks, +struct clk_bulk_data *clks) +{ +int ret; +int i; + +for (i =0 ; i < num_clks; i++) + clks[i].clk =NULL ; + +for (i =0 ; i < num_clks; i++) { + clks[i].clk =of_clk_get (np, i); +if (IS_ERR (clks[i].clk)) { + ret =PTR_ERR (clks[i].clk); +pr_err ("%pOF: Failed to get clk index: %d ret: %d\n" , + np, i, ret); + clks[i].clk =NULL ; + goto err; + }
drivers/clk/clk-bulk.c line 52
Quoted 10 lines
drivers/clk/clk-bulk.c +10
-0+ } + +return 0 ; + +err: +clk_bulk_put (i, clks); + +return ret; +} +EXPORT_SYMBOL (of_clk_bulk_get);
It's static, so don't export it.
RE: [PATCH V2 1/4] clk: bulk: add of_clk_bulk_get()
Hi Stephen,
Quoted 13 lines
-----Original Message-----
From: Stephen Boyd [mailto:sboyd at kernel.org]
Sent: Saturday, March 24, 2018 12:53 AM
To: A.s. Dong <[email protected]>; linux-clk at vger.kernel.org
Cc: linux-kernel at vger.kernel.org; linux-arm-kernel at lists.infradead.org; mturquette at baylibre.com; hdegoede at redhat.com;
b.zolnierkie at samsung.com; linux at armlinux.org.uk; linux- fbdev at vger.kernel.org; dl-linux-imx <[email protected]>; A.s. Dong <[email protected]>; Stephen Boyd <[email protected]>; Russell King <[email protected]>
Subject: Re: [PATCH V2 1/4] clk: bulk: addof_clk_bulk_get()Quoting Dong Aisheng (2018-03-20 20:19:48)
Quoted 15 lines
drivers/clk/clk-bulk.c line 24
Quoted 11 lines
drivers/clk/clk-bulk.c index renamed from drivers/clk/clk-bulk.c +0
-04c10456..4b357b2 100644
drivers/clk/clk-bulk.c +3
-0@@ -19,6 +19,38 @@#include <linux/clk.h> #include <linux/device.h> #include <linux/export.h> +#include <linux/of.h> + +#if defined(CONFIG_OF ) && defined(CONFIG_COMMON_CLK )Do we need these defines?
of_clk_get()is a stub function when these configs are false.
You're right. Will drop it.
Quoted 22 lines
drivers/clk/clk-bulk.c line 25
Quoted 1 line
drivers/clk/clk-bulk.c +1
-0+static int __must_check of_clk_bulk_get(struct device_node *np, int
num_clks,Quoted 20 lines
drivers/clk/clk-bulk.c +20
-0+ struct clk_bulk_data *clks) { +int ret; +int i; + +for (i =0 ; i < num_clks; i++) + clks[i].clk =NULL ; + +for (i =0 ; i < num_clks; i++) { + clks[i].clk =of_clk_get (np, i); +if (IS_ERR (clks[i].clk)) { + ret =PTR_ERR (clks[i].clk); +pr_err ("%pOF: Failed to get clk index: %d ret: %d\n" , + np, i, ret); + clks[i].clk =NULL ; + goto err; + } + } + +return 0 ; +
Quoted 8 lines
drivers/clk/clk-bulk.c line 52
Quoted 6 lines
drivers/clk/clk-bulk.c +6
-0+err: +clk_bulk_put (i, clks); + +return ret; +} +EXPORT_SYMBOL (of_clk_bulk_get);It's static, so don't export it.
Got it.
Sorry for such mistake.
Will fix and sent V3.
Regards
Dong Aisheng
PATCH v2 2/4 clk: add new APIs to operate on all available clocks
In reply to Dong AishengThis patch introduces of_clk_bulk_get_all and clk_bulk_x_all APIs to users who just want to handle all available clocks from device tree without need to know the detailed clock information likes clock numbers and names. This is useful in writing some generic drivers to handle clock part.
---v1->v2:
* make of_clk_bulk_get_all private
* add clk_bulk_get/put_all
--- drivers/clk/clk-bulk.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++ include/linux/clk.h | 42 ++++++++++++++++++++++++++++++++++++- 2 files changed, 98 insertions(+), 1 deletion(-)
drivers/clk/clk-bulk.c +57 -0
@@ -17,9 +17,11 @@*/ #include <linux/clk.h> +#include <linux/clk-provider.h> #include <linux/device.h> #include <linux/export.h> #include <linux/of.h> +#include <linux/slab.h> #if defined(CONFIG_OF ) && defined(CONFIG_COMMON_CLK ) static int __must_check of_clk_bulk_get(struct device_node *np, int num_clks,
@@ -50,6 +52,38 @@ static int __must_check of_clk_bulk_get(struct device_node *np, int num_clks,return ret; }EXPORT_SYMBOL (of_clk_bulk_get); + +static int __must_check of_clk_bulk_get_all (struct device_node *np, +struct clk_bulk_data **clks) +{ +struct clk_bulk_data *clk_bulk; +int num_clks; +int ret; + + num_clks =of_clk_get_parent_count (np); +if (!num_clks) +return 0 ; + + clk_bulk =kcalloc (num_clks,sizeof (*clk_bulk),GFP_KERNEL ); +if (!clk_bulk) +return -ENOMEM ; + + ret =of_clk_bulk_get (np, num_clks, clk_bulk); +if (ret) { +kfree (clk_bulk); +return ret; + } + + *clks = clk_bulk; + +return num_clks; +} +#else +static int __must_check of_clk_bulk_get_all (struct device_node *np, +struct clk_bulk_data **clks) +{ +return -ENOENT ; +}#endif void clk_bulk_put (int num_clks,struct clk_bulk_data *clks)
@@ -90,6 +124,29 @@ int __must_check clk_bulk_get(struct device *dev, int num_clks, }EXPORT_SYMBOL (clk_bulk_get); +void clk_bulk_put_all (int num_clks,struct clk_bulk_data *clks) +{ +if (IS_ERR_OR_NULL (clks)) +return ; + +clk_bulk_put (num_clks, clks); + +kfree (clks); +} +EXPORT_SYMBOL (clk_bulk_put_all); + +int __must_check clk_bulk_get_all (struct device *dev, +struct clk_bulk_data **clks) +{ +struct device_node *np =dev_of_node (dev); + +if (!np) +return 0 ; + +return of_clk_bulk_get_all (np, clks); +} +EXPORT_SYMBOL (clk_bulk_get_all); +#ifdef CONFIG_HAVE_CLK_PREPARE /**
include/linux/clk.h +41 -1
66 lines not on this page · raw message
Signature · 1 line
2.7.4
Stephen Boyd
maintainerRe: [PATCH V2 2/4] clk: add new APIs to operate on all available clocks
Quoting Dong Aisheng (2018-03-20 20:19:49)
Quoted 7 lines
drivers/clk/clk-bulk.c +3
-0@@ -50,6 +52,38 @@ static int __must_check of_clk_bulk_get(struct device_node *np, int num_clks,return ret; }EXPORT_SYMBOL (of_clk_bulk_get); + +static int __must_check of_clk_bulk_get_all (struct device_node *np, +struct clk_bulk_data **clks)
drivers/clk/clk-bulk.c static int __must_check of_clk_bulk_get(struct device_node *np, int num_clks, · line 67
Quoted 10 lines
drivers/clk/clk-bulk.c +10
-0+{ +struct clk_bulk_data *clk_bulk; +int num_clks; +int ret; + + num_clks =of_clk_get_parent_count (np); +if (!num_clks) +return 0 ; + + clk_bulk =kcalloc (num_clks,sizeof (*clk_bulk),GFP_KERNEL );
Can be kmalloc_array? of_clk_bulk_get() already clears things out appropriately.
Quoted 10 lines
drivers/clk/clk-bulk.c +10
-0+if (!clk_bulk) +return -ENOMEM ; + + ret =of_clk_bulk_get (np, num_clks, clk_bulk); +if (ret) { +kfree (clk_bulk); +return ret; + } + + *clks = clk_bulk;
drivers/clk/clk-bulk.c static int __must_check of_clk_bulk_get(struct device_node *np, int num_clks, · line 87
Quoted 10 lines
drivers/clk/clk-bulk.c +9
-0+ + return num_clks; +} +#else +static int __must_check of_clk_bulk_get_all (struct device_node *np, +struct clk_bulk_data **clks) +{ +return -ENOENT ; +}#endif
This else can probably be dropped too.
Quoted 18 lines
drivers/clk/clk-bulk.c +12
-0void clk_bulk_put (int num_clks,struct clk_bulk_data *clks)@@ -90,6 +124,29 @@ int __must_check clk_bulk_get(struct device *dev, int num_clks, }EXPORT_SYMBOL (clk_bulk_get); +void clk_bulk_put_all (int num_clks,struct clk_bulk_data *clks) +{ +if (IS_ERR_OR_NULL (clks)) +return ; + +clk_bulk_put (num_clks, clks); + +kfree (clks); +} +EXPORT_SYMBOL (clk_bulk_put_all); + +int __must_check clk_bulk_get_all(struct device *dev,
drivers/clk/clk-bulk.c int __must_check clk_bulk_get(struct device *dev, int num_clks, · line 148
Quoted 10 lines
drivers/clk/clk-bulk.c +10
-0+ struct clk_bulk_data **clks) +{ +struct device_node *np =dev_of_node (dev); + +if (!np) +return 0 ; + +return of_clk_bulk_get_all (np, clks); +} +EXPORT_SYMBOL (clk_bulk_get_all);
Looks better!
RE: [PATCH V2 2/4] clk: add new APIs to operate on all available clocks
Quoted 27 lines
-----Original Message-----
From: Stephen Boyd [mailto:sboyd at kernel.org]
Sent: Saturday, March 24, 2018 12:57 AM
To: A.s. Dong <[email protected]>; linux-clk at vger.kernel.org
Cc: linux-kernel at vger.kernel.org; linux-arm-kernel at lists.infradead.org; mturquette at baylibre.com; hdegoede at redhat.com;
b.zolnierkie at samsung.com; linux at armlinux.org.uk; linux- fbdev at vger.kernel.org; dl-linux-imx <[email protected]>; A.s. Dong <[email protected]>; Stephen Boyd <[email protected]>; Masahiro Yamada <[email protected]>
Subject: Re: [PATCH V2 2/4] clk: add new APIs to operate on all available clocksQuoting Dong Aisheng (2018-03-20 20:19:49)
Review static int __must_check of_clk_bulk_get(struct
Quoted 1 line
(quoted diff) +0
-0@@ -50,6 +52,38 @@ static int __must_check of_clk_bulk_get(struct
device_node*np, intnum_clks,Quoted 11 lines
drivers/clk/clk-bulk.c +8
-0return ret; }EXPORT_SYMBOL (of_clk_bulk_get); + +static int __must_check of_clk_bulk_get_all (struct device_node *np, +struct clk_bulk_data +**clks) { +struct clk_bulk_data *clk_bulk; +int num_clks; +int ret; +
Quoted 8 lines
drivers/clk/clk-bulk.c static int __must_check of_clk_bulk_get(struct device_node *np, int num_clks, · line 67
Quoted 5 lines
drivers/clk/clk-bulk.c +5
-0+ num_clks =of_clk_get_parent_count (np); +if (!num_clks) +return 0 ; + + clk_bulk =kcalloc (num_clks,sizeof (*clk_bulk),GFP_KERNEL );Can be
kmalloc_array?of_clk_bulk_get()already clears things out appropriately.
Yes, indeed. Will use kmalloc_array instead.
Quoted 15 lines
Quoted 15 lines
drivers/clk/clk-bulk.c +14
-0+if (!clk_bulk) +return -ENOMEM ; + + ret =of_clk_bulk_get (np, num_clks, clk_bulk); +if (ret) { +kfree (clk_bulk); +return ret; + } + + *clks = clk_bulk; + + return num_clks; +} +#else
Quoted 9 lines
drivers/clk/clk-bulk.c static int __must_check of_clk_bulk_get(struct device_node *np, int num_clks, · line 87
Quoted 6 lines
drivers/clk/clk-bulk.c +5
-0+static int __must_check of_clk_bulk_get_all (struct device_node *np, +struct clk_bulk_data +**clks) { +return -ENOENT ; +}#endif This else can probably be dropped too.
Right.
Quoted 18 lines
Quoted 18 lines
(quoted diff) +1
-0void clk_bulk_put(int num_clks, struct clk_bulk_data *clks) @@ -90,6 +124,29 @@ int __must_check clk_bulk_get(struct device *dev, int
num_clks, }EXPORT_SYMBOL(clk_bulk_get);drivers/clk/clk-bulk.c +13
-0+void clk_bulk_put_all (int num_clks,struct clk_bulk_data *clks) { +if (IS_ERR_OR_NULL (clks)) +return ; + +clk_bulk_put (num_clks, clks); + +kfree (clks); +} +EXPORT_SYMBOL (clk_bulk_put_all); + +int __must_check clk_bulk_get_all (struct device *dev, +struct clk_bulk_data **clks) { +struct device_node *np =dev_of_node (dev);
Quoted 8 lines
drivers/clk/clk-bulk.c int __must_check clk_bulk_get(struct device *dev, int num_clks, · line 148
Quoted 6 lines
drivers/clk/clk-bulk.c +6
-0+ +if (!np) +return 0 ; + +return of_clk_bulk_get_all (np, clks); } +EXPORT_SYMBOL (clk_bulk_get_all);Looks better!
Thanks
Regards
Dong Aisheng
PATCH v2 3/4 clk: add managed version of clk_bulk_get_all
In reply to Dong AishengThis patch introduces the managed version of clk_bulk_get_all.
---v1->v2:
* new patch
--- drivers/clk/clk-devres.c | 24 ++++++++++++++++++++++++ include/linux/clk.h | 23 +++++++++++++++++++++++ 2 files changed, 47 insertions(+)
drivers/clk/clk-devres.c +24 -0
@@ -70,6 +70,30 @@ int __must_check devm_clk_bulk_get(struct device *dev, int num_clks, }EXPORT_SYMBOL_GPL (devm_clk_bulk_get); +int __must_check devm_clk_bulk_get_all (struct device *dev, +struct clk_bulk_data **clks) +{ +struct clk_bulk_devres *devres; +int ret; + + devres =devres_alloc (devm_clk_bulk_release, +sizeof (*devres),GFP_KERNEL ); +if (!devres) +return -ENOMEM ; + + ret =clk_bulk_get_all (dev, clks); +if (ret >0 ) { + devres->clks = *clks; + devres->num_clks = ret; +devres_add (dev, devres); + }else { +devres_free (devres); + } + +return ret; +} +EXPORT_SYMBOL_GPL (devm_clk_bulk_get_all); +static int devm_clk_match (struct device *dev,void *res,void *data) {struct clk **c = res;
include/linux/clk.h +23 -0
@@ -313,6 +313,22 @@ int __must_check clk_bulk_get_all(struct device *dev,*/ int __must_check devm_clk_bulk_get (struct device *dev,int num_clks,struct clk_bulk_data *clks); +/** +* devm_clk_bulk_get_all - managed get multiple clk consumers +* @dev: device for clock "consumer" +* @clks: pointer to the clk_bulk_data table of consumer +* +* Returns a positive value for the number of clocks obtained while the +* clock references are stored in the clk_bulk_data table in @clks field. +* Returns 0 if there're none and a negative value if something failed. +* +* This helper function allows drivers to get several clk +* consumers in one operation with management, the clks will +* automatically be freed when the device is unbound. +*/ + +int __must_check devm_clk_bulk_get_all (struct device *dev, +struct clk_bulk_data **clks);/** * devm_clk_get - lookup and obtain a managed reference to a clock producer.
@@ -658,6 +674,13 @@ static inline int __must_check devm_clk_bulk_get(struct device *dev, int num_clkreturn 0 ; } +static inline int __must_check devm_clk_bulk_get_all (struct device *dev, +struct clk_bulk_data **clks); +{ + +return 0 ; +} +static inline struct clk *devm_get_clk_from_child (struct device *dev,struct device_node *np,const char *con_id) {
Signature · 1 line
2.7.4
kbuild test robot
build botRe: [PATCH V2 3/4] clk: add managed version of clk_bulk_get_all
Thank you for the patch! Yet something to improve:
Hi Dong,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on clk/clk-next]
[also build test ERROR on v4.16-rc6 next-20180322]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Dong-Aisheng/clk-new-APIs-to-handle-all-available-clocks/20180323-122451 base: https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-next config: powerpc-defconfig (attached as .config) compiler: powerpc64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=powerpc
All errors (new ones prefixed by >>):
In file included from include/linux/cpufreq.h:14:0,
from arch/powerpc/platforms/cell/cpufreq_spudemand.c:23:
include/linux/clk.h:679:1: error: expected identifier or '(' before '{' token
{
^
>> include/linux/clk.h:677:32: error: 'devm_clk_bulk_get_all' declared 'static' but never defined [-Werror=unused-function] static inline int __must_check devm_clk_bulk_get_all(struct device *dev,
^~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
vim +677 include/linux/clk.h
676
> 677 static inline int __must_check devm_clk_bulk_get_all(struct device *dev,
678 struct clk_bulk_data **clks);
> 679 { 680
681 return 0;
682 }
683
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 24187 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180323/8215e30e/attachment-0001.gz>
RE: [PATCH V2 3/4] clk: add managed version of clk_bulk_get_all
Quoted 13 lines
-----Original Message-----
From: kbuild test robot [mailto:lkp at intel.com]
Sent: Friday, March 23, 2018 2:49 PM
To: A.s. Dong <[email protected]>
Cc: kbuild-all at 01.org; linux-clk at vger.kernel.org; linux- kernel at vger.kernel.org; linux-arm-kernel at lists.infradead.org; mturquette at baylibre.com; hdegoede at redhat.com; b.zolnierkie at samsung.com; linux at armlinux.org.uk; linux- fbdev at vger.kernel.org; dl-linux-imx <[email protected]>; sboyd at kernel.org; A.s. Dong <[email protected]>; Stephen Boyd <[email protected]>
Subject: Re: [PATCH V2 3/4] clk: add managed version ofclk_bulk_get_all
[...]
Quoted 13 lines
All errors (new ones prefixed by >>):
In file included from
include/linux/cpufreq.h:14:0,
fromarch/powerpc/platforms/cell/cpufreq_spudemand.c:23:include/linux/clk.h:679:1: error: expected identifier or '(' before '{' token { ^Quoted 2 lines
Quoted 2 lines
include/linux/clk.h:677:32: error: 'devm_clk_bulk_get_all' declared 'static' but never defined [-Werror=unused-function]static inline int
__must_checkdevm_clk_bulk_get_all(struct device *dev,
^~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
Quoted 7 lines
vim +677
include/linux/clk.h676Quoted 1 line
677 static inline int
__must_checkdevm_clk_bulk_get_all(struct device*dev,
678 structclk_bulk_data**clks);
Thanks for the reporting.
Caused by the extra unneeded ';' at the end of the line. Will fix.
Regards
Dong Aisheng
Quoted 14 lines
Quoted 1 line
679 {
680
681 return 0; 682 } 683---
0-DAY kernel test infrastructure Open Source Technology Center
https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist
s.01.org%2Fpipermail%2Fkbuild- all&data=02%7C01%7Caisheng.dong%40nxp.com%7Ce9e35f96c61a4c46d1790 8d5908a4d46%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C6365738 46071200287&sdata=yIWEjcpE2tyJP%2BmsMPqn%2F83TCsxw64J%2Ba5ue73
qGnN0%3D&reserved=0 Intel Corporation
PATCH v2 4/4 video: simplefb: switch to use clk_bulk API to simplify clock operations
In reply to Dong AishengSwitching to use clk_bulk API to simplify clock operations.
---v1->v2:
* switch to clk_bulk_get_all from of_clk_bulk_get_all
--- drivers/video/fbdev/simplefb.c | 69 ++++++++---------------------------------- 1 file changed, 13 insertions(+), 56 deletions(-)
drivers/video/fbdev/simplefb.c +13 -56
@@ -182,7 +182,7 @@ struct simplefb_par {#if definedCONFIG_OF && definedCONFIG_COMMON_CLK bool clks_enabled;unsigned int clk_count; -struct clk **clks; +struct clk_bulk_data *clks;#endif #if definedCONFIG_OF && definedCONFIG_REGULATOR bool regulators_enabled;
@@ -214,37 +214,13 @@ static int simplefb_clocks_get(struct simplefb_par *par, struct platform_device *pdev) {struct device_node *np = pdev->dev.of_node; -struct clk *clock; -int i;if (dev_get_platdata (&pdev->dev) || !np)return 0 ; - par->clk_count =of_clk_get_parent_count (np); -if (!par->clk_count) -return 0 ; - - par->clks =kcalloc (par->clk_count,sizeof (struct clk *),GFP_KERNEL ); -if (!par->clks) -return -ENOMEM ; - -for (i =0 ; i < par->clk_count; i++) { - clock =of_clk_get (np, i); -if (IS_ERR (clock)) { -if (PTR_ERR (clock) == -EPROBE_DEFER ) { -while (--i >=0 ) { -if (par->clks[i]) -clk_put (par->clks[i]); - } -kfree (par->clks); -return -EPROBE_DEFER ; - } -dev_err (&pdev->dev,"%s: clock %d not found: %ld\n" , - __func__, i,PTR_ERR (clock)); -continue ; - } - par->clks[i] = clock; - } + par->clk_count =clk_bulk_get_all (&pdev->dev, &par->clks); +if ((par->clk_count <0 ) && (par->clk_count == -EPROBE_DEFER )) +return -EPROBE_DEFER ;return 0 ; }
@@ -252,45 +228,26 @@ static int simplefb_clocks_get(struct simplefb_par *par,static void simplefb_clocks_enable (struct simplefb_par *par,struct platform_device *pdev) { -int i, ret; +int ret; + + ret =clk_bulk_prepare_enable (par->clk_count, par->clks); +if (ret) +dev_warn (&pdev->dev,"failed to enable clocks\n" ); -for (i =0 ; i < par->clk_count; i++) { -if (par->clks[i]) { - ret =clk_prepare_enable (par->clks[i]); -if (ret) { -dev_err (&pdev->dev, -"%s: failed to enable clock %d: %d\n" , - __func__, i, ret); -clk_put (par->clks[i]); - par->clks[i] =NULL ; - } - } - } par->clks_enabled = true; }static void simplefb_clocks_destroy (struct simplefb_par *par) { -int i; - -if (!par->clks) -return ; +if (par->clks_enabled) +clk_bulk_disable_unprepare (par->clk_count, par->clks); -for (i =0 ; i < par->clk_count; i++) { -if (par->clks[i]) { -if (par->clks_enabled) -clk_disable_unprepare (par->clks[i]); -clk_put (par->clks[i]); - } - } - -kfree (par->clks); +clk_bulk_put_all (par->clk_count, par->clks); }#else static int simplefb_clocks_get (struct simplefb_par *par,struct platform_device *pdev) {return 0 ; } -static void simplefb_clocks_enable (struct simplefb_par *par, -struct platform_device *pdev) { } +static int simplefb_clocks_enable (struct simplefb_par *par) { }static void simplefb_clocks_destroy (struct simplefb_par *par) { }#endif
Signature · 1 line
2.7.4
kbuild test robot
build botRe: [PATCH V2 4/4] video: simplefb: switch to use clk_bulk API to simplify clock operations
Thank you for the patch! Yet something to improve:
Hi Dong,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on clk/clk-next]
[also build test ERROR on v4.16-rc6 next-20180322]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Dong-Aisheng/clk-new-APIs-to-handle-all-available-clocks/20180323-122451 base: https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-next config: i386-randconfig-x007-201811 (attached as .config) compiler: gcc-7 (Debian 7.3.0-1) 7.3.0 reproduce: # save the attached .config to linux build tree make ARCH=i386
All error/warnings (new ones prefixed by >>):
drivers/video/fbdev/simplefb.c: In function 'simplefb_clocks_enable':
>> drivers/video/fbdev/simplefb.c:250:42: warning: no return statement in function returning non-void [-Wreturn-type]
static int simplefb_clocks_enable(struct simplefb_par *par) { }
^~~~~~~~~~~~
drivers/video/fbdev/simplefb.c: In function 'simplefb_probe':
>> drivers/video/fbdev/simplefb.c:442:2: error: too many arguments to function 'simplefb_clocks_enable'
simplefb_clocks_enable(par, pdev);
^~~~~~~~~~~~~~~~~~~~~~
drivers/video/fbdev/simplefb.c:250:12: note: declared here
static int simplefb_clocks_enable(struct simplefb_par *par) { }
^~~~~~~~~~~~~~~~~~~~~~vim +/simplefb_clocks_enable +442 drivers/video/fbdev/simplefb.c
fc219bfd drivers/video/fbdev/simplefb.c Luc Verhaegen 2014-11-14 239
fc219bfd drivers/video/fbdev/simplefb.c Luc Verhaegen 2014-11-14 240 static void simplefb_clocks_destroy(struct simplefb_par *par)
fc219bfd drivers/video/fbdev/simplefb.c Luc Verhaegen 2014-11-14 241 {
a3accfd7 drivers/video/fbdev/simplefb.c Hans de Goede 2017-01-11 242 if (par->clks_enabled)
1904158b drivers/video/fbdev/simplefb.c Dong Aisheng 2018-03-21 243 clk_bulk_disable_unprepare(par->clk_count, par->clks);
fc219bfd drivers/video/fbdev/simplefb.c Luc Verhaegen 2014-11-14 244
1904158b drivers/video/fbdev/simplefb.c Dong Aisheng 2018-03-21 245 clk_bulk_put_all(par->clk_count, par->clks);
fc219bfd drivers/video/fbdev/simplefb.c Luc Verhaegen 2014-11-14 246 }
fc219bfd drivers/video/fbdev/simplefb.c Luc Verhaegen 2014-11-14 247 #else
a3accfd7 drivers/video/fbdev/simplefb.c Hans de Goede 2017-01-11 248 static int simplefb_clocks_get(struct simplefb_par *par,
fc219bfd drivers/video/fbdev/simplefb.c Luc Verhaegen 2014-11-14 249 struct platform_device *pdev) { return 0; }
1904158b drivers/video/fbdev/simplefb.c Dong Aisheng 2018-03-21 @250 static int simplefb_clocks_enable(struct simplefb_par *par) { }
fc219bfd drivers/video/fbdev/simplefb.c Luc Verhaegen 2014-11-14 251 static void simplefb_clocks_destroy(struct simplefb_par *par) { }
fc219bfd drivers/video/fbdev/simplefb.c Luc Verhaegen 2014-11-14 252 #endif
fc219bfd drivers/video/fbdev/simplefb.c Luc Verhaegen 2014-11-14 253
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 254 #if defined CONFIG_OF && defined CONFIG_REGULATOR
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 255
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 256 #define SUPPLY_SUFFIX "-supply"
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 257
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 258 /*
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 259 * Regulator handling code.
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 260 *
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 261 * Here we handle the num-supplies and vin*-supply properties of our
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 262 * "simple-framebuffer" dt node. This is necessary so that we can make sure
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 263 * that any regulators needed by the display hardware that the bootloader
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 264 * set up for us (and for which it provided a simplefb dt node), stay up,
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 265 * for the life of the simplefb driver.
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 266 *
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 267 * When the driver unloads, we cleanly disable, and then release the
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 268 * regulators.
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 269 *
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 270 * We only complain about errors here, no action is taken as the most likely
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 271 * error can only happen due to a mismatch between the bootloader which set
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 272 * up simplefb, and the regulator definitions in the device tree. Chances are
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 273 * that there are no adverse effects, and if there are, a clean teardown of
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 274 * the fb probe will not help us much either. So just complain and carry on,
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 275 * and hope that the user actually gets a working fb at the end of things.
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 276 */
a3accfd7 drivers/video/fbdev/simplefb.c Hans de Goede 2017-01-11 277 static int simplefb_regulators_get(struct simplefb_par *par,
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 278 struct platform_device *pdev)
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 279 {
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 280 struct device_node *np = pdev->dev.of_node;
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 281 struct property *prop;
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 282 struct regulator *regulator;
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 283 const char *p;
a3accfd7 drivers/video/fbdev/simplefb.c Hans de Goede 2017-01-11 284 int count = 0, i = 0;
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 285
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 286 if (dev_get_platdata(&pdev->dev) || !np)
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 287 return 0;
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 288
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 289 /* Count the number of regulator supplies */
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 290 for_each_property_of_node(np, prop) {
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 291 p = strstr(prop->name, SUPPLY_SUFFIX);
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 292 if (p && p != prop->name)
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 293 count++;
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 294 }
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 295
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 296 if (!count)
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 297 return 0;
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 298
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 299 par->regulators = devm_kcalloc(&pdev->dev, count,
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 300 sizeof(struct regulator *), GFP_KERNEL);
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 301 if (!par->regulators)
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 302 return -ENOMEM;
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 303
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 304 /* Get all the regulators */
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 305 for_each_property_of_node(np, prop) {
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 306 char name[32]; /* 32 is max size of property name */
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 307
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 308 p = strstr(prop->name, SUPPLY_SUFFIX);
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 309 if (!p || p == prop->name)
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 310 continue;
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 311
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 312 strlcpy(name, prop->name,
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 313 strlen(prop->name) - strlen(SUPPLY_SUFFIX) + 1);
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 314 regulator = devm_regulator_get_optional(&pdev->dev, name);
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 315 if (IS_ERR(regulator)) {
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 316 if (PTR_ERR(regulator) == -EPROBE_DEFER)
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 317 return -EPROBE_DEFER;
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 318 dev_err(&pdev->dev, "regulator %s not found: %ld\n",
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 319 name, PTR_ERR(regulator));
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 320 continue;
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 321 }
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 322 par->regulators[i++] = regulator;
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 323 }
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 324 par->regulator_count = i;
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 325
a3accfd7 drivers/video/fbdev/simplefb.c Hans de Goede 2017-01-11 326 return 0;
a3accfd7 drivers/video/fbdev/simplefb.c Hans de Goede 2017-01-11 327 }
a3accfd7 drivers/video/fbdev/simplefb.c Hans de Goede 2017-01-11 328
a3accfd7 drivers/video/fbdev/simplefb.c Hans de Goede 2017-01-11 329 static void simplefb_regulators_enable(struct simplefb_par *par,
a3accfd7 drivers/video/fbdev/simplefb.c Hans de Goede 2017-01-11 330 struct platform_device *pdev)
a3accfd7 drivers/video/fbdev/simplefb.c Hans de Goede 2017-01-11 331 {
a3accfd7 drivers/video/fbdev/simplefb.c Hans de Goede 2017-01-11 332 int i, ret;
a3accfd7 drivers/video/fbdev/simplefb.c Hans de Goede 2017-01-11 333
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 334 /* Enable all the regulators */
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 335 for (i = 0; i < par->regulator_count; i++) {
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 336 ret = regulator_enable(par->regulators[i]);
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 337 if (ret) {
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 338 dev_err(&pdev->dev,
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 339 "failed to enable regulator %d: %d\n",
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 340 i, ret);
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 341 devm_regulator_put(par->regulators[i]);
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 342 par->regulators[i] = NULL;
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 343 }
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 344 }
a3accfd7 drivers/video/fbdev/simplefb.c Hans de Goede 2017-01-11 345 par->regulators_enabled = true;
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 346 }
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 347
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 348 static void simplefb_regulators_destroy(struct simplefb_par *par)
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 349 {
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 350 int i;
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 351
a3accfd7 drivers/video/fbdev/simplefb.c Hans de Goede 2017-01-11 352 if (!par->regulators || !par->regulators_enabled)
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 353 return;
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 354
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 355 for (i = 0; i < par->regulator_count; i++)
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 356 if (par->regulators[i])
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 357 regulator_disable(par->regulators[i]);
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 358 }
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 359 #else
a3accfd7 drivers/video/fbdev/simplefb.c Hans de Goede 2017-01-11 360 static int simplefb_regulators_get(struct simplefb_par *par,
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 361 struct platform_device *pdev) { return 0; }
a3accfd7 drivers/video/fbdev/simplefb.c Hans de Goede 2017-01-11 362 static void simplefb_regulators_enable(struct simplefb_par *par,
a3accfd7 drivers/video/fbdev/simplefb.c Hans de Goede 2017-01-11 363 struct platform_device *pdev) { }
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 364 static void simplefb_regulators_destroy(struct simplefb_par *par) { }
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 365 #endif
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 366
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 367 static int simplefb_probe(struct platform_device *pdev)
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 368 {
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 369 int ret;
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 370 struct simplefb_params params;
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 371 struct fb_info *info;
1270be4a drivers/video/fbdev/simplefb.c Luc Verhaegen 2014-11-14 372 struct simplefb_par *par;
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 373 struct resource *mem;
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 374
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 375 if (fb_get_options("simplefb", NULL))
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 376 return -ENODEV;
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 377
5ef76da6 drivers/video/simplefb.c David Herrmann 2013-08-02 378 ret = -ENODEV;
129f1be4 drivers/video/simplefb.c Jingoo Han 2013-09-17 379 if (dev_get_platdata(&pdev->dev))
5ef76da6 drivers/video/simplefb.c David Herrmann 2013-08-02 380 ret = simplefb_parse_pd(pdev, ¶ms);
5ef76da6 drivers/video/simplefb.c David Herrmann 2013-08-02 381 else if (pdev->dev.of_node)
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 382 ret = simplefb_parse_dt(pdev, ¶ms);
5ef76da6 drivers/video/simplefb.c David Herrmann 2013-08-02 383
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 384 if (ret)
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 385 return ret;
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 386
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 387 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 388 if (!mem) {
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 389 dev_err(&pdev->dev, "No memory resource\n");
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 390 return -EINVAL;
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 391 }
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 392
1270be4a drivers/video/fbdev/simplefb.c Luc Verhaegen 2014-11-14 393 info = framebuffer_alloc(sizeof(struct simplefb_par), &pdev->dev);
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 394 if (!info)
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 395 return -ENOMEM;
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 396 platform_set_drvdata(pdev, info);
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 397
1270be4a drivers/video/fbdev/simplefb.c Luc Verhaegen 2014-11-14 398 par = info->par;
1270be4a drivers/video/fbdev/simplefb.c Luc Verhaegen 2014-11-14 399
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 400 info->fix = simplefb_fix;
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 401 info->fix.smem_start = mem->start;
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 402 info->fix.smem_len = resource_size(mem);
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 403 info->fix.line_length = params.stride;
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 404
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 405 info->var = simplefb_var;
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 406 info->var.xres = params.width;
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 407 info->var.yres = params.height;
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 408 info->var.xres_virtual = params.width;
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 409 info->var.yres_virtual = params.height;
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 410 info->var.bits_per_pixel = params.format->bits_per_pixel;
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 411 info->var.red = params.format->red;
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 412 info->var.green = params.format->green;
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 413 info->var.blue = params.format->blue;
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 414 info->var.transp = params.format->transp;
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 415
df0960ab drivers/video/simplefb.c David Herrmann 2013-08-02 416 info->apertures = alloc_apertures(1);
df0960ab drivers/video/simplefb.c David Herrmann 2013-08-02 417 if (!info->apertures) {
bf2fda15 drivers/video/fbdev/simplefb.c Luc Verhaegen 2014-11-14 418 ret = -ENOMEM;
bf2fda15 drivers/video/fbdev/simplefb.c Luc Verhaegen 2014-11-14 419 goto error_fb_release;
df0960ab drivers/video/simplefb.c David Herrmann 2013-08-02 420 }
df0960ab drivers/video/simplefb.c David Herrmann 2013-08-02 421 info->apertures->ranges[0].base = info->fix.smem_start;
df0960ab drivers/video/simplefb.c David Herrmann 2013-08-02 422 info->apertures->ranges[0].size = info->fix.smem_len;
df0960ab drivers/video/simplefb.c David Herrmann 2013-08-02 423
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 424 info->fbops = &simplefb_ops;
df0960ab drivers/video/simplefb.c David Herrmann 2013-08-02 425 info->flags = FBINFO_DEFAULT | FBINFO_MISC_FIRMWARE;
9e210be6 drivers/video/simplefb.c David Herrmann 2013-10-02 426 info->screen_base = ioremap_wc(info->fix.smem_start,
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 427 info->fix.smem_len);
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 428 if (!info->screen_base) {
bf2fda15 drivers/video/fbdev/simplefb.c Luc Verhaegen 2014-11-14 429 ret = -ENOMEM;
bf2fda15 drivers/video/fbdev/simplefb.c Luc Verhaegen 2014-11-14 430 goto error_fb_release;
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 431 }
1270be4a drivers/video/fbdev/simplefb.c Luc Verhaegen 2014-11-14 432 info->pseudo_palette = par->palette;
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 433
a3accfd7 drivers/video/fbdev/simplefb.c Hans de Goede 2017-01-11 434 ret = simplefb_clocks_get(par, pdev);
fc219bfd drivers/video/fbdev/simplefb.c Luc Verhaegen 2014-11-14 435 if (ret < 0)
fc219bfd drivers/video/fbdev/simplefb.c Luc Verhaegen 2014-11-14 436 goto error_unmap;
fc219bfd drivers/video/fbdev/simplefb.c Luc Verhaegen 2014-11-14 437
a3accfd7 drivers/video/fbdev/simplefb.c Hans de Goede 2017-01-11 438 ret = simplefb_regulators_get(par, pdev);
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 439 if (ret < 0)
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 440 goto error_clocks;
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 441
a3accfd7 drivers/video/fbdev/simplefb.c Hans de Goede 2017-01-11 @442 simplefb_clocks_enable(par, pdev);
a3accfd7 drivers/video/fbdev/simplefb.c Hans de Goede 2017-01-11 443 simplefb_regulators_enable(par, pdev);
a3accfd7 drivers/video/fbdev/simplefb.c Hans de Goede 2017-01-11 444
9f192a92 drivers/video/simplefb.c Tom Gundersen 2013-09-07 445 dev_info(&pdev->dev, "framebuffer at 0x%lx, 0x%x bytes, mapped to 0x%p\n",
9f192a92 drivers/video/simplefb.c Tom Gundersen 2013-09-07 446 info->fix.smem_start, info->fix.smem_len,
9f192a92 drivers/video/simplefb.c Tom Gundersen 2013-09-07 447 info->screen_base);
9f192a92 drivers/video/simplefb.c Tom Gundersen 2013-09-07 448 dev_info(&pdev->dev, "format=%s, mode=%dx%dx%d, linelength=%d\n",
9f192a92 drivers/video/simplefb.c Tom Gundersen 2013-09-07 449 params.format->name,
9f192a92 drivers/video/simplefb.c Tom Gundersen 2013-09-07 450 info->var.xres, info->var.yres,
9f192a92 drivers/video/simplefb.c Tom Gundersen 2013-09-07 451 info->var.bits_per_pixel, info->fix.line_length);
9f192a92 drivers/video/simplefb.c Tom Gundersen 2013-09-07 452
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 453 ret = register_framebuffer(info);
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 454 if (ret < 0) {
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 455 dev_err(&pdev->dev, "Unable to register simplefb: %d\n", ret);
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 456 goto error_regulators;
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 457 }
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 458
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 459 dev_info(&pdev->dev, "fb%d: simplefb registered!\n", info->node);
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 460
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 461 return 0;
bf2fda15 drivers/video/fbdev/simplefb.c Luc Verhaegen 2014-11-14 462
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 463 error_regulators:
814740e7 drivers/video/fbdev/simplefb.c Chen-Yu Tsai 2015-11-17 464 simplefb_regulators_destroy(par);
fc219bfd drivers/video/fbdev/simplefb.c Luc Verhaegen 2014-11-14 465 error_clocks:
fc219bfd drivers/video/fbdev/simplefb.c Luc Verhaegen 2014-11-14 466 simplefb_clocks_destroy(par);
bf2fda15 drivers/video/fbdev/simplefb.c Luc Verhaegen 2014-11-14 467 error_unmap:
bf2fda15 drivers/video/fbdev/simplefb.c Luc Verhaegen 2014-11-14 468 iounmap(info->screen_base);
bf2fda15 drivers/video/fbdev/simplefb.c Luc Verhaegen 2014-11-14 469 error_fb_release:
bf2fda15 drivers/video/fbdev/simplefb.c Luc Verhaegen 2014-11-14 470 framebuffer_release(info);
bf2fda15 drivers/video/fbdev/simplefb.c Luc Verhaegen 2014-11-14 471 return ret;
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 472 }
26549c8d drivers/video/simplefb.c Stephen Warren 2013-05-24 473 :::::: The code at line 442 was first introduced by commit
:::::: a3accfd70e166af4956a686ffcdf414702c0a13e video: fbdev: simplefb: Separate clk / regulator get and enable steps
:::::: TO: Hans de Goede <[email protected]>
:::::: CC: Bartlomiej Zolnierkiewicz <[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 32787 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180323/d3494521/attachment-0001.gz>