tree: https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git gpio-descriptors-regulator-fixup head: ed6264569b383a24dbd153e74d4f93a7b03d2353 commit: 4041ebec6f804500e8e5608ff9a3ecfa04c1bc23 [11/15] regulator: max8973: Let core handle GPIO descriptor config: i386-randconfig-x005-201848 (attached as .config) compiler: gcc-7 (Debian 7.3.0-1) 7.3.0 reproduce: git checkout 4041ebec6f804500e8e5608ff9a3ecfa04c1bc23 # save the attached .config to linux build tree make ARCH=i386 All errors (new ones prefixed by >>): drivers//regulator/max8973-regulator.c: In function 'max8973_probe': >> drivers//regulator/max8973-regulator.c:817:22: error: passing argument 1 of 'devm_gpiod_unhinge' from incompatible pointer type [-Werror=incompatible-pointer-types] devm_gpiod_unhinge(config.ena_gpiod); ^~~~~~ In file included from include/asm-generic/gpio.h:14:0, from include/linux/gpio.h:62, from drivers//regulator/max8973-regulator.c:36: include/linux/gpio/consumer.h:107:6: note: expected 'struct device *' but argument is of type 'struct gpio_desc *' void devm_gpiod_unhinge(struct device *dev, struct gpio_desc *desc); ^~~~~~~~~~~~~~~~~~ >> drivers//regulator/max8973-regulator.c:817:3: error: too few arguments to function 'devm_gpiod_unhinge' devm_gpiod_unhinge(config.ena_gpiod); ^~~~~~~~~~~~~~~~~~ In file included from include/asm-generic/gpio.h:14:0, from include/linux/gpio.h:62, from drivers//regulator/max8973-regulator.c:36: include/linux/gpio/consumer.h:107:6: note: declared here void devm_gpiod_unhinge(struct device *dev, struct gpio_desc *desc); ^~~~~~~~~~~~~~~~~~ cc1: some warnings being treated as errors vim +/devm_gpiod_unhinge +817 drivers//regulator/max8973-regulator.c 624 625 static int max8973_probe(struct i2c_client *client, 626 const struct i2c_device_id *id) 627 { 628 struct max8973_regulator_platform_data *pdata; 629 struct regulator_init_data *ridata; 630 struct regulator_config config = { }; 631 struct regulator_dev *rdev; 632 struct max8973_chip *max; 633 bool pdata_from_dt = false; 634 unsigned int chip_id; 635 struct gpio_desc *gpiod; 636 enum gpiod_flags gflags; 637 int ret; 638 639 pdata = dev_get_platdata(&client->dev); 640 641 if (!pdata && client->dev.of_node) { 642 pdata = max8973_parse_dt(&client->dev); 643 pdata_from_dt = true; 644 } 645 646 if (!pdata) { 647 dev_err(&client->dev, "No Platform data"); 648 return -EIO; 649 } 650 651 if (pdata->dvs_gpio == -EPROBE_DEFER) 652 return -EPROBE_DEFER; 653 654 max = devm_kzalloc(&client->dev, sizeof(*max), GFP_KERNEL); 655 if (!max) 656 return -ENOMEM; 657 658 max->regmap = devm_regmap_init_i2c(client, &max8973_regmap_config); 659 if (IS_ERR(max->regmap)) { 660 ret = PTR_ERR(max->regmap); 661 dev_err(&client->dev, "regmap init failed, err %d\n", ret); 662 return ret; 663 } 664 665 if (client->dev.of_node) { 666 const struct of_device_id *match; 667 668 match = of_match_device(of_match_ptr(of_max8973_match_tbl), 669 &client->dev); 670 if (!match) 671 return -ENODATA; 672 max->id = (u32)((uintptr_t)match->data); 673 } else { 674 max->id = id->driver_data; 675 } 676 677 ret = regmap_read(max->regmap, MAX8973_CHIPID1, &chip_id); 678 if (ret < 0) { 679 dev_err(&client->dev, "register CHIPID1 read failed, %d", ret); 680 return ret; 681 } 682 683 dev_info(&client->dev, "CHIP-ID OTP: 0x%02x ID_M: 0x%02x\n", 684 (chip_id >> 4) & 0xF, (chip_id >> 1) & 0x7); 685 686 i2c_set_clientdata(client, max); 687 max->ops = max8973_dcdc_ops; 688 max->dev = &client->dev; 689 max->desc.name = id->name; 690 max->desc.id = 0; 691 max->desc.ops = &max->ops; 692 max->desc.type = REGULATOR_VOLTAGE; 693 max->desc.owner = THIS_MODULE; 694 max->desc.min_uV = MAX8973_MIN_VOLATGE; 695 max->desc.uV_step = MAX8973_VOLATGE_STEP; 696 max->desc.n_voltages = MAX8973_BUCK_N_VOLTAGE; 697 698 max->dvs_gpio = (pdata->dvs_gpio) ? pdata->dvs_gpio : -EINVAL; 699 max->enable_external_control = pdata->enable_ext_control; 700 max->curr_gpio_val = pdata->dvs_def_state; 701 max->curr_vout_reg = MAX8973_VOUT + pdata->dvs_def_state; 702 max->junction_temp_warning = pdata->junction_temp_warning; 703 704 max->lru_index[0] = max->curr_vout_reg; 705 706 if (gpio_is_valid(max->dvs_gpio)) { 707 int gpio_flags; 708 int i; 709 710 gpio_flags = (pdata->dvs_def_state) ? 711 GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW; 712 ret = devm_gpio_request_one(&client->dev, max->dvs_gpio, 713 gpio_flags, "max8973-dvs"); 714 if (ret) { 715 dev_err(&client->dev, 716 "gpio_request for gpio %d failed, err = %d\n", 717 max->dvs_gpio, ret); 718 return ret; 719 } 720 721 /* 722 * Initialize the lru index with vout_reg id 723 * The index 0 will be most recently used and 724 * set with the max->curr_vout_reg */ 725 for (i = 0; i < MAX8973_MAX_VOUT_REG; ++i) 726 max->lru_index[i] = i; 727 max->lru_index[0] = max->curr_vout_reg; 728 max->lru_index[max->curr_vout_reg] = 0; 729 } else { 730 /* 731 * If there is no DVS GPIO, the VOUT register 732 * address is fixed. 733 */ 734 max->ops.set_voltage_sel = regulator_set_voltage_sel_regmap; 735 max->ops.get_voltage_sel = regulator_get_voltage_sel_regmap; 736 max->desc.vsel_reg = max->curr_vout_reg; 737 max->desc.vsel_mask = MAX8973_VOUT_MASK; 738 } 739 740 if (pdata_from_dt) 741 pdata->reg_init_data = of_get_regulator_init_data(&client->dev, 742 client->dev.of_node, &max->desc); 743 744 ridata = pdata->reg_init_data; 745 switch (max->id) { 746 case MAX8973: 747 if (!pdata->enable_ext_control) { 748 max->desc.enable_reg = MAX8973_VOUT; 749 max->desc.enable_mask = MAX8973_VOUT_ENABLE; 750 max->ops.enable = regulator_enable_regmap; 751 max->ops.disable = regulator_disable_regmap; 752 max->ops.is_enabled = regulator_is_enabled_regmap; 753 break; 754 } 755 756 if (ridata && (ridata->constraints.always_on || 757 ridata->constraints.boot_on)) 758 gflags = GPIOD_OUT_HIGH; 759 else 760 gflags = GPIOD_OUT_LOW; 761 gflags |= GPIOD_FLAGS_BIT_NONEXCLUSIVE; 762 gpiod = devm_gpiod_get_optional(&client->dev, 763 "maxim,enable", 764 gflags); 765 if (IS_ERR(gpiod)) 766 return PTR_ERR(gpiod); 767 if (gpiod) { 768 config.ena_gpiod = gpiod; 769 max->enable_external_control = true; 770 } 771 772 break; 773 774 case MAX77621: 775 /* 776 * We do not let the core switch this regulator on/off, 777 * we just leave it on. 778 */ 779 gpiod = devm_gpiod_get_optional(&client->dev, 780 "maxim,enable", 781 GPIOD_OUT_HIGH); 782 if (IS_ERR(gpiod)) 783 return PTR_ERR(gpiod); 784 if (gpiod) 785 max->enable_external_control = true; 786 787 max->desc.enable_reg = MAX8973_VOUT; 788 max->desc.enable_mask = MAX8973_VOUT_ENABLE; 789 max->ops.enable = regulator_enable_regmap; 790 max->ops.disable = regulator_disable_regmap; 791 max->ops.is_enabled = regulator_is_enabled_regmap; 792 max->ops.set_current_limit = max8973_set_current_limit; 793 max->ops.get_current_limit = max8973_get_current_limit; 794 break; 795 default: 796 break; 797 } 798 799 ret = max8973_init_dcdc(max, pdata); 800 if (ret < 0) { 801 dev_err(max->dev, "Max8973 Init failed, err = %d\n", ret); 802 return ret; 803 } 804 805 config.dev = &client->dev; 806 config.init_data = pdata->reg_init_data; 807 config.driver_data = max; 808 config.of_node = client->dev.of_node; 809 config.regmap = max->regmap; 810 811 /* 812 * Register the regulators 813 * Turn the GPIO descriptor over to the regulator core for 814 * lifecycle management if we pass an ena_gpiod. 815 */ 816 if (config.ena_gpiod) > 817 devm_gpiod_unhinge(config.ena_gpiod); 818 rdev = devm_regulator_register(&client->dev, &max->desc, &config); 819 if (IS_ERR(rdev)) { 820 ret = PTR_ERR(rdev); 821 dev_err(max->dev, "regulator register failed, err %d\n", ret); 822 return ret; 823 } 824 825 max8973_thermal_init(max); 826 return 0; 827 } 828 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Attachment:
.config.gz
Description: application/gzip