Re: [PATCH 3/4] mfd: arizona: Switch to using clock driver for 32k clock
From: kbuild test robot
Date: Tue Jan 05 2016 - 11:24:44 EST
Hi Charles,
[auto build test ERROR on clk/clk-next]
[also build test ERROR on v4.4-rc8 next-20160105]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]
url: https://github.com/0day-ci/linux/commits/Charles-Keepax/extcon-arizona-Remove-enable-disable-of-32k-clock/20160105-234658
base: https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-next
config: i386-randconfig-s1-201601 (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All error/warnings (new ones prefixed by >>):
>> drivers/clk/clk-arizona.c:31:16: error: field 'clk32k_hw' has incomplete type
struct clk_hw clk32k_hw;
^
In file included from include/asm-generic/bug.h:13:0,
from arch/x86/include/asm/bug.h:35,
from include/linux/bug.h:4,
from include/linux/mmdebug.h:4,
from include/linux/gfp.h:4,
from include/linux/slab.h:14,
from include/asm-generic/clkdev.h:16,
from arch/x86/include/generated/asm/clkdev.h:1,
from include/linux/clkdev.h:15,
from drivers/clk/clk-arizona.c:14:
drivers/clk/clk-arizona.c: In function 'clk32k_to_arizona_clk':
include/linux/kernel.h:813:48: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
^
>> drivers/clk/clk-arizona.c:37:9: note: in expansion of macro 'container_of'
return container_of(hw, struct arizona_clk, clk32k_hw);
^
drivers/clk/clk-arizona.c: At top level:
>> drivers/clk/clk-arizona.c:77:21: error: variable 'arizona_32k_ops' has initializer but incomplete type
static const struct clk_ops arizona_32k_ops = {
^
>> drivers/clk/clk-arizona.c:78:2: error: unknown field 'prepare' specified in initializer
.prepare = arizona_32k_enable,
^
>> drivers/clk/clk-arizona.c:78:13: warning: excess elements in struct initializer
.prepare = arizona_32k_enable,
^
drivers/clk/clk-arizona.c:78:13: note: (near initialization for 'arizona_32k_ops')
>> drivers/clk/clk-arizona.c:79:2: error: unknown field 'unprepare' specified in initializer
.unprepare = arizona_32k_disable,
^
drivers/clk/clk-arizona.c:79:15: warning: excess elements in struct initializer
.unprepare = arizona_32k_disable,
^
drivers/clk/clk-arizona.c:79:15: note: (near initialization for 'arizona_32k_ops')
drivers/clk/clk-arizona.c: In function 'arizona_clk_of_get_pdata':
>> drivers/clk/clk-arizona.c:98:35: error: implicit declaration of function '__clk_get_name' [-Werror=implicit-function-declaration]
arizona->pdata.clk32k_parent = __clk_get_name(mclk);
^
>> drivers/clk/clk-arizona.c:98:33: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
arizona->pdata.clk32k_parent = __clk_get_name(mclk);
^
drivers/clk/clk-arizona.c: In function 'arizona_clk_probe':
>> drivers/clk/clk-arizona.c:113:9: error: variable 'clk32k_init' has initializer but incomplete type
struct clk_init_data clk32k_init = {
^
>> drivers/clk/clk-arizona.c:114:3: error: unknown field 'name' specified in initializer
.name = "arizona-32k",
^
drivers/clk/clk-arizona.c:114:11: warning: excess elements in struct initializer
.name = "arizona-32k",
^
drivers/clk/clk-arizona.c:114:11: note: (near initialization for 'clk32k_init')
>> drivers/clk/clk-arizona.c:115:3: error: unknown field 'ops' specified in initializer
.ops = &arizona_32k_ops,
^
drivers/clk/clk-arizona.c:115:10: warning: excess elements in struct initializer
.ops = &arizona_32k_ops,
^
drivers/clk/clk-arizona.c:115:10: note: (near initialization for 'clk32k_init')
>> drivers/clk/clk-arizona.c:113:23: error: storage size of 'clk32k_init' isn't known
struct clk_init_data clk32k_init = {
^
>> drivers/clk/clk-arizona.c:154:24: error: 'CLK_IS_ROOT' undeclared (first use in this function)
clk32k_init.flags |= CLK_IS_ROOT;
^
drivers/clk/clk-arizona.c:154:24: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/clk/clk-arizona.c:158:20: error: implicit declaration of function 'devm_clk_register' [-Werror=implicit-function-declaration]
clkdata->clk32k = devm_clk_register(&pdev->dev, &clkdata->clk32k_hw);
^
>> drivers/clk/clk-arizona.c:113:23: warning: unused variable 'clk32k_init' [-Wunused-variable]
struct clk_init_data clk32k_init = {
^
cc1: some warnings being treated as errors
vim +/clk32k_hw +31 drivers/clk/clk-arizona.c
bbd51c97 Charles Keepax 2016-01-05 8 * This program is free software; you can redistribute it and/or modify it
bbd51c97 Charles Keepax 2016-01-05 9 * under the terms of the GNU General Public License as published by the
bbd51c97 Charles Keepax 2016-01-05 10 * Free Software Foundation; either version 2 of the License, or (at your
bbd51c97 Charles Keepax 2016-01-05 11 * option) any later version.
bbd51c97 Charles Keepax 2016-01-05 12 */
bbd51c97 Charles Keepax 2016-01-05 13
bbd51c97 Charles Keepax 2016-01-05 @14 #include <linux/clkdev.h>
bbd51c97 Charles Keepax 2016-01-05 15 #include <linux/clk-provider.h>
bbd51c97 Charles Keepax 2016-01-05 16 #include <linux/delay.h>
bbd51c97 Charles Keepax 2016-01-05 17 #include <linux/module.h>
bbd51c97 Charles Keepax 2016-01-05 18 #include <linux/slab.h>
bbd51c97 Charles Keepax 2016-01-05 19 #include <linux/platform_device.h>
bbd51c97 Charles Keepax 2016-01-05 20 #include <linux/pm_runtime.h>
bbd51c97 Charles Keepax 2016-01-05 21
bbd51c97 Charles Keepax 2016-01-05 22 #include <linux/mfd/arizona/core.h>
bbd51c97 Charles Keepax 2016-01-05 23 #include <linux/mfd/arizona/pdata.h>
bbd51c97 Charles Keepax 2016-01-05 24 #include <linux/mfd/arizona/registers.h>
bbd51c97 Charles Keepax 2016-01-05 25
bbd51c97 Charles Keepax 2016-01-05 26 #define CLK32K_RATE 32768
bbd51c97 Charles Keepax 2016-01-05 27
bbd51c97 Charles Keepax 2016-01-05 28 struct arizona_clk {
bbd51c97 Charles Keepax 2016-01-05 29 struct arizona *arizona;
bbd51c97 Charles Keepax 2016-01-05 30
bbd51c97 Charles Keepax 2016-01-05 @31 struct clk_hw clk32k_hw;
bbd51c97 Charles Keepax 2016-01-05 32 struct clk *clk32k;
bbd51c97 Charles Keepax 2016-01-05 33 };
bbd51c97 Charles Keepax 2016-01-05 34
bbd51c97 Charles Keepax 2016-01-05 35 static inline struct arizona_clk *clk32k_to_arizona_clk(struct clk_hw *hw)
bbd51c97 Charles Keepax 2016-01-05 36 {
bbd51c97 Charles Keepax 2016-01-05 @37 return container_of(hw, struct arizona_clk, clk32k_hw);
bbd51c97 Charles Keepax 2016-01-05 38 }
bbd51c97 Charles Keepax 2016-01-05 39
bbd51c97 Charles Keepax 2016-01-05 40 static int arizona_32k_enable(struct clk_hw *hw)
bbd51c97 Charles Keepax 2016-01-05 41 {
bbd51c97 Charles Keepax 2016-01-05 42 struct arizona_clk *clkdata = clk32k_to_arizona_clk(hw);
bbd51c97 Charles Keepax 2016-01-05 43 struct arizona *arizona = clkdata->arizona;
bbd51c97 Charles Keepax 2016-01-05 44 int ret;
bbd51c97 Charles Keepax 2016-01-05 45
bbd51c97 Charles Keepax 2016-01-05 46 switch (arizona->pdata.clk32k_src) {
bbd51c97 Charles Keepax 2016-01-05 47 case ARIZONA_32KZ_MCLK1:
bbd51c97 Charles Keepax 2016-01-05 48 ret = pm_runtime_get_sync(arizona->dev);
bbd51c97 Charles Keepax 2016-01-05 49 if (ret != 0)
bbd51c97 Charles Keepax 2016-01-05 50 goto out;
bbd51c97 Charles Keepax 2016-01-05 51 break;
bbd51c97 Charles Keepax 2016-01-05 52 }
bbd51c97 Charles Keepax 2016-01-05 53
bbd51c97 Charles Keepax 2016-01-05 54 ret = regmap_update_bits_async(arizona->regmap, ARIZONA_CLOCK_32K_1,
bbd51c97 Charles Keepax 2016-01-05 55 ARIZONA_CLK_32K_ENA,
bbd51c97 Charles Keepax 2016-01-05 56 ARIZONA_CLK_32K_ENA);
bbd51c97 Charles Keepax 2016-01-05 57
bbd51c97 Charles Keepax 2016-01-05 58 out:
bbd51c97 Charles Keepax 2016-01-05 59 return ret;
bbd51c97 Charles Keepax 2016-01-05 60 }
bbd51c97 Charles Keepax 2016-01-05 61
bbd51c97 Charles Keepax 2016-01-05 62 static void arizona_32k_disable(struct clk_hw *hw)
bbd51c97 Charles Keepax 2016-01-05 63 {
bbd51c97 Charles Keepax 2016-01-05 64 struct arizona_clk *clkdata = clk32k_to_arizona_clk(hw);
bbd51c97 Charles Keepax 2016-01-05 65 struct arizona *arizona = clkdata->arizona;
bbd51c97 Charles Keepax 2016-01-05 66
bbd51c97 Charles Keepax 2016-01-05 67 regmap_update_bits_async(arizona->regmap, ARIZONA_CLOCK_32K_1,
bbd51c97 Charles Keepax 2016-01-05 68 ARIZONA_CLK_32K_ENA, 0);
bbd51c97 Charles Keepax 2016-01-05 69
bbd51c97 Charles Keepax 2016-01-05 70 switch (arizona->pdata.clk32k_src) {
bbd51c97 Charles Keepax 2016-01-05 71 case ARIZONA_32KZ_MCLK1:
bbd51c97 Charles Keepax 2016-01-05 72 pm_runtime_put_sync(arizona->dev);
bbd51c97 Charles Keepax 2016-01-05 73 break;
bbd51c97 Charles Keepax 2016-01-05 74 }
bbd51c97 Charles Keepax 2016-01-05 75 }
bbd51c97 Charles Keepax 2016-01-05 76
bbd51c97 Charles Keepax 2016-01-05 @77 static const struct clk_ops arizona_32k_ops = {
bbd51c97 Charles Keepax 2016-01-05 @78 .prepare = arizona_32k_enable,
bbd51c97 Charles Keepax 2016-01-05 @79 .unprepare = arizona_32k_disable,
bbd51c97 Charles Keepax 2016-01-05 80 };
bbd51c97 Charles Keepax 2016-01-05 81
bbd51c97 Charles Keepax 2016-01-05 82 static int arizona_clk_of_get_pdata(struct arizona *arizona)
bbd51c97 Charles Keepax 2016-01-05 83 {
bbd51c97 Charles Keepax 2016-01-05 84 const char * const pins[] = { "mclk1", "mclk2" };
bbd51c97 Charles Keepax 2016-01-05 85 struct clk *mclk;
bbd51c97 Charles Keepax 2016-01-05 86 int i;
bbd51c97 Charles Keepax 2016-01-05 87
bbd51c97 Charles Keepax 2016-01-05 88 if (!of_property_read_bool(arizona->dev->of_node, "clocks"))
bbd51c97 Charles Keepax 2016-01-05 89 return 0;
bbd51c97 Charles Keepax 2016-01-05 90
bbd51c97 Charles Keepax 2016-01-05 91 for (i = 0; i < ARRAY_SIZE(pins); ++i) {
bbd51c97 Charles Keepax 2016-01-05 92 mclk = of_clk_get_by_name(arizona->dev->of_node, pins[i]);
bbd51c97 Charles Keepax 2016-01-05 93 if (IS_ERR(mclk))
bbd51c97 Charles Keepax 2016-01-05 94 return PTR_ERR(mclk);
bbd51c97 Charles Keepax 2016-01-05 95
bbd51c97 Charles Keepax 2016-01-05 96 if (clk_get_rate(mclk) == CLK32K_RATE) {
bbd51c97 Charles Keepax 2016-01-05 97 arizona->pdata.clk32k_src = ARIZONA_32KZ_MCLK1 + i;
bbd51c97 Charles Keepax 2016-01-05 @98 arizona->pdata.clk32k_parent = __clk_get_name(mclk);
bbd51c97 Charles Keepax 2016-01-05 99 }
bbd51c97 Charles Keepax 2016-01-05 100
bbd51c97 Charles Keepax 2016-01-05 101 clk_put(mclk);
bbd51c97 Charles Keepax 2016-01-05 102 }
bbd51c97 Charles Keepax 2016-01-05 103
bbd51c97 Charles Keepax 2016-01-05 104 return 0;
bbd51c97 Charles Keepax 2016-01-05 105 }
bbd51c97 Charles Keepax 2016-01-05 106
bbd51c97 Charles Keepax 2016-01-05 107 static int arizona_clk_probe(struct platform_device *pdev)
bbd51c97 Charles Keepax 2016-01-05 108 {
bbd51c97 Charles Keepax 2016-01-05 109 struct arizona *arizona = dev_get_drvdata(pdev->dev.parent);
bbd51c97 Charles Keepax 2016-01-05 110 struct arizona_clk *clkdata;
bbd51c97 Charles Keepax 2016-01-05 111 int ret;
bbd51c97 Charles Keepax 2016-01-05 112
bbd51c97 Charles Keepax 2016-01-05 @113 struct clk_init_data clk32k_init = {
bbd51c97 Charles Keepax 2016-01-05 @114 .name = "arizona-32k",
bbd51c97 Charles Keepax 2016-01-05 @115 .ops = &arizona_32k_ops,
bbd51c97 Charles Keepax 2016-01-05 116 };
bbd51c97 Charles Keepax 2016-01-05 117
bbd51c97 Charles Keepax 2016-01-05 118 if (IS_ENABLED(CONFIG_OF) && !dev_get_platdata(arizona->dev)) {
bbd51c97 Charles Keepax 2016-01-05 119 ret = arizona_clk_of_get_pdata(arizona);
bbd51c97 Charles Keepax 2016-01-05 120 if (ret) {
bbd51c97 Charles Keepax 2016-01-05 121 dev_err(arizona->dev, "Failed parsing clock DT: %d\n",
bbd51c97 Charles Keepax 2016-01-05 122 ret);
bbd51c97 Charles Keepax 2016-01-05 123 return ret;
bbd51c97 Charles Keepax 2016-01-05 124 }
bbd51c97 Charles Keepax 2016-01-05 125 }
bbd51c97 Charles Keepax 2016-01-05 126
bbd51c97 Charles Keepax 2016-01-05 127 clkdata = devm_kzalloc(&pdev->dev, sizeof(*clkdata), GFP_KERNEL);
bbd51c97 Charles Keepax 2016-01-05 128 if (!clkdata)
bbd51c97 Charles Keepax 2016-01-05 129 return -ENOMEM;
bbd51c97 Charles Keepax 2016-01-05 130
bbd51c97 Charles Keepax 2016-01-05 131 clkdata->arizona = arizona;
bbd51c97 Charles Keepax 2016-01-05 132
bbd51c97 Charles Keepax 2016-01-05 133 switch (arizona->pdata.clk32k_src) {
bbd51c97 Charles Keepax 2016-01-05 134 case 0:
bbd51c97 Charles Keepax 2016-01-05 135 arizona->pdata.clk32k_src = ARIZONA_32KZ_MCLK2;
bbd51c97 Charles Keepax 2016-01-05 136 /* Fall through */
bbd51c97 Charles Keepax 2016-01-05 137 case ARIZONA_32KZ_MCLK1:
bbd51c97 Charles Keepax 2016-01-05 138 case ARIZONA_32KZ_MCLK2:
bbd51c97 Charles Keepax 2016-01-05 139 case ARIZONA_32KZ_NONE:
bbd51c97 Charles Keepax 2016-01-05 140 regmap_update_bits(arizona->regmap, ARIZONA_CLOCK_32K_1,
bbd51c97 Charles Keepax 2016-01-05 141 ARIZONA_CLK_32K_SRC_MASK,
bbd51c97 Charles Keepax 2016-01-05 142 arizona->pdata.clk32k_src - 1);
bbd51c97 Charles Keepax 2016-01-05 143 break;
bbd51c97 Charles Keepax 2016-01-05 144 default:
bbd51c97 Charles Keepax 2016-01-05 145 dev_err(arizona->dev, "Invalid 32kHz clock source: %d\n",
bbd51c97 Charles Keepax 2016-01-05 146 arizona->pdata.clk32k_src);
bbd51c97 Charles Keepax 2016-01-05 147 return -EINVAL;
bbd51c97 Charles Keepax 2016-01-05 148 }
bbd51c97 Charles Keepax 2016-01-05 149
bbd51c97 Charles Keepax 2016-01-05 150 if (arizona->pdata.clk32k_parent) {
bbd51c97 Charles Keepax 2016-01-05 151 clk32k_init.num_parents = 1;
bbd51c97 Charles Keepax 2016-01-05 152 clk32k_init.parent_names = &arizona->pdata.clk32k_parent;
bbd51c97 Charles Keepax 2016-01-05 153 } else {
bbd51c97 Charles Keepax 2016-01-05 @154 clk32k_init.flags |= CLK_IS_ROOT;
bbd51c97 Charles Keepax 2016-01-05 155 }
bbd51c97 Charles Keepax 2016-01-05 156
bbd51c97 Charles Keepax 2016-01-05 157 clkdata->clk32k_hw.init = &clk32k_init;
bbd51c97 Charles Keepax 2016-01-05 @158 clkdata->clk32k = devm_clk_register(&pdev->dev, &clkdata->clk32k_hw);
bbd51c97 Charles Keepax 2016-01-05 159 if (IS_ERR(clkdata->clk32k)) {
bbd51c97 Charles Keepax 2016-01-05 160 ret = PTR_ERR(clkdata->clk32k);
bbd51c97 Charles Keepax 2016-01-05 161 dev_err(arizona->dev, "Failed to register 32k clock: %d\n",
:::::: The code at line 31 was first introduced by commit
:::::: bbd51c97104a0151ab632cf717b7119124291e1a clk: arizona: Add clock driver for the Arizona devices
:::::: TO: Charles Keepax <ckeepax@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
:::::: CC: 0day robot <fengguang.wu@xxxxxxxxx>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Attachment:
.config.gz
Description: Binary data