Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'v6.11-next-soc' of https://git.kernel.org/pub/scm/linux/kernel/git/mediatek/linux into soc/drivers

pmic warpper:
- reduce size by constifying data structures
- use devm_clk_bulk_det_all_enable

mutex:
- reduce size by changing variable bit size

* tag 'v6.11-next-soc' of https://git.kernel.org/pub/scm/linux/kernel/git/mediatek/linux:
soc: mediatek: mtk-mutex: Reduce type size for mtk_mutex_data members
soc: mediatek: pwrap: Use devm_clk_bulk_get_all_enable()
soc: mediatek: pwrap: Constify some struct int[]
soc: mediatek: pwrap: Constify struct pmic_wrapper_type

Link: https://lore.kernel.org/r/bfa9ab87-9de8-41fc-bfd1-de5ec324cfe0@gmail.com
Signed-off-by: Arnd Bergmann <arnd@arndb.de>

+56 -114
+26 -26
drivers/soc/mediatek/mtk-mutex.c
··· 327 327 }; 328 328 329 329 struct mtk_mutex_data { 330 - const unsigned int *mutex_mod; 331 - const unsigned int *mutex_sof; 332 - const unsigned int mutex_mod_reg; 333 - const unsigned int mutex_sof_reg; 334 - const unsigned int *mutex_table_mod; 330 + const u8 *mutex_mod; 331 + const u8 *mutex_table_mod; 332 + const u16 *mutex_sof; 333 + const u16 mutex_mod_reg; 334 + const u16 mutex_sof_reg; 335 335 const bool no_clk; 336 336 }; 337 337 ··· 345 345 struct cmdq_client_reg cmdq_reg; 346 346 }; 347 347 348 - static const unsigned int mt2701_mutex_mod[DDP_COMPONENT_ID_MAX] = { 348 + static const u8 mt2701_mutex_mod[DDP_COMPONENT_ID_MAX] = { 349 349 [DDP_COMPONENT_BLS] = MT2701_MUTEX_MOD_DISP_BLS, 350 350 [DDP_COMPONENT_COLOR0] = MT2701_MUTEX_MOD_DISP_COLOR, 351 351 [DDP_COMPONENT_OVL0] = MT2701_MUTEX_MOD_DISP_OVL, ··· 354 354 [DDP_COMPONENT_WDMA0] = MT2701_MUTEX_MOD_DISP_WDMA, 355 355 }; 356 356 357 - static const unsigned int mt2712_mutex_mod[DDP_COMPONENT_ID_MAX] = { 357 + static const u8 mt2712_mutex_mod[DDP_COMPONENT_ID_MAX] = { 358 358 [DDP_COMPONENT_AAL0] = MT2712_MUTEX_MOD_DISP_AAL0, 359 359 [DDP_COMPONENT_AAL1] = MT2712_MUTEX_MOD2_DISP_AAL1, 360 360 [DDP_COMPONENT_COLOR0] = MT2712_MUTEX_MOD_DISP_COLOR0, ··· 374 374 [DDP_COMPONENT_WDMA1] = MT2712_MUTEX_MOD_DISP_WDMA1, 375 375 }; 376 376 377 - static const unsigned int mt8167_mutex_mod[DDP_COMPONENT_ID_MAX] = { 377 + static const u8 mt8167_mutex_mod[DDP_COMPONENT_ID_MAX] = { 378 378 [DDP_COMPONENT_AAL0] = MT8167_MUTEX_MOD_DISP_AAL, 379 379 [DDP_COMPONENT_CCORR] = MT8167_MUTEX_MOD_DISP_CCORR, 380 380 [DDP_COMPONENT_COLOR0] = MT8167_MUTEX_MOD_DISP_COLOR, ··· 389 389 [DDP_COMPONENT_WDMA0] = MT8167_MUTEX_MOD_DISP_WDMA0, 390 390 }; 391 391 392 - static const unsigned int mt8173_mutex_mod[DDP_COMPONENT_ID_MAX] = { 392 + static const u8 mt8173_mutex_mod[DDP_COMPONENT_ID_MAX] = { 393 393 [DDP_COMPONENT_AAL0] = MT8173_MUTEX_MOD_DISP_AAL, 394 394 [DDP_COMPONENT_COLOR0] = MT8173_MUTEX_MOD_DISP_COLOR0, 395 395 [DDP_COMPONENT_COLOR1] = MT8173_MUTEX_MOD_DISP_COLOR1, ··· 407 407 [DDP_COMPONENT_WDMA1] = MT8173_MUTEX_MOD_DISP_WDMA1, 408 408 }; 409 409 410 - static const unsigned int mt8183_mutex_mod[DDP_COMPONENT_ID_MAX] = { 410 + static const u8 mt8183_mutex_mod[DDP_COMPONENT_ID_MAX] = { 411 411 [DDP_COMPONENT_AAL0] = MT8183_MUTEX_MOD_DISP_AAL0, 412 412 [DDP_COMPONENT_CCORR] = MT8183_MUTEX_MOD_DISP_CCORR0, 413 413 [DDP_COMPONENT_COLOR0] = MT8183_MUTEX_MOD_DISP_COLOR0, ··· 421 421 [DDP_COMPONENT_WDMA0] = MT8183_MUTEX_MOD_DISP_WDMA0, 422 422 }; 423 423 424 - static const unsigned int mt8183_mutex_table_mod[MUTEX_MOD_IDX_MAX] = { 424 + static const u8 mt8183_mutex_table_mod[MUTEX_MOD_IDX_MAX] = { 425 425 [MUTEX_MOD_IDX_MDP_RDMA0] = MT8183_MUTEX_MOD_MDP_RDMA0, 426 426 [MUTEX_MOD_IDX_MDP_RSZ0] = MT8183_MUTEX_MOD_MDP_RSZ0, 427 427 [MUTEX_MOD_IDX_MDP_RSZ1] = MT8183_MUTEX_MOD_MDP_RSZ1, ··· 432 432 [MUTEX_MOD_IDX_MDP_CCORR0] = MT8183_MUTEX_MOD_MDP_CCORR0, 433 433 }; 434 434 435 - static const unsigned int mt8186_mutex_mod[DDP_COMPONENT_ID_MAX] = { 435 + static const u8 mt8186_mutex_mod[DDP_COMPONENT_ID_MAX] = { 436 436 [DDP_COMPONENT_AAL0] = MT8186_MUTEX_MOD_DISP_AAL0, 437 437 [DDP_COMPONENT_CCORR] = MT8186_MUTEX_MOD_DISP_CCORR0, 438 438 [DDP_COMPONENT_COLOR0] = MT8186_MUTEX_MOD_DISP_COLOR0, ··· 445 445 [DDP_COMPONENT_RDMA1] = MT8186_MUTEX_MOD_DISP_RDMA1, 446 446 }; 447 447 448 - static const unsigned int mt8186_mdp_mutex_table_mod[MUTEX_MOD_IDX_MAX] = { 448 + static const u8 mt8186_mdp_mutex_table_mod[MUTEX_MOD_IDX_MAX] = { 449 449 [MUTEX_MOD_IDX_MDP_RDMA0] = MT8186_MUTEX_MOD_MDP_RDMA0, 450 450 [MUTEX_MOD_IDX_MDP_RSZ0] = MT8186_MUTEX_MOD_MDP_RSZ0, 451 451 [MUTEX_MOD_IDX_MDP_RSZ1] = MT8186_MUTEX_MOD_MDP_RSZ1, ··· 456 456 [MUTEX_MOD_IDX_MDP_COLOR0] = MT8186_MUTEX_MOD_MDP_COLOR0, 457 457 }; 458 458 459 - static const unsigned int mt8188_mutex_mod[DDP_COMPONENT_ID_MAX] = { 459 + static const u8 mt8188_mutex_mod[DDP_COMPONENT_ID_MAX] = { 460 460 [DDP_COMPONENT_OVL0] = MT8188_MUTEX_MOD_DISP_OVL0, 461 461 [DDP_COMPONENT_WDMA0] = MT8188_MUTEX_MOD_DISP_WDMA0, 462 462 [DDP_COMPONENT_RDMA0] = MT8188_MUTEX_MOD_DISP_RDMA0, ··· 496 496 [DDP_COMPONENT_MERGE5] = MT8188_MUTEX_MOD_DISP1_VPP_MERGE4, 497 497 }; 498 498 499 - static const unsigned int mt8188_mdp_mutex_table_mod[MUTEX_MOD_IDX_MAX] = { 499 + static const u8 mt8188_mdp_mutex_table_mod[MUTEX_MOD_IDX_MAX] = { 500 500 [MUTEX_MOD_IDX_MDP_RDMA0] = MT8195_MUTEX_MOD_MDP_RDMA0, 501 501 [MUTEX_MOD_IDX_MDP_RDMA2] = MT8195_MUTEX_MOD_MDP_RDMA2, 502 502 [MUTEX_MOD_IDX_MDP_RDMA3] = MT8195_MUTEX_MOD_MDP_RDMA3, ··· 530 530 [MUTEX_MOD_IDX_MDP_WROT3] = MT8195_MUTEX_MOD_MDP_WROT3, 531 531 }; 532 532 533 - static const unsigned int mt8192_mutex_mod[DDP_COMPONENT_ID_MAX] = { 533 + static const u8 mt8192_mutex_mod[DDP_COMPONENT_ID_MAX] = { 534 534 [DDP_COMPONENT_AAL0] = MT8192_MUTEX_MOD_DISP_AAL0, 535 535 [DDP_COMPONENT_CCORR] = MT8192_MUTEX_MOD_DISP_CCORR0, 536 536 [DDP_COMPONENT_COLOR0] = MT8192_MUTEX_MOD_DISP_COLOR0, ··· 544 544 [DDP_COMPONENT_RDMA4] = MT8192_MUTEX_MOD_DISP_RDMA4, 545 545 }; 546 546 547 - static const unsigned int mt8195_mutex_mod[DDP_COMPONENT_ID_MAX] = { 547 + static const u8 mt8195_mutex_mod[DDP_COMPONENT_ID_MAX] = { 548 548 [DDP_COMPONENT_OVL0] = MT8195_MUTEX_MOD_DISP_OVL0, 549 549 [DDP_COMPONENT_WDMA0] = MT8195_MUTEX_MOD_DISP_WDMA0, 550 550 [DDP_COMPONENT_RDMA0] = MT8195_MUTEX_MOD_DISP_RDMA0, ··· 575 575 [DDP_COMPONENT_DP_INTF1] = MT8195_MUTEX_MOD_DISP1_DP_INTF0, 576 576 }; 577 577 578 - static const unsigned int mt8195_mutex_table_mod[MUTEX_MOD_IDX_MAX] = { 578 + static const u8 mt8195_mutex_table_mod[MUTEX_MOD_IDX_MAX] = { 579 579 [MUTEX_MOD_IDX_MDP_RDMA0] = MT8195_MUTEX_MOD_MDP_RDMA0, 580 580 [MUTEX_MOD_IDX_MDP_RDMA1] = MT8195_MUTEX_MOD_MDP_RDMA1, 581 581 [MUTEX_MOD_IDX_MDP_RDMA2] = MT8195_MUTEX_MOD_MDP_RDMA2, ··· 621 621 [MUTEX_MOD_IDX_MDP_WROT3] = MT8195_MUTEX_MOD_MDP_WROT3, 622 622 }; 623 623 624 - static const unsigned int mt8365_mutex_mod[DDP_COMPONENT_ID_MAX] = { 624 + static const u8 mt8365_mutex_mod[DDP_COMPONENT_ID_MAX] = { 625 625 [DDP_COMPONENT_AAL0] = MT8365_MUTEX_MOD_DISP_AAL, 626 626 [DDP_COMPONENT_CCORR] = MT8365_MUTEX_MOD_DISP_CCORR, 627 627 [DDP_COMPONENT_COLOR0] = MT8365_MUTEX_MOD_DISP_COLOR0, ··· 637 637 [DDP_COMPONENT_WDMA0] = MT8365_MUTEX_MOD_DISP_WDMA0, 638 638 }; 639 639 640 - static const unsigned int mt2712_mutex_sof[DDP_MUTEX_SOF_MAX] = { 640 + static const u16 mt2712_mutex_sof[DDP_MUTEX_SOF_MAX] = { 641 641 [MUTEX_SOF_SINGLE_MODE] = MUTEX_SOF_SINGLE_MODE, 642 642 [MUTEX_SOF_DSI0] = MUTEX_SOF_DSI0, 643 643 [MUTEX_SOF_DSI1] = MUTEX_SOF_DSI1, ··· 647 647 [MUTEX_SOF_DSI3] = MUTEX_SOF_DSI3, 648 648 }; 649 649 650 - static const unsigned int mt6795_mutex_sof[DDP_MUTEX_SOF_MAX] = { 650 + static const u16 mt6795_mutex_sof[DDP_MUTEX_SOF_MAX] = { 651 651 [MUTEX_SOF_SINGLE_MODE] = MUTEX_SOF_SINGLE_MODE, 652 652 [MUTEX_SOF_DSI0] = MUTEX_SOF_DSI0, 653 653 [MUTEX_SOF_DSI1] = MUTEX_SOF_DSI1, 654 654 [MUTEX_SOF_DPI0] = MUTEX_SOF_DPI0, 655 655 }; 656 656 657 - static const unsigned int mt8167_mutex_sof[DDP_MUTEX_SOF_MAX] = { 657 + static const u16 mt8167_mutex_sof[DDP_MUTEX_SOF_MAX] = { 658 658 [MUTEX_SOF_SINGLE_MODE] = MUTEX_SOF_SINGLE_MODE, 659 659 [MUTEX_SOF_DSI0] = MUTEX_SOF_DSI0, 660 660 [MUTEX_SOF_DPI0] = MT8167_MUTEX_SOF_DPI0, ··· 662 662 }; 663 663 664 664 /* Add EOF setting so overlay hardware can receive frame done irq */ 665 - static const unsigned int mt8183_mutex_sof[DDP_MUTEX_SOF_MAX] = { 665 + static const u16 mt8183_mutex_sof[DDP_MUTEX_SOF_MAX] = { 666 666 [MUTEX_SOF_SINGLE_MODE] = MUTEX_SOF_SINGLE_MODE, 667 667 [MUTEX_SOF_DSI0] = MUTEX_SOF_DSI0 | MT8183_MUTEX_EOF_DSI0, 668 668 [MUTEX_SOF_DPI0] = MT8183_MUTEX_SOF_DPI0 | MT8183_MUTEX_EOF_DPI0, 669 669 }; 670 670 671 - static const unsigned int mt8186_mutex_sof[MUTEX_SOF_DSI3 + 1] = { 671 + static const u16 mt8186_mutex_sof[MUTEX_SOF_DSI3 + 1] = { 672 672 [MUTEX_SOF_SINGLE_MODE] = MUTEX_SOF_SINGLE_MODE, 673 673 [MUTEX_SOF_DSI0] = MT8186_MUTEX_SOF_DSI0 | MT8186_MUTEX_EOF_DSI0, 674 674 [MUTEX_SOF_DPI0] = MT8186_MUTEX_SOF_DPI0 | MT8186_MUTEX_EOF_DPI0, ··· 682 682 * but also detect the error at end of frame(EAEOF) when EOF signal 683 683 * arrives. 684 684 */ 685 - static const unsigned int mt8188_mutex_sof[DDP_MUTEX_SOF_MAX] = { 685 + static const u16 mt8188_mutex_sof[DDP_MUTEX_SOF_MAX] = { 686 686 [MUTEX_SOF_SINGLE_MODE] = MUTEX_SOF_SINGLE_MODE, 687 687 [MUTEX_SOF_DSI0] = 688 688 MT8188_MUTEX_SOF_DSI0 | MT8188_MUTEX_EOF_DSI0, ··· 692 692 MT8188_MUTEX_SOF_DP_INTF1 | MT8188_MUTEX_EOF_DP_INTF1, 693 693 }; 694 694 695 - static const unsigned int mt8195_mutex_sof[DDP_MUTEX_SOF_MAX] = { 695 + static const u16 mt8195_mutex_sof[DDP_MUTEX_SOF_MAX] = { 696 696 [MUTEX_SOF_SINGLE_MODE] = MUTEX_SOF_SINGLE_MODE, 697 697 [MUTEX_SOF_DSI0] = MT8195_MUTEX_SOF_DSI0 | MT8195_MUTEX_EOF_DSI0, 698 698 [MUTEX_SOF_DSI1] = MT8195_MUTEX_SOF_DSI1 | MT8195_MUTEX_EOF_DSI1,
+30 -88
drivers/soc/mediatek/mtk-pmic-wrap.c
··· 483 483 PWRAP_MSB_FIRST, 484 484 }; 485 485 486 - static int mt2701_regs[] = { 486 + static const int mt2701_regs[] = { 487 487 [PWRAP_MUX_SEL] = 0x0, 488 488 [PWRAP_WRAP_EN] = 0x4, 489 489 [PWRAP_DIO_EN] = 0x8, ··· 569 569 [PWRAP_ADC_RDATA_ADDR2] = 0x154, 570 570 }; 571 571 572 - static int mt6765_regs[] = { 572 + static const int mt6765_regs[] = { 573 573 [PWRAP_MUX_SEL] = 0x0, 574 574 [PWRAP_WRAP_EN] = 0x4, 575 575 [PWRAP_DIO_EN] = 0x8, ··· 601 601 [PWRAP_DCM_DBC_PRD] = 0x1E0, 602 602 }; 603 603 604 - static int mt6779_regs[] = { 604 + static const int mt6779_regs[] = { 605 605 [PWRAP_MUX_SEL] = 0x0, 606 606 [PWRAP_WRAP_EN] = 0x4, 607 607 [PWRAP_DIO_EN] = 0x8, ··· 640 640 [PWRAP_WACS2_VLDCLR] = 0xC28, 641 641 }; 642 642 643 - static int mt6795_regs[] = { 643 + static const int mt6795_regs[] = { 644 644 [PWRAP_MUX_SEL] = 0x0, 645 645 [PWRAP_WRAP_EN] = 0x4, 646 646 [PWRAP_DIO_EN] = 0x8, ··· 725 725 [PWRAP_EXT_CK] = 0x14c, 726 726 }; 727 727 728 - static int mt6797_regs[] = { 728 + static const int mt6797_regs[] = { 729 729 [PWRAP_MUX_SEL] = 0x0, 730 730 [PWRAP_WRAP_EN] = 0x4, 731 731 [PWRAP_DIO_EN] = 0x8, ··· 758 758 [PWRAP_DCM_DBC_PRD] = 0x1D4, 759 759 }; 760 760 761 - static int mt6873_regs[] = { 761 + static const int mt6873_regs[] = { 762 762 [PWRAP_INIT_DONE2] = 0x0, 763 763 [PWRAP_TIMER_EN] = 0x3E0, 764 764 [PWRAP_INT_EN] = 0x448, ··· 769 769 [PWRAP_WACS2_RDATA] = 0xCA8, 770 770 }; 771 771 772 - static int mt7622_regs[] = { 772 + static const int mt7622_regs[] = { 773 773 [PWRAP_MUX_SEL] = 0x0, 774 774 [PWRAP_WRAP_EN] = 0x4, 775 775 [PWRAP_DIO_EN] = 0x8, ··· 881 881 [PWRAP_SPI2_CTRL] = 0x244, 882 882 }; 883 883 884 - static int mt8135_regs[] = { 884 + static const int mt8135_regs[] = { 885 885 [PWRAP_MUX_SEL] = 0x0, 886 886 [PWRAP_WRAP_EN] = 0x4, 887 887 [PWRAP_DIO_EN] = 0x8, ··· 954 954 [PWRAP_DCM_DBC_PRD] = 0x160, 955 955 }; 956 956 957 - static int mt8173_regs[] = { 957 + static const int mt8173_regs[] = { 958 958 [PWRAP_MUX_SEL] = 0x0, 959 959 [PWRAP_WRAP_EN] = 0x4, 960 960 [PWRAP_DIO_EN] = 0x8, ··· 1036 1036 [PWRAP_DCM_DBC_PRD] = 0x148, 1037 1037 }; 1038 1038 1039 - static int mt8183_regs[] = { 1039 + static const int mt8183_regs[] = { 1040 1040 [PWRAP_MUX_SEL] = 0x0, 1041 1041 [PWRAP_WRAP_EN] = 0x4, 1042 1042 [PWRAP_DIO_EN] = 0x8, ··· 1087 1087 [PWRAP_WACS2_VLDCLR] = 0xC28, 1088 1088 }; 1089 1089 1090 - static int mt8195_regs[] = { 1090 + static const int mt8195_regs[] = { 1091 1091 [PWRAP_INIT_DONE2] = 0x0, 1092 1092 [PWRAP_STAUPD_CTRL] = 0x4C, 1093 1093 [PWRAP_TIMER_EN] = 0x3E4, ··· 1104 1104 [PWRAP_WACS2_RDATA] = 0x8A8, 1105 1105 }; 1106 1106 1107 - static int mt8365_regs[] = { 1107 + static const int mt8365_regs[] = { 1108 1108 [PWRAP_MUX_SEL] = 0x0, 1109 1109 [PWRAP_WRAP_EN] = 0x4, 1110 1110 [PWRAP_DIO_EN] = 0x8, ··· 1166 1166 [PWRAP_WDT_SRC_EN_1] = 0xf8, 1167 1167 }; 1168 1168 1169 - static int mt8516_regs[] = { 1169 + static const int mt8516_regs[] = { 1170 1170 [PWRAP_MUX_SEL] = 0x0, 1171 1171 [PWRAP_WRAP_EN] = 0x4, 1172 1172 [PWRAP_DIO_EN] = 0x8, ··· 1251 1251 [PWRAP_MSB_FIRST] = 0x170, 1252 1252 }; 1253 1253 1254 - static int mt8186_regs[] = { 1254 + static const int mt8186_regs[] = { 1255 1255 [PWRAP_MUX_SEL] = 0x0, 1256 1256 [PWRAP_WRAP_EN] = 0x4, 1257 1257 [PWRAP_DIO_EN] = 0x8, ··· 1366 1366 struct regmap *regmap; 1367 1367 const struct pmic_wrapper_type *master; 1368 1368 const struct pwrap_slv_type *slave; 1369 - struct clk *clk_spi; 1370 - struct clk *clk_wrap; 1371 - struct clk *clk_sys; 1372 - struct clk *clk_tmr; 1373 1369 struct reset_control *rstc; 1374 1370 1375 1371 struct reset_control *rstc_bridge; ··· 1373 1377 }; 1374 1378 1375 1379 struct pmic_wrapper_type { 1376 - int *regs; 1380 + const int *regs; 1377 1381 enum pwrap_type type; 1378 1382 u32 arb_en_all; 1379 1383 u32 int_en_all; ··· 2393 2397 .init_soc_specific = pwrap_mt8183_init_soc_specific, 2394 2398 }; 2395 2399 2396 - static struct pmic_wrapper_type pwrap_mt8195 = { 2400 + static const struct pmic_wrapper_type pwrap_mt8195 = { 2397 2401 .regs = mt8195_regs, 2398 2402 .type = PWRAP_MT8195, 2399 2403 .arb_en_all = 0x777f, /* NEED CONFIRM */ ··· 2419 2423 .init_soc_specific = NULL, 2420 2424 }; 2421 2425 2422 - static struct pmic_wrapper_type pwrap_mt8516 = { 2426 + static const struct pmic_wrapper_type pwrap_mt8516 = { 2423 2427 .regs = mt8516_regs, 2424 2428 .type = PWRAP_MT8516, 2425 2429 .arb_en_all = 0xff, ··· 2431 2435 .init_soc_specific = NULL, 2432 2436 }; 2433 2437 2434 - static struct pmic_wrapper_type pwrap_mt8186 = { 2438 + static const struct pmic_wrapper_type pwrap_mt8186 = { 2435 2439 .regs = mt8186_regs, 2436 2440 .type = PWRAP_MT8186, 2437 2441 .arb_en_all = 0xfb27f, ··· 2468 2472 int ret, irq; 2469 2473 u32 mask_done; 2470 2474 struct pmic_wrapper *wrp; 2475 + struct clk_bulk_data *clk; 2471 2476 struct device_node *np = pdev->dev.of_node; 2472 2477 const struct of_device_id *of_slave_id = NULL; 2473 2478 ··· 2518 2521 } 2519 2522 } 2520 2523 2521 - wrp->clk_spi = devm_clk_get(wrp->dev, "spi"); 2522 - if (IS_ERR(wrp->clk_spi)) { 2523 - dev_dbg(wrp->dev, "failed to get clock: %ld\n", 2524 - PTR_ERR(wrp->clk_spi)); 2525 - return PTR_ERR(wrp->clk_spi); 2526 - } 2527 - 2528 - wrp->clk_wrap = devm_clk_get(wrp->dev, "wrap"); 2529 - if (IS_ERR(wrp->clk_wrap)) { 2530 - dev_dbg(wrp->dev, "failed to get clock: %ld\n", 2531 - PTR_ERR(wrp->clk_wrap)); 2532 - return PTR_ERR(wrp->clk_wrap); 2533 - } 2534 - 2535 - wrp->clk_sys = devm_clk_get_optional(wrp->dev, "sys"); 2536 - if (IS_ERR(wrp->clk_sys)) { 2537 - return dev_err_probe(wrp->dev, PTR_ERR(wrp->clk_sys), 2538 - "failed to get clock: %pe\n", 2539 - wrp->clk_sys); 2540 - } 2541 - 2542 - wrp->clk_tmr = devm_clk_get_optional(wrp->dev, "tmr"); 2543 - if (IS_ERR(wrp->clk_tmr)) { 2544 - return dev_err_probe(wrp->dev, PTR_ERR(wrp->clk_tmr), 2545 - "failed to get clock: %pe\n", 2546 - wrp->clk_tmr); 2547 - } 2548 - 2549 - ret = clk_prepare_enable(wrp->clk_spi); 2524 + ret = devm_clk_bulk_get_all_enable(wrp->dev, &clk); 2550 2525 if (ret) 2551 - return ret; 2552 - 2553 - ret = clk_prepare_enable(wrp->clk_wrap); 2554 - if (ret) 2555 - goto err_out1; 2556 - 2557 - ret = clk_prepare_enable(wrp->clk_sys); 2558 - if (ret) 2559 - goto err_out2; 2560 - 2561 - ret = clk_prepare_enable(wrp->clk_tmr); 2562 - if (ret) 2563 - goto err_out3; 2526 + return dev_err_probe(wrp->dev, ret, 2527 + "failed to get clocks\n"); 2564 2528 2565 2529 /* Enable internal dynamic clock */ 2566 2530 if (HAS_CAP(wrp->master->caps, PWRAP_CAP_DCM)) { ··· 2537 2579 ret = pwrap_init(wrp); 2538 2580 if (ret) { 2539 2581 dev_dbg(wrp->dev, "init failed with %d\n", ret); 2540 - goto err_out4; 2582 + return ret; 2541 2583 } 2542 2584 } 2543 2585 ··· 2550 2592 2551 2593 if (!(pwrap_readl(wrp, PWRAP_WACS2_RDATA) & mask_done)) { 2552 2594 dev_dbg(wrp->dev, "initialization isn't finished\n"); 2553 - ret = -ENODEV; 2554 - goto err_out4; 2595 + return -ENODEV; 2555 2596 } 2556 2597 2557 2598 /* Initialize watchdog, may not be done by the bootloader */ ··· 2579 2622 pwrap_writel(wrp, wrp->master->int1_en_all, PWRAP_INT1_EN); 2580 2623 2581 2624 irq = platform_get_irq(pdev, 0); 2582 - if (irq < 0) { 2583 - ret = irq; 2584 - goto err_out2; 2585 - } 2625 + if (irq < 0) 2626 + return irq; 2586 2627 2587 2628 ret = devm_request_irq(wrp->dev, irq, pwrap_interrupt, 2588 2629 IRQF_TRIGGER_HIGH, 2589 2630 "mt-pmic-pwrap", wrp); 2590 2631 if (ret) 2591 - goto err_out4; 2632 + return ret; 2592 2633 2593 2634 wrp->regmap = devm_regmap_init(wrp->dev, NULL, wrp, wrp->slave->regops->regmap); 2594 - if (IS_ERR(wrp->regmap)) { 2595 - ret = PTR_ERR(wrp->regmap); 2596 - goto err_out2; 2597 - } 2635 + if (IS_ERR(wrp->regmap)) 2636 + return PTR_ERR(wrp->regmap); 2598 2637 2599 2638 ret = of_platform_populate(np, NULL, NULL, wrp->dev); 2600 2639 if (ret) { 2601 2640 dev_dbg(wrp->dev, "failed to create child devices at %pOF\n", 2602 2641 np); 2603 - goto err_out4; 2642 + return ret; 2604 2643 } 2605 2644 2606 2645 return 0; 2607 - 2608 - err_out4: 2609 - clk_disable_unprepare(wrp->clk_tmr); 2610 - err_out3: 2611 - clk_disable_unprepare(wrp->clk_sys); 2612 - err_out2: 2613 - clk_disable_unprepare(wrp->clk_wrap); 2614 - err_out1: 2615 - clk_disable_unprepare(wrp->clk_spi); 2616 - 2617 - return ret; 2618 2646 } 2619 2647 2620 2648 static struct platform_driver pwrap_drv = {