diff mbox

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

Message ID 20180523114230.10109-2-marek.vasut+renesas@gmail.com (mailing list archive)
State Superseded
Delegated to: Geert Uytterhoeven
Headers show

Commit Message

Marek Vasut May 23, 2018, 11:42 a.m. UTC
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 <marek.vasut+renesas@gmail.com>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Mark Brown <broonie@kernel.org>
Cc: Steve Twiss <stwiss.opensource@diasemi.com>
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>
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(-)

Comments

Mark Brown May 23, 2018, 11:50 a.m. UTC | #1
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 Brown <broonie@kernel.org>
Geert Uytterhoeven May 23, 2018, 11:55 a.m. UTC | #2
On Wed, May 23, 2018 at 1:42 PM, Marek Vasut <marek.vasut@gmail.com> 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
> allows us to discern the DA9063 variants by setting the type
> based on either DT match or otherwise.
>
> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

> --- 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 = &i2c->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
Marek Vasut May 23, 2018, 12:15 p.m. UTC | #3
On 05/23/2018 01:55 PM, Geert Uytterhoeven wrote:
> On Wed, May 23, 2018 at 1:42 PM, Marek Vasut <marek.vasut@gmail.com> 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
>> allows us to discern the DA9063 variants by setting the type
>> based on either DT match or otherwise.
>>
>> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> 
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> 
>> --- 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 = &i2c->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
kernel test robot May 26, 2018, 9:16 a.m. UTC | #4
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
Marek Vasut May 26, 2018, 9:58 a.m. UTC | #5
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 ?
kernel test robot May 26, 2018, 11:01 a.m. UTC | #6
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								&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
Ye Xiaolong May 30, 2018, 5:21 a.m. UTC | #7
Hi, Marek

On 05/26, Marek Vasut wrote:
>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 ?

It was tested with the whole patch series as you can see in https://github.com/0day-ci/linux/commits/Marek-Vasut/mfd-da9063-Rename-PMIC_DA9063-to-PMIC_CHIP_ID_DA9063/20180526-162613.


Thanks,
Xiaolong
>
>-- 
>Best regards,
>Marek Vasut
>
Marek Vasut May 30, 2018, 10:45 a.m. UTC | #8
On 05/30/2018 07:21 AM, Ye Xiaolong wrote:
> Hi, Marek
> 
> On 05/26, Marek Vasut wrote:
>> 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 ?
> 
> It was tested with the whole patch series as you can see in https://github.com/0day-ci/linux/commits/Marek-Vasut/mfd-da9063-Rename-PMIC_DA9063-to-PMIC_CHIP_ID_DA9063/20180526-162613.

Ha, I see the problem. Thanks for confirming it's checked with the whole
series.
diff mbox

Patch

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 = &i2c->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 = &da9063_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;
 	unsigned				n_regulators;
-	unsigned				dev_model;
+	enum da9063_type			type;
 };
 
 /* 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_DA9063		0x61
 
+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 int	flags;