Re: [PATCH v2 1/7] regulator: Support ROHM BD71847 power management IC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Matti,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on regulator/for-next]
[also build test WARNING on next-20180913]
[cannot apply to v4.19-rc3]
[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/Matti-Vaittinen/regulator-mfd-dt_bindings-bd718x7-Support-ROHM-bd71847/20180914-000129
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next
config: x86_64-randconfig-x010-201836 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   drivers/mfd/rohm-bd718x7.c: In function 'bd71837_i2c_probe':
>> drivers/mfd/rohm-bd718x7.c:100:23: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     bd71837->chip_type = (unsigned int)of_device_get_match_data(&i2c->dev);
                          ^
   Cyclomatic Complexity 1 include/linux/err.h:PTR_ERR
   Cyclomatic Complexity 1 include/linux/device.h:dev_set_drvdata
   Cyclomatic Complexity 1 drivers/mfd/rohm-bd718x7.c:bd71837_i2c_init
   Cyclomatic Complexity 1 include/linux/device.h:devm_kzalloc
   Cyclomatic Complexity 1 include/linux/err.h:IS_ERR
   Cyclomatic Complexity 9 drivers/mfd/rohm-bd718x7.c:bd71837_i2c_probe
   Cyclomatic Complexity 1 drivers/mfd/rohm-bd718x7.c:bd71837_i2c_exit

vim +100 drivers/mfd/rohm-bd718x7.c

    82	
    83	static int bd71837_i2c_probe(struct i2c_client *i2c,
    84				    const struct i2c_device_id *id)
    85	{
    86		struct bd71837 *bd71837;
    87		int ret;
    88	
    89		if (!i2c->irq) {
    90			dev_err(&i2c->dev, "No IRQ configured\n");
    91			return -EINVAL;
    92		}
    93	
    94		bd71837 = devm_kzalloc(&i2c->dev, sizeof(struct bd71837), GFP_KERNEL);
    95	
    96		if (!bd71837)
    97			return -ENOMEM;
    98	
    99		bd71837->chip_irq = i2c->irq;
 > 100		bd71837->chip_type = (unsigned int)of_device_get_match_data(&i2c->dev);
   101		bd71837->dev = &i2c->dev;
   102		dev_set_drvdata(&i2c->dev, bd71837);
   103	
   104		bd71837->regmap = devm_regmap_init_i2c(i2c, &bd71837_regmap_config);
   105		if (IS_ERR(bd71837->regmap)) {
   106			dev_err(&i2c->dev, "regmap initialization failed\n");
   107			return PTR_ERR(bd71837->regmap);
   108		}
   109	
   110		ret = devm_regmap_add_irq_chip(&i2c->dev, bd71837->regmap,
   111					       bd71837->chip_irq, IRQF_ONESHOT, 0,
   112					       &bd71837_irq_chip, &bd71837->irq_data);
   113		if (ret) {
   114			dev_err(&i2c->dev, "Failed to add irq_chip\n");
   115			return ret;
   116		}
   117	
   118		/* Configure short press to 10 milliseconds */
   119		ret = regmap_update_bits(bd71837->regmap,
   120					 BD718XX_REG_PWRONCONFIG0,
   121					 BD718XX_PWRBTN_PRESS_DURATION_MASK,
   122					 BD718XX_PWRBTN_SHORT_PRESS_10MS);
   123		if (ret) {
   124			dev_err(&i2c->dev,
   125				"Failed to configure button short press timeout\n");
   126			return ret;
   127		}
   128	
   129		/* Configure long press to 10 seconds */
   130		ret = regmap_update_bits(bd71837->regmap,
   131					 BD718XX_REG_PWRONCONFIG1,
   132					 BD718XX_PWRBTN_PRESS_DURATION_MASK,
   133					 BD718XX_PWRBTN_LONG_PRESS_10S);
   134	
   135		if (ret) {
   136			dev_err(&i2c->dev,
   137				"Failed to configure button long press timeout\n");
   138			return ret;
   139		}
   140	
   141		ret = regmap_irq_get_virq(bd71837->irq_data, BD71837_INT_PWRBTN_S);
   142	
   143		if (ret < 0) {
   144			dev_err(&i2c->dev, "Failed to get the IRQ\n");
   145			return ret;
   146		}
   147	
   148		button.irq = ret;
   149	
   150		ret = devm_mfd_add_devices(bd71837->dev, PLATFORM_DEVID_AUTO,
   151					   bd71837_mfd_cells,
   152					   ARRAY_SIZE(bd71837_mfd_cells), NULL, 0,
   153					   regmap_irq_get_domain(bd71837->irq_data));
   154		if (ret)
   155			dev_err(&i2c->dev, "Failed to create subdevices\n");
   156	
   157		return ret;
   158	}
   159	

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

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux