lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202305221045.K3Bx6bts-lkp@intel.com>
Date:   Mon, 22 May 2023 11:03:09 +0800
From:   kernel test robot <lkp@...el.com>
To:     Shenghao Ding <13916275206@....com>, broonie@...nel.org,
        devicetree@...r.kernel.org, krzysztof.kozlowski+dt@...aro.org,
        robh+dt@...nel.org, lgirdwood@...il.com, perex@...ex.cz,
        pierre-louis.bossart@...ux.intel.com
Cc:     oe-kbuild-all@...ts.linux.dev, kevin-lu@...com,
        shenghao-ding@...com, alsa-devel@...a-project.org,
        linux-kernel@...r.kernel.org, x1077012@...com, peeyush@...com,
        navada@...com, gentuser@...il.com, Ryan_Chu@...tron.com,
        Sam_Wu@...tron.com, Shenghao Ding <13916275206@....com>
Subject: Re: [PATCH v3 3/5] ASoC: tas2781: Add tas2781 driver

Hi Shenghao,

kernel test robot noticed the following build errors:

[auto build test ERROR on broonie-sound/for-next]
[also build test ERROR on tiwai-sound/for-next tiwai-sound/for-linus robh/for-next linus/master v6.4-rc3 next-20230519]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Shenghao-Ding/ASoC-tas2781-firmware-lib/20230519-160451
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
patch link:    https://lore.kernel.org/r/20230519080211.20205-1-13916275206%40139.com
patch subject: [PATCH v3 3/5] ASoC: tas2781: Add tas2781 driver
config: nios2-randconfig-r035-20230522
compiler: nios2-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/1138e1878d682a13d5ba424d90bb89dd7a05b637
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Shenghao-Ding/ASoC-tas2781-firmware-lib/20230519-160451
        git checkout 1138e1878d682a13d5ba424d90bb89dd7a05b637
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=nios2 olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=nios2 SHELL=/bin/bash drivers/base/regmap/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202305221045.K3Bx6bts-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/base/regmap/regmap-i2c.c: In function 'regmap_smbus_byte_reg_read':
>> drivers/base/regmap/regmap-i2c.c:25:15: error: implicit declaration of function 'i2c_smbus_read_byte_data' [-Werror=implicit-function-declaration]
      25 |         ret = i2c_smbus_read_byte_data(i2c, reg);
         |               ^~~~~~~~~~~~~~~~~~~~~~~~
   drivers/base/regmap/regmap-i2c.c: In function 'regmap_smbus_byte_reg_write':
>> drivers/base/regmap/regmap-i2c.c:43:16: error: implicit declaration of function 'i2c_smbus_write_byte_data' [-Werror=implicit-function-declaration]
      43 |         return i2c_smbus_write_byte_data(i2c, reg, val);
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/base/regmap/regmap-i2c.c: In function 'regmap_smbus_word_reg_read':
>> drivers/base/regmap/regmap-i2c.c:61:15: error: implicit declaration of function 'i2c_smbus_read_word_data' [-Werror=implicit-function-declaration]
      61 |         ret = i2c_smbus_read_word_data(i2c, reg);
         |               ^~~~~~~~~~~~~~~~~~~~~~~~
   drivers/base/regmap/regmap-i2c.c: In function 'regmap_smbus_word_reg_write':
>> drivers/base/regmap/regmap-i2c.c:79:16: error: implicit declaration of function 'i2c_smbus_write_word_data' [-Werror=implicit-function-declaration]
      79 |         return i2c_smbus_write_word_data(i2c, reg, val);
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/base/regmap/regmap-i2c.c: In function 'regmap_smbus_word_read_swapped':
>> drivers/base/regmap/regmap-i2c.c:97:15: error: implicit declaration of function 'i2c_smbus_read_word_swapped' [-Werror=implicit-function-declaration]
      97 |         ret = i2c_smbus_read_word_swapped(i2c, reg);
         |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/base/regmap/regmap-i2c.c: In function 'regmap_smbus_word_write_swapped':
>> drivers/base/regmap/regmap-i2c.c:115:16: error: implicit declaration of function 'i2c_smbus_write_word_swapped' [-Werror=implicit-function-declaration]
     115 |         return i2c_smbus_write_word_swapped(i2c, reg, val);
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/base/regmap/regmap-i2c.c: In function 'regmap_i2c_write':
>> drivers/base/regmap/regmap-i2c.c:129:15: error: implicit declaration of function 'i2c_master_send' [-Werror=implicit-function-declaration]
     129 |         ret = i2c_master_send(i2c, data, count);
         |               ^~~~~~~~~~~~~~~
   drivers/base/regmap/regmap-i2c.c: In function 'regmap_i2c_gather_write':
>> drivers/base/regmap/regmap-i2c.c:150:14: error: implicit declaration of function 'i2c_check_functionality' [-Werror=implicit-function-declaration]
     150 |         if (!i2c_check_functionality(i2c->adapter, I2C_FUNC_NOSTART))
         |              ^~~~~~~~~~~~~~~~~~~~~~~
>> drivers/base/regmap/regmap-i2c.c:163:15: error: implicit declaration of function 'i2c_transfer' [-Werror=implicit-function-declaration]
     163 |         ret = i2c_transfer(i2c->adapter, xfer, 2);
         |               ^~~~~~~~~~~~
   drivers/base/regmap/regmap-i2c.c: In function 'regmap_i2c_smbus_i2c_write':
>> drivers/base/regmap/regmap-i2c.c:218:16: error: implicit declaration of function 'i2c_smbus_write_i2c_block_data' [-Werror=implicit-function-declaration]
     218 |         return i2c_smbus_write_i2c_block_data(i2c, ((u8 *)data)[0], count,
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/base/regmap/regmap-i2c.c: In function 'regmap_i2c_smbus_i2c_read':
>> drivers/base/regmap/regmap-i2c.c:233:15: error: implicit declaration of function 'i2c_smbus_read_i2c_block_data' [-Werror=implicit-function-declaration]
     233 |         ret = i2c_smbus_read_i2c_block_data(i2c, ((u8 *)reg)[0], val_size, val);
         |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/base/regmap/regmap-i2c.c: In function 'regmap_i2c_smbus_i2c_read_reg16':
>> drivers/base/regmap/regmap-i2c.c:282:23: error: implicit declaration of function 'i2c_smbus_read_byte' [-Werror=implicit-function-declaration]
     282 |                 ret = i2c_smbus_read_byte(i2c);
         |                       ^~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors

Kconfig warnings: (for reference only)
   WARNING: unmet direct dependencies detected for REGMAP_I2C
   Depends on [n]: I2C [=n]
   Selected by [y]:
   - SND_SOC_TAS2781_COMLIB [=y] && SOUND [=y] && !UML && SND [=y] && SND_SOC [=y]


vim +/i2c_smbus_read_byte_data +25 drivers/base/regmap/regmap-i2c.c

b42261078a91db Boris Brezillon 2014-04-21   14  
b42261078a91db Boris Brezillon 2014-04-21   15  static int regmap_smbus_byte_reg_read(void *context, unsigned int reg,
b42261078a91db Boris Brezillon 2014-04-21   16  				      unsigned int *val)
b42261078a91db Boris Brezillon 2014-04-21   17  {
b42261078a91db Boris Brezillon 2014-04-21   18  	struct device *dev = context;
b42261078a91db Boris Brezillon 2014-04-21   19  	struct i2c_client *i2c = to_i2c_client(dev);
b42261078a91db Boris Brezillon 2014-04-21   20  	int ret;
b42261078a91db Boris Brezillon 2014-04-21   21  
b42261078a91db Boris Brezillon 2014-04-21   22  	if (reg > 0xff)
b42261078a91db Boris Brezillon 2014-04-21   23  		return -EINVAL;
b42261078a91db Boris Brezillon 2014-04-21   24  
b42261078a91db Boris Brezillon 2014-04-21  @25  	ret = i2c_smbus_read_byte_data(i2c, reg);
b42261078a91db Boris Brezillon 2014-04-21   26  	if (ret < 0)
b42261078a91db Boris Brezillon 2014-04-21   27  		return ret;
b42261078a91db Boris Brezillon 2014-04-21   28  
b42261078a91db Boris Brezillon 2014-04-21   29  	*val = ret;
b42261078a91db Boris Brezillon 2014-04-21   30  
b42261078a91db Boris Brezillon 2014-04-21   31  	return 0;
b42261078a91db Boris Brezillon 2014-04-21   32  }
b42261078a91db Boris Brezillon 2014-04-21   33  
b42261078a91db Boris Brezillon 2014-04-21   34  static int regmap_smbus_byte_reg_write(void *context, unsigned int reg,
b42261078a91db Boris Brezillon 2014-04-21   35  				       unsigned int val)
b42261078a91db Boris Brezillon 2014-04-21   36  {
b42261078a91db Boris Brezillon 2014-04-21   37  	struct device *dev = context;
b42261078a91db Boris Brezillon 2014-04-21   38  	struct i2c_client *i2c = to_i2c_client(dev);
b42261078a91db Boris Brezillon 2014-04-21   39  
b42261078a91db Boris Brezillon 2014-04-21   40  	if (val > 0xff || reg > 0xff)
b42261078a91db Boris Brezillon 2014-04-21   41  		return -EINVAL;
b42261078a91db Boris Brezillon 2014-04-21   42  
b42261078a91db Boris Brezillon 2014-04-21  @43  	return i2c_smbus_write_byte_data(i2c, reg, val);
b42261078a91db Boris Brezillon 2014-04-21   44  }
b42261078a91db Boris Brezillon 2014-04-21   45  
14e01b5f335881 Michał Mirosław 2020-01-04   46  static const struct regmap_bus regmap_smbus_byte = {
b42261078a91db Boris Brezillon 2014-04-21   47  	.reg_write = regmap_smbus_byte_reg_write,
b42261078a91db Boris Brezillon 2014-04-21   48  	.reg_read = regmap_smbus_byte_reg_read,
b42261078a91db Boris Brezillon 2014-04-21   49  };
b42261078a91db Boris Brezillon 2014-04-21   50  
b42261078a91db Boris Brezillon 2014-04-21   51  static int regmap_smbus_word_reg_read(void *context, unsigned int reg,
b42261078a91db Boris Brezillon 2014-04-21   52  				      unsigned int *val)
b42261078a91db Boris Brezillon 2014-04-21   53  {
b42261078a91db Boris Brezillon 2014-04-21   54  	struct device *dev = context;
b42261078a91db Boris Brezillon 2014-04-21   55  	struct i2c_client *i2c = to_i2c_client(dev);
b42261078a91db Boris Brezillon 2014-04-21   56  	int ret;
b42261078a91db Boris Brezillon 2014-04-21   57  
b42261078a91db Boris Brezillon 2014-04-21   58  	if (reg > 0xff)
b42261078a91db Boris Brezillon 2014-04-21   59  		return -EINVAL;
b42261078a91db Boris Brezillon 2014-04-21   60  
b42261078a91db Boris Brezillon 2014-04-21  @61  	ret = i2c_smbus_read_word_data(i2c, reg);
b42261078a91db Boris Brezillon 2014-04-21   62  	if (ret < 0)
b42261078a91db Boris Brezillon 2014-04-21   63  		return ret;
b42261078a91db Boris Brezillon 2014-04-21   64  
b42261078a91db Boris Brezillon 2014-04-21   65  	*val = ret;
b42261078a91db Boris Brezillon 2014-04-21   66  
b42261078a91db Boris Brezillon 2014-04-21   67  	return 0;
b42261078a91db Boris Brezillon 2014-04-21   68  }
b42261078a91db Boris Brezillon 2014-04-21   69  
b42261078a91db Boris Brezillon 2014-04-21   70  static int regmap_smbus_word_reg_write(void *context, unsigned int reg,
b42261078a91db Boris Brezillon 2014-04-21   71  				       unsigned int val)
b42261078a91db Boris Brezillon 2014-04-21   72  {
b42261078a91db Boris Brezillon 2014-04-21   73  	struct device *dev = context;
b42261078a91db Boris Brezillon 2014-04-21   74  	struct i2c_client *i2c = to_i2c_client(dev);
b42261078a91db Boris Brezillon 2014-04-21   75  
b42261078a91db Boris Brezillon 2014-04-21   76  	if (val > 0xffff || reg > 0xff)
b42261078a91db Boris Brezillon 2014-04-21   77  		return -EINVAL;
b42261078a91db Boris Brezillon 2014-04-21   78  
b42261078a91db Boris Brezillon 2014-04-21  @79  	return i2c_smbus_write_word_data(i2c, reg, val);
b42261078a91db Boris Brezillon 2014-04-21   80  }
b42261078a91db Boris Brezillon 2014-04-21   81  
14e01b5f335881 Michał Mirosław 2020-01-04   82  static const struct regmap_bus regmap_smbus_word = {
b42261078a91db Boris Brezillon 2014-04-21   83  	.reg_write = regmap_smbus_word_reg_write,
b42261078a91db Boris Brezillon 2014-04-21   84  	.reg_read = regmap_smbus_word_reg_read,
b42261078a91db Boris Brezillon 2014-04-21   85  };
b42261078a91db Boris Brezillon 2014-04-21   86  
5892ded23c8e9e Guenter Roeck   2015-02-03   87  static int regmap_smbus_word_read_swapped(void *context, unsigned int reg,
5892ded23c8e9e Guenter Roeck   2015-02-03   88  					  unsigned int *val)
5892ded23c8e9e Guenter Roeck   2015-02-03   89  {
5892ded23c8e9e Guenter Roeck   2015-02-03   90  	struct device *dev = context;
5892ded23c8e9e Guenter Roeck   2015-02-03   91  	struct i2c_client *i2c = to_i2c_client(dev);
5892ded23c8e9e Guenter Roeck   2015-02-03   92  	int ret;
5892ded23c8e9e Guenter Roeck   2015-02-03   93  
5892ded23c8e9e Guenter Roeck   2015-02-03   94  	if (reg > 0xff)
5892ded23c8e9e Guenter Roeck   2015-02-03   95  		return -EINVAL;
5892ded23c8e9e Guenter Roeck   2015-02-03   96  
5892ded23c8e9e Guenter Roeck   2015-02-03  @97  	ret = i2c_smbus_read_word_swapped(i2c, reg);
5892ded23c8e9e Guenter Roeck   2015-02-03   98  	if (ret < 0)
5892ded23c8e9e Guenter Roeck   2015-02-03   99  		return ret;
5892ded23c8e9e Guenter Roeck   2015-02-03  100  
5892ded23c8e9e Guenter Roeck   2015-02-03  101  	*val = ret;
5892ded23c8e9e Guenter Roeck   2015-02-03  102  
5892ded23c8e9e Guenter Roeck   2015-02-03  103  	return 0;
5892ded23c8e9e Guenter Roeck   2015-02-03  104  }
5892ded23c8e9e Guenter Roeck   2015-02-03  105  
5892ded23c8e9e Guenter Roeck   2015-02-03  106  static int regmap_smbus_word_write_swapped(void *context, unsigned int reg,
5892ded23c8e9e Guenter Roeck   2015-02-03  107  					   unsigned int val)
5892ded23c8e9e Guenter Roeck   2015-02-03  108  {
5892ded23c8e9e Guenter Roeck   2015-02-03  109  	struct device *dev = context;
5892ded23c8e9e Guenter Roeck   2015-02-03  110  	struct i2c_client *i2c = to_i2c_client(dev);
5892ded23c8e9e Guenter Roeck   2015-02-03  111  
5892ded23c8e9e Guenter Roeck   2015-02-03  112  	if (val > 0xffff || reg > 0xff)
5892ded23c8e9e Guenter Roeck   2015-02-03  113  		return -EINVAL;
5892ded23c8e9e Guenter Roeck   2015-02-03  114  
5892ded23c8e9e Guenter Roeck   2015-02-03 @115  	return i2c_smbus_write_word_swapped(i2c, reg, val);
5892ded23c8e9e Guenter Roeck   2015-02-03  116  }
5892ded23c8e9e Guenter Roeck   2015-02-03  117  
14e01b5f335881 Michał Mirosław 2020-01-04  118  static const struct regmap_bus regmap_smbus_word_swapped = {
5892ded23c8e9e Guenter Roeck   2015-02-03  119  	.reg_write = regmap_smbus_word_write_swapped,
5892ded23c8e9e Guenter Roeck   2015-02-03  120  	.reg_read = regmap_smbus_word_read_swapped,
5892ded23c8e9e Guenter Roeck   2015-02-03  121  };
5892ded23c8e9e Guenter Roeck   2015-02-03  122  
0135bbcc7a0cc0 Stephen Warren  2012-04-04  123  static int regmap_i2c_write(void *context, const void *data, size_t count)
9943fa300a5dcd Mark Brown      2011-06-20  124  {
0135bbcc7a0cc0 Stephen Warren  2012-04-04  125  	struct device *dev = context;
9943fa300a5dcd Mark Brown      2011-06-20  126  	struct i2c_client *i2c = to_i2c_client(dev);
9943fa300a5dcd Mark Brown      2011-06-20  127  	int ret;
9943fa300a5dcd Mark Brown      2011-06-20  128  
9943fa300a5dcd Mark Brown      2011-06-20 @129  	ret = i2c_master_send(i2c, data, count);
9943fa300a5dcd Mark Brown      2011-06-20  130  	if (ret == count)
9943fa300a5dcd Mark Brown      2011-06-20  131  		return 0;
9943fa300a5dcd Mark Brown      2011-06-20  132  	else if (ret < 0)
9943fa300a5dcd Mark Brown      2011-06-20  133  		return ret;
9943fa300a5dcd Mark Brown      2011-06-20  134  	else
9943fa300a5dcd Mark Brown      2011-06-20  135  		return -EIO;
9943fa300a5dcd Mark Brown      2011-06-20  136  }
9943fa300a5dcd Mark Brown      2011-06-20  137  
0135bbcc7a0cc0 Stephen Warren  2012-04-04  138  static int regmap_i2c_gather_write(void *context,
9943fa300a5dcd Mark Brown      2011-06-20  139  				   const void *reg, size_t reg_size,
9943fa300a5dcd Mark Brown      2011-06-20  140  				   const void *val, size_t val_size)
9943fa300a5dcd Mark Brown      2011-06-20  141  {
0135bbcc7a0cc0 Stephen Warren  2012-04-04  142  	struct device *dev = context;
9943fa300a5dcd Mark Brown      2011-06-20  143  	struct i2c_client *i2c = to_i2c_client(dev);
9943fa300a5dcd Mark Brown      2011-06-20  144  	struct i2c_msg xfer[2];
9943fa300a5dcd Mark Brown      2011-06-20  145  	int ret;
9943fa300a5dcd Mark Brown      2011-06-20  146  
9943fa300a5dcd Mark Brown      2011-06-20  147  	/* If the I2C controller can't do a gather tell the core, it
9943fa300a5dcd Mark Brown      2011-06-20  148  	 * will substitute in a linear write for us.
9943fa300a5dcd Mark Brown      2011-06-20  149  	 */
14674e70119ea0 Mark Brown      2012-05-30 @150  	if (!i2c_check_functionality(i2c->adapter, I2C_FUNC_NOSTART))
9943fa300a5dcd Mark Brown      2011-06-20  151  		return -ENOTSUPP;
9943fa300a5dcd Mark Brown      2011-06-20  152  
9943fa300a5dcd Mark Brown      2011-06-20  153  	xfer[0].addr = i2c->addr;
9943fa300a5dcd Mark Brown      2011-06-20  154  	xfer[0].flags = 0;
9943fa300a5dcd Mark Brown      2011-06-20  155  	xfer[0].len = reg_size;
9943fa300a5dcd Mark Brown      2011-06-20  156  	xfer[0].buf = (void *)reg;
9943fa300a5dcd Mark Brown      2011-06-20  157  
9943fa300a5dcd Mark Brown      2011-06-20  158  	xfer[1].addr = i2c->addr;
9943fa300a5dcd Mark Brown      2011-06-20  159  	xfer[1].flags = I2C_M_NOSTART;
9943fa300a5dcd Mark Brown      2011-06-20  160  	xfer[1].len = val_size;
9943fa300a5dcd Mark Brown      2011-06-20  161  	xfer[1].buf = (void *)val;
9943fa300a5dcd Mark Brown      2011-06-20  162  
9943fa300a5dcd Mark Brown      2011-06-20 @163  	ret = i2c_transfer(i2c->adapter, xfer, 2);
9943fa300a5dcd Mark Brown      2011-06-20  164  	if (ret == 2)
9943fa300a5dcd Mark Brown      2011-06-20  165  		return 0;
9943fa300a5dcd Mark Brown      2011-06-20  166  	if (ret < 0)
9943fa300a5dcd Mark Brown      2011-06-20  167  		return ret;
9943fa300a5dcd Mark Brown      2011-06-20  168  	else
9943fa300a5dcd Mark Brown      2011-06-20  169  		return -EIO;
9943fa300a5dcd Mark Brown      2011-06-20  170  }
9943fa300a5dcd Mark Brown      2011-06-20  171  
0135bbcc7a0cc0 Stephen Warren  2012-04-04  172  static int regmap_i2c_read(void *context,
9943fa300a5dcd Mark Brown      2011-06-20  173  			   const void *reg, size_t reg_size,
9943fa300a5dcd Mark Brown      2011-06-20  174  			   void *val, size_t val_size)
9943fa300a5dcd Mark Brown      2011-06-20  175  {
0135bbcc7a0cc0 Stephen Warren  2012-04-04  176  	struct device *dev = context;
9943fa300a5dcd Mark Brown      2011-06-20  177  	struct i2c_client *i2c = to_i2c_client(dev);
9943fa300a5dcd Mark Brown      2011-06-20  178  	struct i2c_msg xfer[2];
9943fa300a5dcd Mark Brown      2011-06-20  179  	int ret;
9943fa300a5dcd Mark Brown      2011-06-20  180  
9943fa300a5dcd Mark Brown      2011-06-20  181  	xfer[0].addr = i2c->addr;
9943fa300a5dcd Mark Brown      2011-06-20  182  	xfer[0].flags = 0;
9943fa300a5dcd Mark Brown      2011-06-20  183  	xfer[0].len = reg_size;
9943fa300a5dcd Mark Brown      2011-06-20  184  	xfer[0].buf = (void *)reg;
9943fa300a5dcd Mark Brown      2011-06-20  185  
9943fa300a5dcd Mark Brown      2011-06-20  186  	xfer[1].addr = i2c->addr;
9943fa300a5dcd Mark Brown      2011-06-20  187  	xfer[1].flags = I2C_M_RD;
9943fa300a5dcd Mark Brown      2011-06-20  188  	xfer[1].len = val_size;
9943fa300a5dcd Mark Brown      2011-06-20  189  	xfer[1].buf = val;
9943fa300a5dcd Mark Brown      2011-06-20  190  
9943fa300a5dcd Mark Brown      2011-06-20  191  	ret = i2c_transfer(i2c->adapter, xfer, 2);
9943fa300a5dcd Mark Brown      2011-06-20  192  	if (ret == 2)
9943fa300a5dcd Mark Brown      2011-06-20  193  		return 0;
9943fa300a5dcd Mark Brown      2011-06-20  194  	else if (ret < 0)
9943fa300a5dcd Mark Brown      2011-06-20  195  		return ret;
9943fa300a5dcd Mark Brown      2011-06-20  196  	else
9943fa300a5dcd Mark Brown      2011-06-20  197  		return -EIO;
9943fa300a5dcd Mark Brown      2011-06-20  198  }
9943fa300a5dcd Mark Brown      2011-06-20  199  
14e01b5f335881 Michał Mirosław 2020-01-04  200  static const struct regmap_bus regmap_i2c = {
9943fa300a5dcd Mark Brown      2011-06-20  201  	.write = regmap_i2c_write,
9943fa300a5dcd Mark Brown      2011-06-20  202  	.gather_write = regmap_i2c_gather_write,
9943fa300a5dcd Mark Brown      2011-06-20  203  	.read = regmap_i2c_read,
d647c199510c2c Xiubo Li        2014-07-15  204  	.reg_format_endian_default = REGMAP_ENDIAN_BIG,
d647c199510c2c Xiubo Li        2014-07-15  205  	.val_format_endian_default = REGMAP_ENDIAN_BIG,
9943fa300a5dcd Mark Brown      2011-06-20  206  };
9943fa300a5dcd Mark Brown      2011-06-20  207  
29332534e2b68b Markus Pargmann 2015-08-30  208  static int regmap_i2c_smbus_i2c_write(void *context, const void *data,
29332534e2b68b Markus Pargmann 2015-08-30  209  				      size_t count)
29332534e2b68b Markus Pargmann 2015-08-30  210  {
29332534e2b68b Markus Pargmann 2015-08-30  211  	struct device *dev = context;
29332534e2b68b Markus Pargmann 2015-08-30  212  	struct i2c_client *i2c = to_i2c_client(dev);
29332534e2b68b Markus Pargmann 2015-08-30  213  
29332534e2b68b Markus Pargmann 2015-08-30  214  	if (count < 1)
29332534e2b68b Markus Pargmann 2015-08-30  215  		return -EINVAL;
29332534e2b68b Markus Pargmann 2015-08-30  216  
29332534e2b68b Markus Pargmann 2015-08-30  217  	--count;
29332534e2b68b Markus Pargmann 2015-08-30 @218  	return i2c_smbus_write_i2c_block_data(i2c, ((u8 *)data)[0], count,
29332534e2b68b Markus Pargmann 2015-08-30  219  					      ((u8 *)data + 1));
29332534e2b68b Markus Pargmann 2015-08-30  220  }
29332534e2b68b Markus Pargmann 2015-08-30  221  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

View attachment "config" of type "text/plain" (111130 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ