Re: [PATCH 2/6] mfd: da9063: Replace model with type
Hi Marek, I love your patch! Yet something to improve: [auto build test ERROR on ljones-mfd/for-mfd-next] [also build test ERROR 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-x011-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 errors (new ones prefixed by >>): 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) ^~ >> drivers/regulator/da9063-regulator.c:749:10: error: 'struct da9063' has no >> member named 'model' da9063->model); ^~ vim +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 _reg_matches); 735 736 if (IS_ERR(regl_pdata) || regl_pdata->n_regulators == 0) { 737 dev_err(>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(>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, ); 754 if (ret < 0) { 755 dev_err(>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(>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
Re: [PATCH 2/6] mfd: da9063: Replace model with type
On 05/26/2018 11:16 AM, kbuild test robot wrote: > 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 Is it testing this patch without the other patches in the series or at least 1/6 ? -- Best regards, Marek Vasut
Re: [PATCH 2/6] mfd: da9063: Replace model with type
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 _reg_matches); 735 736 if (IS_ERR(regl_pdata) || regl_pdata->n_regulators == 0) { 737 dev_err(>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(>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, ); 754 if (ret < 0) { 755 dev_err(>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)
Re: [PATCH 2/6] mfd: da9063: Replace model with type
On 05/23/2018 01:55 PM, Geert Uytterhoeven wrote: > On Wed, May 23, 2018 at 1:42 PM, Marek Vasutwrote: >> The model number stored in the struct da9063 is the same for all >> variants of the da9063 since it is the chip ID, which is always >> the same. Replace that with a separate identifier instead, which >> allows us to discern the DA9063 variants by setting the type >> based on either DT match or otherwise. >> >> Signed-off-by: Marek Vasut > > Reviewed-by: Geert Uytterhoeven > >> --- a/drivers/mfd/da9063-i2c.c >> +++ b/drivers/mfd/da9063-i2c.c >> @@ -248,6 +248,7 @@ static int da9063_i2c_probe(struct i2c_client *i2c, >> i2c_set_clientdata(i2c, da9063); >> da9063->dev = >dev; >> da9063->chip_irq = i2c->irq; >> + da9063->type = (enum da9063_type)id->driver_data; > > Nit: I think this cast (from unsigned long) is not needed. Dropped -- Best regards, Marek Vasut
Re: [PATCH 2/6] mfd: da9063: Replace model with type
On Wed, May 23, 2018 at 1:42 PM, Marek Vasutwrote: > The model number stored in the struct da9063 is the same for all > variants of the da9063 since it is the chip ID, which is always > the same. Replace that with a separate identifier instead, which > allows us to discern the DA9063 variants by setting the type > based on either DT match or otherwise. > > Signed-off-by: Marek Vasut Reviewed-by: Geert Uytterhoeven > --- a/drivers/mfd/da9063-i2c.c > +++ b/drivers/mfd/da9063-i2c.c > @@ -248,6 +248,7 @@ static int da9063_i2c_probe(struct i2c_client *i2c, > i2c_set_clientdata(i2c, da9063); > da9063->dev = >dev; > da9063->chip_irq = i2c->irq; > + da9063->type = (enum da9063_type)id->driver_data; Nit: I think this cast (from unsigned long) is not needed. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Re: [PATCH 2/6] mfd: da9063: Replace model with type
On Wed, May 23, 2018 at 01:42:26PM +0200, Marek Vasut wrote: > The model number stored in the struct da9063 is the same for all > variants of the da9063 since it is the chip ID, which is always > the same. Replace that with a separate identifier instead, which Acked-by: Mark Brownsignature.asc Description: PGP signature
[PATCH 2/6] mfd: da9063: Replace model with type
The model number stored in the struct da9063 is the same for all variants of the da9063 since it is the chip ID, which is always the same. Replace that with a separate identifier instead, which allows us to discern the DA9063 variants by setting the type based on either DT match or otherwise. Signed-off-by: Marek VasutCc: Geert Uytterhoeven Cc: Lee Jones Cc: Mark Brown Cc: Steve Twiss Cc: Wolfram Sang Cc: linux-renesas-soc@vger.kernel.org --- drivers/mfd/da9063-core.c| 1 - drivers/mfd/da9063-i2c.c | 5 +++-- drivers/regulator/da9063-regulator.c | 6 +++--- include/linux/mfd/da9063/core.h | 6 +- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/mfd/da9063-core.c b/drivers/mfd/da9063-core.c index 00b3caee4e21..7360b76b4f72 100644 --- a/drivers/mfd/da9063-core.c +++ b/drivers/mfd/da9063-core.c @@ -215,7 +215,6 @@ int da9063_device_init(struct da9063 *da9063, unsigned int irq) return -ENODEV; } - da9063->model = model; da9063->variant_code = variant_code; ret = da9063_irq_init(da9063); diff --git a/drivers/mfd/da9063-i2c.c b/drivers/mfd/da9063-i2c.c index 7f84030c8d53..5544ce8e3363 100644 --- a/drivers/mfd/da9063-i2c.c +++ b/drivers/mfd/da9063-i2c.c @@ -236,7 +236,7 @@ static const struct of_device_id da9063_dt_ids[] = { }; MODULE_DEVICE_TABLE(of, da9063_dt_ids); static int da9063_i2c_probe(struct i2c_client *i2c, - const struct i2c_device_id *id) + const struct i2c_device_id *id) { struct da9063 *da9063; int ret; @@ -248,6 +248,7 @@ static int da9063_i2c_probe(struct i2c_client *i2c, i2c_set_clientdata(i2c, da9063); da9063->dev = >dev; da9063->chip_irq = i2c->irq; + da9063->type = (enum da9063_type)id->driver_data; if (da9063->variant_code == PMIC_DA9063_AD) { da9063_regmap_config.rd_table = _ad_readable_table; @@ -280,7 +281,7 @@ static int da9063_i2c_remove(struct i2c_client *i2c) } static const struct i2c_device_id da9063_i2c_id[] = { - { "da9063", PMIC_CHIP_ID_DA9063 }, + { "da9063", PMIC_TYPE_DA9063 }, {}, }; MODULE_DEVICE_TABLE(i2c, da9063_i2c_id); diff --git a/drivers/regulator/da9063-regulator.c b/drivers/regulator/da9063-regulator.c index 87c884ae0064..9b5c28392ae6 100644 --- a/drivers/regulator/da9063-regulator.c +++ b/drivers/regulator/da9063-regulator.c @@ -98,7 +98,7 @@ struct da9063_regulator_info { struct da9063_dev_model { const struct da9063_regulator_info *regulator_info; unsignedn_regulators; - unsigneddev_model; + enum da9063_typetype; }; /* Single regulator settings */ @@ -585,7 +585,7 @@ static struct da9063_dev_model regulators_models[] = { { .regulator_info = da9063_regulator_info, .n_regulators = ARRAY_SIZE(da9063_regulator_info), - .dev_model = PMIC_CHIP_ID_DA9063, + .type = PMIC_TYPE_DA9063, }, { } }; @@ -741,7 +741,7 @@ static int da9063_regulator_probe(struct platform_device *pdev) /* Find regulators set for particular device model */ for (model = regulators_models; model->regulator_info; model++) { - if (model->dev_model == da9063->model) + if (model->dev_model == da9063->type) break; } if (!model->regulator_info) { diff --git a/include/linux/mfd/da9063/core.h b/include/linux/mfd/da9063/core.h index 664f650d0086..eb234582dcb2 100644 --- a/include/linux/mfd/da9063/core.h +++ b/include/linux/mfd/da9063/core.h @@ -31,6 +31,10 @@ #define PMIC_CHIP_ID_DA90630x61 +enum da9063_type { + PMIC_TYPE_DA9063 = 0, +}; + enum da9063_variant_codes { PMIC_DA9063_AD = 0x3, PMIC_DA9063_BB = 0x5, @@ -76,7 +80,7 @@ enum da9063_irqs { struct da9063 { /* Device */ struct device *dev; - unsigned short model; + enum da9063_type type; unsigned char variant_code; unsigned intflags; -- 2.16.2