Re: [PATCH v6 3/3] hwmon: (isl28022) support shunt voltage for ISL28022 power monitor

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

 



Hi Delphine,

kernel test robot noticed the following build warnings:

[auto build test WARNING on groeck-staging/hwmon-next]
[also build test WARNING on linus/master v6.11-rc7 next-20240909]
[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/Delphine-CC-Chiu/hwmon-isl28022-new-driver-for-ISL28022-power-monitor/20240906-141717
base:   https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next
patch link:    https://lore.kernel.org/r/20240906061421.9392-4-Delphine_CC_Chiu%40wiwynn.com
patch subject: [PATCH v6 3/3] hwmon: (isl28022) support shunt voltage for ISL28022 power monitor
config: microblaze-randconfig-r073-20240909 (https://download.01.org/0day-ci/archive/20240910/202409101229.6mTYs5Rf-lkp@xxxxxxxxx/config)
compiler: microblaze-linux-gcc (GCC) 14.1.0

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202409101229.6mTYs5Rf-lkp@xxxxxxxxx/

smatch warnings:
drivers/hwmon/isl28022.c:122 isl28022_read() warn: inconsistent indenting

vim +122 drivers/hwmon/isl28022.c

    89	
    90	static int isl28022_read(struct device *dev, enum hwmon_sensor_types type,
    91				 u32 attr, int channel, long *val)
    92	{
    93		struct isl28022_data *data = dev_get_drvdata(dev);
    94		unsigned int regval;
    95		int err;
    96		u16 sign_bit;
    97	
    98		switch (type) {
    99		case hwmon_in:
   100			switch (channel) {
   101			case 0:
   102				switch (attr) {
   103				case hwmon_in_input:
   104					err = regmap_read(data->regmap,
   105							  ISL28022_REG_BUS, &regval);
   106					if (err < 0)
   107						return err;
   108					/* driver supports only 60V mode (BRNG 11) */
   109					*val = (long)(((u16)regval) & 0xFFFC);
   110					break;
   111				default:
   112					return -EOPNOTSUPP;
   113				}
   114				break;
   115			case 1:
   116				switch (attr) {
   117				case hwmon_in_input:
   118					err = regmap_read(data->regmap,
   119							  ISL28022_REG_SHUNT, &regval);
   120					if (err < 0)
   121						return err;
 > 122				switch (data->gain) {
   123				case 8:
   124					sign_bit = (regval >> 15) & 0x01;
   125					*val = (long)((((u16)regval) & 0x7FFF) -
   126						   (sign_bit * 32768)) / 100;
   127					break;
   128				case 4:
   129					sign_bit = (regval >> 14) & 0x01;
   130					*val = (long)((((u16)regval) & 0x3FFF) -
   131						   (sign_bit * 16384)) / 100;
   132					break;
   133				case 2:
   134					sign_bit = (regval >> 13) & 0x01;
   135					*val = (long)((((u16)regval) & 0x1FFF) -
   136						   (sign_bit * 8192)) / 100;
   137					break;
   138				case 1:
   139					sign_bit = (regval >> 12) & 0x01;
   140					*val = (long)((((u16)regval) & 0x0FFF) -
   141						   (sign_bit * 4096)) / 100;
   142					break;
   143				}
   144				break;
   145				default:
   146					return -EOPNOTSUPP;
   147				}
   148				break;
   149			default:
   150				return -EOPNOTSUPP;
   151			}
   152			break;
   153		case hwmon_curr:
   154			switch (attr) {
   155			case hwmon_curr_input:
   156				err = regmap_read(data->regmap,
   157						  ISL28022_REG_CURRENT, &regval);
   158				if (err < 0)
   159					return err;
   160				*val = ((long)regval * 1250L * (long)data->gain) /
   161					(long)data->shunt;
   162				break;
   163			default:
   164				return -EOPNOTSUPP;
   165			}
   166			break;
   167		case hwmon_power:
   168			switch (attr) {
   169			case hwmon_power_input:
   170				err = regmap_read(data->regmap,
   171						  ISL28022_REG_POWER, &regval);
   172				if (err < 0)
   173					return err;
   174				*val = ((51200000L * ((long)data->gain)) /
   175					(long)data->shunt) * (long)regval;
   176				break;
   177			default:
   178				return -EOPNOTSUPP;
   179			}
   180			break;
   181		default:
   182			return -EOPNOTSUPP;
   183		}
   184	
   185		return 0;
   186	}
   187	

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




[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