tree: https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git topic/asus-e100h-4.10 head: c86c0067e6111324a39f523c250c8b1089b1d822 commit: 19a80107e5cf1d2d02b678bb086f305a05e4f692 [18/26] clk: x86: Add Atom PMC platform clocks config: i386-randconfig-i1-02231015 (attached as .config) compiler: gcc-4.8 (Debian 4.8.4-1) 4.8.4 reproduce: git checkout 19a80107e5cf1d2d02b678bb086f305a05e4f692 # save the attached .config to linux build tree make ARCH=i386
All error/warnings (new ones prefixed by >>):
drivers/clk/x86/clk-pmc-atom.c:44:16: error: field 'hw' has incomplete type
struct clk_hw 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/io.h:23, from include/linux/clk-provider.h:14, from drivers/clk/x86/clk-pmc-atom.c:17: drivers/clk/x86/clk-pmc-atom.c: In function 'plt_clk_set_parent': include/linux/kernel.h:850:48: warning: initialization from incompatible pointer type [enabled by default] const typeof( ((type *)0)->member ) *__mptr = (ptr); \ ^ drivers/clk/x86/clk-pmc-atom.c:51:25: note: in expansion of macro 'container_of' #define to_clk_plt(_hw) container_of(_hw, struct clk_plt, hw) ^ drivers/clk/x86/clk-pmc-atom.c:113:24: note: in expansion of macro 'to_clk_plt' struct clk_plt *clk = to_clk_plt(hw); ^ include/linux/kernel.h:850:48: warning: (near initialization for 'clk') [enabled by default] const typeof( ((type *)0)->member ) *__mptr = (ptr); \ ^ drivers/clk/x86/clk-pmc-atom.c:51:25: note: in expansion of macro 'container_of' #define to_clk_plt(_hw) container_of(_hw, struct clk_plt, hw) ^ drivers/clk/x86/clk-pmc-atom.c:113:24: note: in expansion of macro 'to_clk_plt' struct clk_plt *clk = to_clk_plt(hw); ^ drivers/clk/x86/clk-pmc-atom.c: In function 'plt_clk_get_parent': include/linux/kernel.h:850:48: warning: initialization from incompatible pointer type [enabled by default] const typeof( ((type *)0)->member ) *__mptr = (ptr); \ ^ drivers/clk/x86/clk-pmc-atom.c:51:25: note: in expansion of macro 'container_of' #define to_clk_plt(_hw) container_of(_hw, struct clk_plt, hw) ^ drivers/clk/x86/clk-pmc-atom.c:122:24: note: in expansion of macro 'to_clk_plt' struct clk_plt *clk = to_clk_plt(hw); ^ include/linux/kernel.h:850:48: warning: (near initialization for 'clk') [enabled by default] const typeof( ((type *)0)->member ) *__mptr = (ptr); \ ^ drivers/clk/x86/clk-pmc-atom.c:51:25: note: in expansion of macro 'container_of' #define to_clk_plt(_hw) container_of(_hw, struct clk_plt, hw) ^ drivers/clk/x86/clk-pmc-atom.c:122:24: note: in expansion of macro 'to_clk_plt' struct clk_plt *clk = to_clk_plt(hw); ^ drivers/clk/x86/clk-pmc-atom.c: In function 'plt_clk_enable': include/linux/kernel.h:850:48: warning: initialization from incompatible pointer type [enabled by default] const typeof( ((type *)0)->member ) *__mptr = (ptr); \ ^ drivers/clk/x86/clk-pmc-atom.c:51:25: note: in expansion of macro 'container_of' #define to_clk_plt(_hw) container_of(_hw, struct clk_plt, hw) ^ drivers/clk/x86/clk-pmc-atom.c:132:24: note: in expansion of macro 'to_clk_plt' struct clk_plt *clk = to_clk_plt(hw); ^ include/linux/kernel.h:850:48: warning: (near initialization for 'clk') [enabled by default] const typeof( ((type *)0)->member ) *__mptr = (ptr); \ ^ drivers/clk/x86/clk-pmc-atom.c:51:25: note: in expansion of macro 'container_of' #define to_clk_plt(_hw) container_of(_hw, struct clk_plt, hw) ^ drivers/clk/x86/clk-pmc-atom.c:132:24: note: in expansion of macro 'to_clk_plt' struct clk_plt *clk = to_clk_plt(hw); ^ drivers/clk/x86/clk-pmc-atom.c: In function 'plt_clk_disable': include/linux/kernel.h:850:48: warning: initialization from incompatible pointer type [enabled by default] const typeof( ((type *)0)->member ) *__mptr = (ptr); \ ^ drivers/clk/x86/clk-pmc-atom.c:51:25: note: in expansion of macro 'container_of' #define to_clk_plt(_hw) container_of(_hw, struct clk_plt, hw) ^ drivers/clk/x86/clk-pmc-atom.c:141:24: note: in expansion of macro 'to_clk_plt' struct clk_plt *clk = to_clk_plt(hw); ^ include/linux/kernel.h:850:48: warning: (near initialization for 'clk') [enabled by default] const typeof( ((type *)0)->member ) *__mptr = (ptr); \ ^ drivers/clk/x86/clk-pmc-atom.c:51:25: note: in expansion of macro 'container_of' #define to_clk_plt(_hw) container_of(_hw, struct clk_plt, hw) ^ drivers/clk/x86/clk-pmc-atom.c:141:24: note: in expansion of macro 'to_clk_plt' struct clk_plt *clk = to_clk_plt(hw); ^ drivers/clk/x86/clk-pmc-atom.c: In function 'plt_clk_is_enabled': include/linux/kernel.h:850:48: warning: initialization from incompatible pointer type [enabled by default] const typeof( ((type *)0)->member ) *__mptr = (ptr); \ ^ drivers/clk/x86/clk-pmc-atom.c:51:25: note: in expansion of macro 'container_of' #define to_clk_plt(_hw) container_of(_hw, struct clk_plt, hw) ^ drivers/clk/x86/clk-pmc-atom.c:148:24: note: in expansion of macro 'to_clk_plt' struct clk_plt *clk = to_clk_plt(hw); ^ include/linux/kernel.h:850:48: warning: (near initialization for 'clk') [enabled by default] const typeof( ((type *)0)->member ) *__mptr = (ptr); \ ^ drivers/clk/x86/clk-pmc-atom.c:51:25: note: in expansion of macro 'container_of' #define to_clk_plt(_hw) container_of(_hw, struct clk_plt, hw) ^ drivers/clk/x86/clk-pmc-atom.c:148:24: note: in expansion of macro 'to_clk_plt' struct clk_plt *clk = to_clk_plt(hw); ^ drivers/clk/x86/clk-pmc-atom.c: At top level:
drivers/clk/x86/clk-pmc-atom.c:156:21: error: variable 'plt_clk_ops' has initializer but incomplete type
static const struct clk_ops plt_clk_ops = { ^
drivers/clk/x86/clk-pmc-atom.c:157:2: error: unknown field 'enable' specified in initializer
.enable = plt_clk_enable, ^
drivers/clk/x86/clk-pmc-atom.c:157:2: warning: excess elements in struct initializer [enabled by default]
drivers/clk/x86/clk-pmc-atom.c:157:2: warning: (near initialization for 'plt_clk_ops') [enabled by default]
drivers/clk/x86/clk-pmc-atom.c:158:2: error: unknown field 'disable' specified in initializer
.disable = plt_clk_disable, ^ drivers/clk/x86/clk-pmc-atom.c:158:2: warning: excess elements in struct initializer [enabled by default] drivers/clk/x86/clk-pmc-atom.c:158:2: warning: (near initialization for 'plt_clk_ops') [enabled by default]
drivers/clk/x86/clk-pmc-atom.c:159:2: error: unknown field 'is_enabled' specified in initializer
.is_enabled = plt_clk_is_enabled, ^ drivers/clk/x86/clk-pmc-atom.c:159:2: warning: excess elements in struct initializer [enabled by default] drivers/clk/x86/clk-pmc-atom.c:159:2: warning: (near initialization for 'plt_clk_ops') [enabled by default]
drivers/clk/x86/clk-pmc-atom.c:160:2: error: unknown field 'get_parent' specified in initializer
.get_parent = plt_clk_get_parent, ^ drivers/clk/x86/clk-pmc-atom.c:160:2: warning: excess elements in struct initializer [enabled by default] drivers/clk/x86/clk-pmc-atom.c:160:2: warning: (near initialization for 'plt_clk_ops') [enabled by default]
drivers/clk/x86/clk-pmc-atom.c:161:2: error: unknown field 'set_parent' specified in initializer
.set_parent = plt_clk_set_parent, ^ drivers/clk/x86/clk-pmc-atom.c:161:2: warning: excess elements in struct initializer [enabled by default] drivers/clk/x86/clk-pmc-atom.c:161:2: warning: (near initialization for 'plt_clk_ops') [enabled by default]
drivers/clk/x86/clk-pmc-atom.c:162:2: error: unknown field 'determine_rate' specified in initializer
.determine_rate = __clk_mux_determine_rate, ^
drivers/clk/x86/clk-pmc-atom.c:162:20: error: '__clk_mux_determine_rate' undeclared here (not in a function)
.determine_rate = __clk_mux_determine_rate, ^ drivers/clk/x86/clk-pmc-atom.c:162:2: warning: excess elements in struct initializer [enabled by default] .determine_rate = __clk_mux_determine_rate, ^ drivers/clk/x86/clk-pmc-atom.c:162:2: warning: (near initialization for 'plt_clk_ops') [enabled by default] drivers/clk/x86/clk-pmc-atom.c: In function 'plt_clk_register':
drivers/clk/x86/clk-pmc-atom.c:171:23: error: storage size of 'init' isn't known
struct clk_init_data init; ^
drivers/clk/x86/clk-pmc-atom.c:188:2: error: implicit declaration of function 'devm_clk_hw_register' [-Werror=implicit-function-declaration]
ret = devm_clk_hw_register(&pdev->dev, &pclk->hw); ^ drivers/clk/x86/clk-pmc-atom.c:171:23: warning: unused variable 'init' [-Wunused-variable] struct clk_init_data init; ^ drivers/clk/x86/clk-pmc-atom.c: In function 'plt_clk_register_fixed_rate':
drivers/clk/x86/clk-pmc-atom.c:221:2: error: implicit declaration of function 'clk_hw_register_fixed_rate' [-Werror=implicit-function-declaration]
pclk->clk = clk_hw_register_fixed_rate(&pdev->dev, name, parent_name, ^
drivers/clk/x86/clk-pmc-atom.c:221:12: warning: assignment makes pointer from integer without a cast [enabled by default]
pclk->clk = clk_hw_register_fixed_rate(&pdev->dev, name, parent_name, ^
drivers/clk/x86/clk-pmc-atom.c:228:3: error: implicit declaration of function 'clk_hw_unregister_fixed_rate' [-Werror=implicit-function-declaration]
clk_hw_unregister_fixed_rate(pclk->clk); ^ cc1: some warnings being treated as errors
vim +/hw +44 drivers/clk/x86/clk-pmc-atom.c
38 struct clk_plt_fixed { 39 struct clk_hw *clk; 40 struct clk_lookup *lookup; 41 }; 42 43 struct clk_plt {
44 struct clk_hw hw;
45 void __iomem *reg; 46 struct clk_lookup *lookup; 47 /* protect access to PMC registers */ 48 spinlock_t lock; 49 }; 50
51 #define to_clk_plt(_hw) container_of(_hw, struct clk_plt, hw)
52 53 struct clk_plt_data { 54 struct clk_plt_fixed **parents; 55 u8 nparents; 56 struct clk_plt *clks[PMC_CLK_NUM]; 57 }; 58 59 /* Return an index in parent table */ 60 static inline int plt_reg_to_parent(int reg) 61 { 62 switch (reg & PMC_MASK_CLK_FREQ) { 63 default: 64 case PMC_CLK_FREQ_XTAL: 65 return 0; 66 case PMC_CLK_FREQ_PLL: 67 return 1; 68 } 69 } 70 71 /* Return clk index of parent */ 72 static inline int plt_parent_to_reg(int index) 73 { 74 switch (index) { 75 default: 76 case 0: 77 return PMC_CLK_FREQ_XTAL; 78 case 1: 79 return PMC_CLK_FREQ_PLL; 80 } 81 } 82 83 /* Abstract status in simpler enabled/disabled value */ 84 static inline int plt_reg_to_enabled(int reg) 85 { 86 switch (reg & PMC_MASK_CLK_CTL) { 87 case PMC_CLK_CTL_GATED_ON_D3: 88 case PMC_CLK_CTL_FORCE_ON: 89 return 1; /* enabled */ 90 case PMC_CLK_CTL_FORCE_OFF: 91 case PMC_CLK_CTL_RESERVED: 92 default: 93 return 0; /* disabled */ 94 } 95 } 96 97 static void plt_clk_reg_update(struct clk_plt *clk, u32 mask, u32 val) 98 { 99 u32 tmp; 100 unsigned long flags; 101 102 spin_lock_irqsave(&clk->lock, flags); 103 104 tmp = readl(clk->reg); 105 tmp = (tmp & ~mask) | (val & mask); 106 writel(tmp, clk->reg); 107 108 spin_unlock_irqrestore(&clk->lock, flags); 109 } 110 111 static int plt_clk_set_parent(struct clk_hw *hw, u8 index) 112 { 113 struct clk_plt *clk = to_clk_plt(hw); 114 115 plt_clk_reg_update(clk, PMC_MASK_CLK_FREQ, plt_parent_to_reg(index)); 116 117 return 0; 118 } 119 120 static u8 plt_clk_get_parent(struct clk_hw *hw) 121 { 122 struct clk_plt *clk = to_clk_plt(hw); 123 u32 value; 124 125 value = readl(clk->reg); 126 127 return plt_reg_to_parent(value); 128 } 129 130 static int plt_clk_enable(struct clk_hw *hw) 131 { 132 struct clk_plt *clk = to_clk_plt(hw); 133 134 plt_clk_reg_update(clk, PMC_MASK_CLK_CTL, PMC_CLK_CTL_FORCE_ON); 135 136 return 0; 137 } 138 139 static void plt_clk_disable(struct clk_hw *hw) 140 { 141 struct clk_plt *clk = to_clk_plt(hw); 142 143 plt_clk_reg_update(clk, PMC_MASK_CLK_CTL, PMC_CLK_CTL_FORCE_OFF); 144 } 145 146 static int plt_clk_is_enabled(struct clk_hw *hw) 147 {
148 struct clk_plt *clk = to_clk_plt(hw);
149 u32 value; 150 151 value = readl(clk->reg); 152 153 return plt_reg_to_enabled(value); 154 } 155
156 static const struct clk_ops plt_clk_ops = { 157 .enable = plt_clk_enable, 158 .disable = plt_clk_disable, 159 .is_enabled = plt_clk_is_enabled, 160 .get_parent = plt_clk_get_parent, 161 .set_parent = plt_clk_set_parent, 162 .determine_rate = __clk_mux_determine_rate,
163 }; 164 165 static struct clk_plt *plt_clk_register(struct platform_device *pdev, int id, 166 void __iomem *base, 167 const char **parent_names, 168 int num_parents) 169 { 170 struct clk_plt *pclk;
171 struct clk_init_data init;
172 int ret; 173 174 pclk = devm_kzalloc(&pdev->dev, sizeof(*pclk), GFP_KERNEL); 175 if (!pclk) 176 return ERR_PTR(-ENOMEM); 177 178 init.name = kasprintf(GFP_KERNEL, "%s_%d", PLT_CLK_NAME_BASE, id); 179 init.ops = &plt_clk_ops; 180 init.flags = 0; 181 init.parent_names = parent_names; 182 init.num_parents = num_parents; 183 184 pclk->hw.init = &init; 185 pclk->reg = base + PMC_CLK_CTL_OFFSET + id * PMC_CLK_CTL_SIZE; 186 spin_lock_init(&pclk->lock); 187
188 ret = devm_clk_hw_register(&pdev->dev, &pclk->hw);
189 if (ret) { 190 pclk = ERR_PTR(ret); 191 goto err_free_init; 192 } 193 194 pclk->lookup = clkdev_hw_create(&pclk->hw, init.name, NULL); 195 if (!pclk->lookup) { 196 pclk = ERR_PTR(-ENOMEM); 197 goto err_free_init; 198 } 199 200 err_free_init: 201 kfree(init.name); 202 return pclk; 203 } 204 205 static void plt_clk_unregister(struct clk_plt *pclk) 206 { 207 clkdev_drop(pclk->lookup); 208 } 209 210 static struct clk_plt_fixed *plt_clk_register_fixed_rate(struct platform_device *pdev, 211 const char *name, 212 const char *parent_name, 213 unsigned long fixed_rate) 214 { 215 struct clk_plt_fixed *pclk; 216 217 pclk = devm_kzalloc(&pdev->dev, sizeof(*pclk), GFP_KERNEL); 218 if (!pclk) 219 return ERR_PTR(-ENOMEM); 220
221 pclk->clk = clk_hw_register_fixed_rate(&pdev->dev, name, parent_name,
222 0, fixed_rate); 223 if (IS_ERR(pclk->clk)) 224 return ERR_CAST(pclk->clk); 225 226 pclk->lookup = clkdev_hw_create(pclk->clk, name, NULL); 227 if (!pclk->lookup) {
228 clk_hw_unregister_fixed_rate(pclk->clk);
229 return ERR_PTR(-ENOMEM); 230 } 231
--- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation