Re: [PATCH 2/6] mfd: da9063: Replace model with type

From: kbuild test robot
Date: Sat May 26 2018 - 05:17:23 EST


Hi Marek,

I love your patch! Perhaps something to improve:

[auto build test WARNING on ljones-mfd/for-mfd-next]
[also build test WARNING on v4.17-rc6]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Marek-Vasut/mfd-da9063-Rename-PMIC_DA9063-to-PMIC_CHIP_ID_DA9063/20180526-162613
base: https://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git for-mfd-next
config: x86_64-randconfig-x002-201820 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

All warnings (new ones prefixed by >>):

In file included from include/linux/kernel.h:10:0,
from drivers//regulator/da9063-regulator.c:16:
drivers//regulator/da9063-regulator.c: In function 'da9063_regulator_probe':
drivers//regulator/da9063-regulator.c:744:12: error: 'const struct da9063_dev_model' has no member named 'dev_model'
if (model->dev_model == da9063->type)
^
include/linux/compiler.h:58:30: note: in definition of macro '__trace_if'
if (__builtin_constant_p(!!(cond)) ? !!(cond) : \
^~~~
>> drivers//regulator/da9063-regulator.c:744:3: note: in expansion of macro 'if'
if (model->dev_model == da9063->type)
^~
drivers//regulator/da9063-regulator.c:744:12: error: 'const struct da9063_dev_model' has no member named 'dev_model'
if (model->dev_model == da9063->type)
^
include/linux/compiler.h:58:42: note: in definition of macro '__trace_if'
if (__builtin_constant_p(!!(cond)) ? !!(cond) : \
^~~~
>> drivers//regulator/da9063-regulator.c:744:3: note: in expansion of macro 'if'
if (model->dev_model == da9063->type)
^~
drivers//regulator/da9063-regulator.c:744:12: error: 'const struct da9063_dev_model' has no member named 'dev_model'
if (model->dev_model == da9063->type)
^
include/linux/compiler.h:69:16: note: in definition of macro '__trace_if'
______r = !!(cond); \
^~~~
>> drivers//regulator/da9063-regulator.c:744:3: note: in expansion of macro 'if'
if (model->dev_model == da9063->type)
^~
drivers//regulator/da9063-regulator.c:749:10: error: 'struct da9063' has no member named 'model'
da9063->model);
^~

vim +/if +744 drivers//regulator/da9063-regulator.c

715
716 static int da9063_regulator_probe(struct platform_device *pdev)
717 {
718 struct da9063 *da9063 = dev_get_drvdata(pdev->dev.parent);
719 struct da9063_pdata *da9063_pdata = dev_get_platdata(da9063->dev);
720 struct of_regulator_match *da9063_reg_matches = NULL;
721 struct da9063_regulators_pdata *regl_pdata;
722 const struct da9063_dev_model *model;
723 struct da9063_regulators *regulators;
724 struct da9063_regulator *regl;
725 struct regulator_config config;
726 bool bcores_merged, bmem_bio_merged;
727 int id, irq, n, n_regulators, ret, val;
728 size_t size;
729
730 regl_pdata = da9063_pdata ? da9063_pdata->regulators_pdata : NULL;
731
732 if (!regl_pdata)
733 regl_pdata = da9063_parse_regulators_dt(pdev,
734 &da9063_reg_matches);
735
736 if (IS_ERR(regl_pdata) || regl_pdata->n_regulators == 0) {
737 dev_err(&pdev->dev,
738 "No regulators defined for the platform\n");
739 return -ENODEV;
740 }
741
742 /* Find regulators set for particular device model */
743 for (model = regulators_models; model->regulator_info; model++) {
> 744 if (model->dev_model == da9063->type)
745 break;
746 }
747 if (!model->regulator_info) {
748 dev_err(&pdev->dev, "Chip model not recognised (%u)\n",
749 da9063->model);
750 return -ENODEV;
751 }
752
753 ret = regmap_read(da9063->regmap, DA9063_REG_CONFIG_H, &val);
754 if (ret < 0) {
755 dev_err(&pdev->dev,
756 "Error while reading BUCKs configuration\n");
757 return ret;
758 }
759 bcores_merged = val & DA9063_BCORE_MERGE;
760 bmem_bio_merged = val & DA9063_BUCK_MERGE;
761
762 n_regulators = model->n_regulators;
763 if (bcores_merged)
764 n_regulators -= 2; /* remove BCORE1, BCORE2 */
765 else
766 n_regulators--; /* remove BCORES_MERGED */
767 if (bmem_bio_merged)
768 n_regulators -= 2; /* remove BMEM, BIO */
769 else
770 n_regulators--; /* remove BMEM_BIO_MERGED */
771
772 /* Allocate memory required by usable regulators */
773 size = sizeof(struct da9063_regulators) +
774 n_regulators * sizeof(struct da9063_regulator);
775 regulators = devm_kzalloc(&pdev->dev, size, GFP_KERNEL);
776 if (!regulators)
777 return -ENOMEM;
778
779 regulators->n_regulators = n_regulators;
780 platform_set_drvdata(pdev, regulators);
781
782 /* Register all regulators declared in platform information */
783 n = 0;
784 id = 0;
785 while (n < regulators->n_regulators) {
786 /* Skip regulator IDs depending on merge mode configuration */
787 switch (id) {
788 case DA9063_ID_BCORE1:
789 case DA9063_ID_BCORE2:
790 if (bcores_merged) {
791 id++;
792 continue;
793 }
794 break;
795 case DA9063_ID_BMEM:
796 case DA9063_ID_BIO:
797 if (bmem_bio_merged) {
798 id++;
799 continue;
800 }
801 break;
802 case DA9063_ID_BCORES_MERGED:
803 if (!bcores_merged) {
804 id++;
805 continue;
806 }
807 break;
808 case DA9063_ID_BMEM_BIO_MERGED:
809 if (!bmem_bio_merged) {
810 id++;
811 continue;
812 }
813 break;
814 }
815
816 /* Initialise regulator structure */
817 regl = &regulators->regulator[n];
818 regl->hw = da9063;
819 regl->info = &model->regulator_info[id];
820 regl->desc = regl->info->desc;
821 regl->desc.type = REGULATOR_VOLTAGE;
822 regl->desc.owner = THIS_MODULE;
823
824 if (regl->info->mode.reg)
825 regl->mode = devm_regmap_field_alloc(&pdev->dev,
826 da9063->regmap, regl->info->mode);
827 if (regl->info->suspend.reg)
828 regl->suspend = devm_regmap_field_alloc(&pdev->dev,
829 da9063->regmap, regl->info->suspend);
830 if (regl->info->sleep.reg)
831 regl->sleep = devm_regmap_field_alloc(&pdev->dev,
832 da9063->regmap, regl->info->sleep);
833 if (regl->info->suspend_sleep.reg)
834 regl->suspend_sleep = devm_regmap_field_alloc(&pdev->dev,
835 da9063->regmap, regl->info->suspend_sleep);
836 if (regl->info->ilimit.reg)
837 regl->ilimit = devm_regmap_field_alloc(&pdev->dev,
838 da9063->regmap, regl->info->ilimit);
839
840 /* Register regulator */
841 memset(&config, 0, sizeof(config));
842 config.dev = &pdev->dev;
843 config.init_data = da9063_get_regulator_initdata(regl_pdata, id);
844 config.driver_data = regl;
845 if (da9063_reg_matches)
846 config.of_node = da9063_reg_matches[id].of_node;
847 config.regmap = da9063->regmap;
848 regl->rdev = devm_regulator_register(&pdev->dev, &regl->desc,
849 &config);
850 if (IS_ERR(regl->rdev)) {
851 dev_err(&pdev->dev,
852 "Failed to register %s regulator\n",
853 regl->desc.name);
854 return PTR_ERR(regl->rdev);
855 }
856 id++;
857 n++;
858 }
859
860 /* LDOs overcurrent event support */
861 irq = platform_get_irq_byname(pdev, "LDO_LIM");
862 if (irq < 0) {
863 dev_err(&pdev->dev, "Failed to get IRQ.\n");
864 return irq;
865 }
866
867 ret = devm_request_threaded_irq(&pdev->dev, irq,
868 NULL, da9063_ldo_lim_event,
869 IRQF_TRIGGER_LOW | IRQF_ONESHOT,
870 "LDO_LIM", regulators);
871 if (ret) {
872 dev_err(&pdev->dev, "Failed to request LDO_LIM IRQ.\n");
873 return ret;
874 }
875
876 return 0;
877 }
878

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip