tree: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-4.20 head: 7ece50c9f790270e82b77589d34e54547c895a66 commit: 8307b2afd386ccce369821daa2196068c47fe8cd [519/523] ASoC: stm32: sai: set sai as mclk clock provider config: powerpc-allyesconfig (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 git checkout 8307b2afd386ccce369821daa2196068c47fe8cd # save the attached .config to linux build tree GCC_VERSION=7.2.0 make.cross ARCH=powerpc
All error/warnings (new ones prefixed by >>):
sound/soc/stm/stm32_sai_sub.c:260:16: error: field 'hw' has incomplete type
struct clk_hw hw; ^~ In file included from include/linux/err.h:5:0, from include/linux/clk.h:15, from sound/soc/stm/stm32_sai_sub.c:19: sound/soc/stm/stm32_sai_sub.c: In function 'stm32_sai_mclk_round_rate': include/linux/kernel.h:997:32: error: dereferencing pointer to incomplete type 'struct clk_hw' BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ ^~~~~~ include/linux/compiler.h:335:18: note: in definition of macro '__compiletime_assert' int __cond = !(condition); \ ^~~~~~~~~ include/linux/compiler.h:358:2: note: in expansion of macro '_compiletime_assert' _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__) ^~~~~~~~~~~~~~~~~~~ include/linux/build_bug.h:45:37: note: in expansion of macro 'compiletime_assert' #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) ^~~~~~~~~~~~~~~~~~ include/linux/kernel.h:997:2: note: in expansion of macro 'BUILD_BUG_ON_MSG' BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ ^~~~~~~~~~~~~~~~ include/linux/kernel.h:997:20: note: in expansion of macro '__same_type' BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ ^~~~~~~~~~~
sound/soc/stm/stm32_sai_sub.c:265:27: note: in expansion of macro 'container_of'
#define to_mclk_data(_hw) container_of(_hw, struct stm32_sai_mclk_data, hw) ^~~~~~~~~~~~
sound/soc/stm/stm32_sai_sub.c:313:37: note: in expansion of macro 'to_mclk_data'
struct stm32_sai_mclk_data *mclk = to_mclk_data(hw); ^~~~~~~~~~~~ sound/soc/stm/stm32_sai_sub.c: At top level:
sound/soc/stm/stm32_sai_sub.c:376:21: error: variable 'mclk_ops' has initializer but incomplete type
static const struct clk_ops mclk_ops = { ^~~~~~~
sound/soc/stm/stm32_sai_sub.c:377:3: error: 'const struct clk_ops' has no member named 'enable'
.enable = stm32_sai_mclk_enable, ^~~~~~
sound/soc/stm/stm32_sai_sub.c:377:12: warning: excess elements in struct initializer
.enable = stm32_sai_mclk_enable, ^~~~~~~~~~~~~~~~~~~~~ sound/soc/stm/stm32_sai_sub.c:377:12: note: (near initialization for 'mclk_ops')
sound/soc/stm/stm32_sai_sub.c:378:3: error: 'const struct clk_ops' has no member named 'disable'
.disable = stm32_sai_mclk_disable, ^~~~~~~ sound/soc/stm/stm32_sai_sub.c:378:13: warning: excess elements in struct initializer .disable = stm32_sai_mclk_disable, ^~~~~~~~~~~~~~~~~~~~~~ sound/soc/stm/stm32_sai_sub.c:378:13: note: (near initialization for 'mclk_ops')
sound/soc/stm/stm32_sai_sub.c:379:3: error: 'const struct clk_ops' has no member named 'recalc_rate'
.recalc_rate = stm32_sai_mclk_recalc_rate, ^~~~~~~~~~~ sound/soc/stm/stm32_sai_sub.c:379:17: warning: excess elements in struct initializer .recalc_rate = stm32_sai_mclk_recalc_rate, ^~~~~~~~~~~~~~~~~~~~~~~~~~ sound/soc/stm/stm32_sai_sub.c:379:17: note: (near initialization for 'mclk_ops')
sound/soc/stm/stm32_sai_sub.c:380:3: error: 'const struct clk_ops' has no member named 'round_rate'
.round_rate = stm32_sai_mclk_round_rate, ^~~~~~~~~~ sound/soc/stm/stm32_sai_sub.c:380:16: warning: excess elements in struct initializer .round_rate = stm32_sai_mclk_round_rate, ^~~~~~~~~~~~~~~~~~~~~~~~~ sound/soc/stm/stm32_sai_sub.c:380:16: note: (near initialization for 'mclk_ops')
sound/soc/stm/stm32_sai_sub.c:381:3: error: 'const struct clk_ops' has no member named 'set_rate'
.set_rate = stm32_sai_mclk_set_rate, ^~~~~~~~ sound/soc/stm/stm32_sai_sub.c:381:14: warning: excess elements in struct initializer .set_rate = stm32_sai_mclk_set_rate, ^~~~~~~~~~~~~~~~~~~~~~~ sound/soc/stm/stm32_sai_sub.c:381:14: note: (near initialization for 'mclk_ops') sound/soc/stm/stm32_sai_sub.c: In function 'stm32_sai_add_mclk_provider':
sound/soc/stm/stm32_sai_sub.c:389:22: error: implicit declaration of function '__clk_get_name'; did you mean 'clk_get_rate'? [-Werror=implicit-function-declaration]
const char *pname = __clk_get_name(sai->sai_ck); ^~~~~~~~~~~~~~ clk_get_rate
sound/soc/stm/stm32_sai_sub.c:389:22: warning: initialization makes pointer from integer without a cast [-Wint-conversion] sound/soc/stm/stm32_sai_sub.c:414:18: error: implicit declaration of function 'CLK_HW_INIT'; did you mean 'KLIST_INIT'? [-Werror=implicit-function-declaration]
mclk->hw.init = CLK_HW_INIT(mclk_name, pname, &mclk_ops, 0); ^~~~~~~~~~~ KLIST_INIT
sound/soc/stm/stm32_sai_sub.c:419:8: error: implicit declaration of function 'devm_clk_hw_register'; did you mean 'device_unregister'? [-Werror=implicit-function-declaration]
ret = devm_clk_hw_register(&sai->pdev->dev, hw); ^~~~~~~~~~~~~~~~~~~~ device_unregister
sound/soc/stm/stm32_sai_sub.c:427:9: error: implicit declaration of function 'devm_of_clk_add_hw_provider'; did you mean 'of_clk_get_from_provider'? [-Werror=implicit-function-declaration]
return devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get, hw); ^~~~~~~~~~~~~~~~~~~~~~~~~~~ of_clk_get_from_provider
sound/soc/stm/stm32_sai_sub.c:427:42: error: 'of_clk_hw_simple_get' undeclared (first use in this function); did you mean 'ida_simple_get'?
return devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get, hw); ^~~~~~~~~~~~~~~~~~~~ ida_simple_get sound/soc/stm/stm32_sai_sub.c:427:42: note: each undeclared identifier is reported only once for each function it appears in sound/soc/stm/stm32_sai_sub.c: At top level:
sound/soc/stm/stm32_sai_sub.c:376:29: error: storage size of 'mclk_ops' isn't known
static const struct clk_ops mclk_ops = { ^~~~~~~~ sound/soc/stm/stm32_sai_sub.c: In function 'stm32_sai_add_mclk_provider':
sound/soc/stm/stm32_sai_sub.c:428:1: warning: control reaches end of non-void function [-Wreturn-type]
} ^ cc1: some warnings being treated as errors
vim +/hw +260 sound/soc/stm/stm32_sai_sub.c
258 259 struct stm32_sai_mclk_data {
260 struct clk_hw hw;
261 unsigned long freq; 262 struct stm32_sai_sub_data *sai_data; 263 }; 264
265 #define to_mclk_data(_hw) container_of(_hw, struct stm32_sai_mclk_data, hw)
266 #define STM32_SAI_MAX_CLKS 1 267 268 static int stm32_sai_get_clk_div(struct stm32_sai_sub_data *sai, 269 unsigned long input_rate, 270 unsigned long output_rate) 271 { 272 int version = sai->pdata->conf->version; 273 int div; 274 275 div = DIV_ROUND_CLOSEST(input_rate, output_rate); 276 if (div > SAI_XCR1_MCKDIV_MAX(version)) { 277 dev_err(&sai->pdev->dev, "Divider %d out of range\n", div); 278 return -EINVAL; 279 } 280 dev_dbg(&sai->pdev->dev, "SAI divider %d\n", div); 281 282 if (input_rate % div) 283 dev_dbg(&sai->pdev->dev, 284 "Rate not accurate. requested (%ld), actual (%ld)\n", 285 output_rate, input_rate / div); 286 287 return div; 288 } 289 290 static int stm32_sai_set_clk_div(struct stm32_sai_sub_data *sai, 291 unsigned int div) 292 { 293 int version = sai->pdata->conf->version; 294 int ret, cr1, mask; 295 296 if (div > SAI_XCR1_MCKDIV_MAX(version)) { 297 dev_err(&sai->pdev->dev, "Divider %d out of range\n", div); 298 return -EINVAL; 299 } 300 301 mask = SAI_XCR1_MCKDIV_MASK(SAI_XCR1_MCKDIV_WIDTH(version)); 302 cr1 = SAI_XCR1_MCKDIV_SET(div); 303 ret = regmap_update_bits(sai->regmap, STM_SAI_CR1_REGX, mask, cr1); 304 if (ret < 0) 305 dev_err(&sai->pdev->dev, "Failed to update CR1 register\n"); 306 307 return ret; 308 } 309 310 static long stm32_sai_mclk_round_rate(struct clk_hw *hw, unsigned long rate, 311 unsigned long *prate) 312 {
313 struct stm32_sai_mclk_data *mclk = to_mclk_data(hw);
314 struct stm32_sai_sub_data *sai = mclk->sai_data; 315 int div; 316 317 div = stm32_sai_get_clk_div(sai, *prate, rate); 318 if (div < 0) 319 return div; 320 321 mclk->freq = *prate / div; 322 323 return mclk->freq; 324 } 325 326 static unsigned long stm32_sai_mclk_recalc_rate(struct clk_hw *hw, 327 unsigned long parent_rate) 328 { 329 struct stm32_sai_mclk_data *mclk = to_mclk_data(hw); 330 331 return mclk->freq; 332 } 333 334 static int stm32_sai_mclk_set_rate(struct clk_hw *hw, unsigned long rate, 335 unsigned long parent_rate) 336 { 337 struct stm32_sai_mclk_data *mclk = to_mclk_data(hw); 338 struct stm32_sai_sub_data *sai = mclk->sai_data; 339 unsigned int div; 340 int ret; 341 342 div = stm32_sai_get_clk_div(sai, parent_rate, rate); 343 if (div < 0) 344 return div; 345 346 ret = stm32_sai_set_clk_div(sai, div); 347 if (ret) 348 return ret; 349 350 mclk->freq = rate; 351 352 return 0; 353 } 354 355 static int stm32_sai_mclk_enable(struct clk_hw *hw) 356 { 357 struct stm32_sai_mclk_data *mclk = to_mclk_data(hw); 358 struct stm32_sai_sub_data *sai = mclk->sai_data; 359 360 dev_dbg(&sai->pdev->dev, "Enable master clock\n"); 361 362 return regmap_update_bits(sai->regmap, STM_SAI_CR1_REGX, 363 SAI_XCR1_MCKEN, SAI_XCR1_MCKEN); 364 } 365 366 static void stm32_sai_mclk_disable(struct clk_hw *hw) 367 { 368 struct stm32_sai_mclk_data *mclk = to_mclk_data(hw); 369 struct stm32_sai_sub_data *sai = mclk->sai_data; 370 371 dev_dbg(&sai->pdev->dev, "Disable master clock\n"); 372 373 regmap_update_bits(sai->regmap, STM_SAI_CR1_REGX, SAI_XCR1_MCKEN, 0); 374 } 375
376 static const struct clk_ops mclk_ops = { 377 .enable = stm32_sai_mclk_enable, 378 .disable = stm32_sai_mclk_disable, 379 .recalc_rate = stm32_sai_mclk_recalc_rate, 380 .round_rate = stm32_sai_mclk_round_rate, 381 .set_rate = stm32_sai_mclk_set_rate,
382 }; 383 384 static int stm32_sai_add_mclk_provider(struct stm32_sai_sub_data *sai) 385 { 386 struct clk_hw *hw; 387 struct stm32_sai_mclk_data *mclk; 388 struct device *dev = &sai->pdev->dev;
389 const char *pname = __clk_get_name(sai->sai_ck);
390 char *mclk_name, *p, *s = (char *)pname; 391 int ret, i = 0; 392 393 mclk = devm_kzalloc(dev, sizeof(mclk), GFP_KERNEL); 394 if (!mclk) 395 return -ENOMEM; 396 397 mclk_name = devm_kcalloc(dev, sizeof(char), 398 SAI_MCLK_NAME_LEN, GFP_KERNEL); 399 if (!mclk_name) 400 return -ENOMEM; 401 402 /* 403 * Forge mclk clock name from parent clock name and suffix. 404 * String after "_" char is stripped in parent name. 405 */ 406 p = mclk_name; 407 while (*s && *s != '_' && (i < (SAI_MCLK_NAME_LEN - 6))) { 408 *p++ = *s++; 409 i++; 410 } 411 STM_SAI_IS_SUB_A(sai) ? 412 strncat(p, "a_mclk", 6) : strncat(p, "b_mclk", 6); 413
414 mclk->hw.init = CLK_HW_INIT(mclk_name, pname, &mclk_ops, 0);
415 mclk->sai_data = sai; 416 hw = &mclk->hw; 417 418 dev_dbg(dev, "Register master clock %s\n", mclk_name);
419 ret = devm_clk_hw_register(&sai->pdev->dev, hw);
420 if (ret) { 421 dev_err(dev, "mclk register returned %d\n", ret); 422 return ret; 423 } 424 sai->sai_mclk = hw->clk; 425 426 /* register mclk provider */
427 return devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get, hw); 428 }
429
--- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation