Re: [PATCH v2] i2c:amd I2C Driver based on PCI Interface for upcoming, platform

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

 



Hi Nehal-bakulchandra,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on wsa/i2c/for-next]
[also build test WARNING on v4.18 next-20180822]
[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/Shah-Nehal-bakulchandra/i2c-amd-I2C-Driver-based-on-PCI-Interface-for-upcoming-platform/20180823-232746
base:   https://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git i2c/for-next
config: i386-allmodconfig (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=i386 

All warnings (new ones prefixed by >>):

   In file included from include/linux/printk.h:332:0,
                    from include/linux/kernel.h:14,
                    from include/linux/list.h:9,
                    from include/linux/wait.h:7,
                    from include/linux/wait_bit.h:8,
                    from include/linux/fs.h:6,
                    from include/linux/debugfs.h:15,
                    from drivers/i2c/busses/i2c-amd-pci-mp2.c:48:
   drivers/i2c/busses/i2c-amd-pci-mp2.c: In function 'amd_mp2_read':
>> drivers/i2c/busses/i2c-amd-pci-mp2.c:121:4: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
       (u64)privdata->eventval.buf);
       ^
   include/linux/dynamic_debug.h:136:9: note: in definition of macro 'dynamic_dev_dbg'
          ##__VA_ARGS__);  \
            ^~~~~~~~~~~
>> drivers/i2c/busses/i2c-amd-pci-mp2.c:120:3: note: in expansion of macro 'dev_dbg'
      dev_dbg(ndev_dev(privdata), "%s buf: %llx\n", __func__,
      ^~~~~~~
   In file included from include/linux/list.h:9:0,
                    from include/linux/wait.h:7,
                    from include/linux/wait_bit.h:8,
                    from include/linux/fs.h:6,
                    from include/linux/debugfs.h:15,
                    from drivers/i2c/busses/i2c-amd-pci-mp2.c:48:
   drivers/i2c/busses/i2c-amd-pci-mp2.c: In function 'amd_mp2_debugfs_read':
   include/linux/kernel.h:812:29: warning: comparison of distinct pointer types lacks a cast
      (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
                                ^
   include/linux/kernel.h:826:4: note: in expansion of macro '__typecheck'
      (__typecheck(x, y) && __no_side_effects(x, y))
       ^~~~~~~~~~~
   include/linux/kernel.h:836:24: note: in expansion of macro '__safe_cmp'
     __builtin_choose_expr(__safe_cmp(x, y), \
                           ^~~~~~~~~~
   include/linux/kernel.h:845:19: note: in expansion of macro '__careful_cmp'
    #define min(x, y) __careful_cmp(x, y, <)
                      ^~~~~~~~~~~~~
>> drivers/i2c/busses/i2c-amd-pci-mp2.c:325:13: note: in expansion of macro 'min'
     buf_size = min(count, 0x800ul);
                ^~~
   In file included from include/linux/printk.h:332:0,
                    from include/linux/kernel.h:14,
                    from include/linux/list.h:9,
                    from include/linux/wait.h:7,
                    from include/linux/wait_bit.h:8,
                    from include/linux/fs.h:6,
                    from include/linux/debugfs.h:15,
                    from drivers/i2c/busses/i2c-amd-pci-mp2.c:48:
   drivers/i2c/busses/i2c-amd-pci-mp2.c: In function 'amd_mp2_pci_init':
>> drivers/i2c/busses/i2c-amd-pci-mp2.c:473:30: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 4 has type 'resource_size_t {aka unsigned int}' [-Wformat=]
     dev_dbg(ndev_dev(privdata), "Base addr:%llx size:%llx\n", base, size);
                                 ^
   include/linux/dynamic_debug.h:135:39: note: in definition of macro 'dynamic_dev_dbg'
      __dynamic_dev_dbg(&descriptor, dev, fmt, \
                                          ^~~
   drivers/i2c/busses/i2c-amd-pci-mp2.c:473:2: note: in expansion of macro 'dev_dbg'
     dev_dbg(ndev_dev(privdata), "Base addr:%llx size:%llx\n", base, size);
     ^~~~~~~
   drivers/i2c/busses/i2c-amd-pci-mp2.c:473:30: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 5 has type 'resource_size_t {aka unsigned int}' [-Wformat=]
     dev_dbg(ndev_dev(privdata), "Base addr:%llx size:%llx\n", base, size);
                                 ^
   include/linux/dynamic_debug.h:135:39: note: in definition of macro 'dynamic_dev_dbg'
      __dynamic_dev_dbg(&descriptor, dev, fmt, \
                                          ^~~
   drivers/i2c/busses/i2c-amd-pci-mp2.c:473:2: note: in expansion of macro 'dev_dbg'
     dev_dbg(ndev_dev(privdata), "Base addr:%llx size:%llx\n", base, size);
     ^~~~~~~
--
   In file included from include/linux/kernel.h:14:0,
                    from drivers/i2c/busses/i2c-amd-platdrv.c:50:
   drivers/i2c/busses/i2c-amd-platdrv.c: In function 'i2c_amd_read_completion':
>> drivers/i2c/busses/i2c-amd-platdrv.c:97:5: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
        (u64)commond->read_cfg.buf,
        ^
   include/linux/printk.h:323:35: note: in definition of macro 'pr_devel'
     printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
                                      ^~~~~~~~~~~

vim +121 drivers/i2c/busses/i2c-amd-pci-mp2.c

  > 48	#include <linux/debugfs.h>
    49	#include <linux/interrupt.h>
    50	#include <linux/module.h>
    51	#include <linux/pci.h>
    52	#include <linux/slab.h>
    53	
    54	#include "i2c-amd-pci-mp2.h"
    55	
    56	#define DRIVER_NAME	"pcie_mp2_amd"
    57	#define DRIVER_DESC	"AMD(R) PCI-E MP2 Communication Driver"
    58	#define DRIVER_VER	"1.0"
    59	
    60	MODULE_DESCRIPTION(DRIVER_DESC);
    61	MODULE_VERSION(DRIVER_VER);
    62	MODULE_LICENSE("Dual BSD/GPL");
    63	MODULE_AUTHOR("Shyam Sundar S K <Shyam-sundar.S-k@xxxxxxx>");
    64	
    65	static const struct file_operations amd_mp2_debugfs_info;
    66	static struct dentry *debugfs_dir;
    67	
    68	int amd_mp2_connect(struct pci_dev *dev,
    69			    struct i2c_connect_config connect_cfg)
    70	{
    71		struct amd_mp2_dev *privdata = pci_get_drvdata(dev);
    72		union i2c_cmd_base i2c_cmd_base;
    73		unsigned  long  flags;
    74	
    75		raw_spin_lock_irqsave(&privdata->lock, flags);
    76		dev_dbg(ndev_dev(privdata), "%s addr: %x id: %d\n", __func__,
    77			connect_cfg.dev_addr, connect_cfg.bus_id);
    78	
    79		i2c_cmd_base.ul = 0;
    80		i2c_cmd_base.s.i2c_cmd = i2c_enable;
    81		i2c_cmd_base.s.bus_id = connect_cfg.bus_id;
    82		i2c_cmd_base.s.i2c_speed = connect_cfg.i2c_speed;
    83	
    84		if (i2c_cmd_base.s.bus_id == i2c_bus_1) {
    85			writel(i2c_cmd_base.ul, privdata->mmio + AMD_C2P_MSG1);
    86		} else if (i2c_cmd_base.s.bus_id == i2c_bus_0) {
    87			writel(i2c_cmd_base.ul, privdata->mmio + AMD_C2P_MSG0);
    88		} else {
    89			dev_err(ndev_dev(privdata), "%s Invalid bus id\n", __func__);
    90			return -EINVAL;
    91		}
    92		raw_spin_unlock_irqrestore(&privdata->lock, flags);
    93		return 0;
    94	}
    95	EXPORT_SYMBOL_GPL(amd_mp2_connect);
    96	
    97	int amd_mp2_read(struct pci_dev *dev, struct i2c_read_config read_cfg)
    98	{
    99		struct amd_mp2_dev *privdata = pci_get_drvdata(dev);
   100		union i2c_cmd_base i2c_cmd_base;
   101	
   102		dev_dbg(ndev_dev(privdata), "%s addr: %x id: %d\n", __func__,
   103			read_cfg.dev_addr, read_cfg.bus_id);
   104	
   105		privdata->requested = true;
   106		i2c_cmd_base.ul = 0;
   107		i2c_cmd_base.s.i2c_cmd = i2c_read;
   108		i2c_cmd_base.s.dev_addr = read_cfg.dev_addr;
   109		i2c_cmd_base.s.length = read_cfg.length;
   110		i2c_cmd_base.s.bus_id = read_cfg.bus_id;
   111	
   112		if (read_cfg.length <= 32) {
   113			i2c_cmd_base.s.mem_type = use_c2pmsg;
   114			privdata->eventval.buf = (u32 *)read_cfg.buf;
   115			if (!privdata->eventval.buf) {
   116				dev_err(ndev_dev(privdata), "%s no mem for buf received\n",
   117					__func__);
   118				return -ENOMEM;
   119			}
 > 120			dev_dbg(ndev_dev(privdata), "%s buf: %llx\n", __func__,
 > 121				(u64)privdata->eventval.buf);
   122		} else {
   123			i2c_cmd_base.s.mem_type = use_dram;
   124			privdata->read_cfg.phy_addr = read_cfg.phy_addr;
   125			privdata->read_cfg.buf = read_cfg.buf;
   126			write64((u64)privdata->read_cfg.phy_addr,
   127				privdata->mmio + AMD_C2P_MSG2);
   128		}
   129	
   130		switch (read_cfg.i2c_speed) {
   131		case 0:
   132			i2c_cmd_base.s.i2c_speed = speed100k;
   133			break;
   134		case 1:
   135			i2c_cmd_base.s.i2c_speed = speed400k;
   136			break;
   137		case 2:
   138			i2c_cmd_base.s.i2c_speed = speed1000k;
   139			break;
   140		case 3:
   141			i2c_cmd_base.s.i2c_speed = speed1400k;
   142			break;
   143		case 4:
   144			i2c_cmd_base.s.i2c_speed = speed3400k;
   145			break;
   146		default:
   147			dev_err(ndev_dev(privdata), "Invalid ConnectionSpeed\n");
   148		}
   149	
   150		if (i2c_cmd_base.s.bus_id == i2c_bus_1) {
   151			writel(i2c_cmd_base.ul, privdata->mmio + AMD_C2P_MSG1);
   152		} else if (i2c_cmd_base.s.bus_id == i2c_bus_0) {
   153			writel(i2c_cmd_base.ul, privdata->mmio + AMD_C2P_MSG0);
   154		} else {
   155			dev_err(ndev_dev(privdata), "%s Invalid bus id\n", __func__);
   156			return -EINVAL;
   157		}
   158	
   159		return 0;
   160	}
   161	EXPORT_SYMBOL_GPL(amd_mp2_read);
   162	

---
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]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux