* [linux-next:master 7223/10113] drivers/iio/dac/mcp47feb02.c:1027 mcp47feb02_init_ctrl_regs() warn: subtract is higher precedence than shift
@ 2026-09-24 23:44 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-09-24 23:44 UTC (permalink / raw)
To: oe-kbuild; +Cc: lkp, Dan Carpenter
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: Ariana Lazar <ariana.lazar@microchip.com>
CC: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: 4c253ac4b29b8c6cc6fdef8f92d4facde62e63b9
commit: 4a0aed7e813424c8b35686da2fad5851c0c40276 [7223/10113] iio: dac: mcp47feb02: use field_get() instead of custom dynamic macros
:::::: branch date: 5 hours ago
:::::: commit date: 4 days ago
config: um-randconfig-r2201-20260924 (https://download.01.org/0day-ci/archive/20260925/202609250145.0eqlXo26-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
smatch: v0.5.0-9187-g5189e3fb
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@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202609250145.0eqlXo26-lkp@intel.com/
New smatch warnings:
drivers/iio/dac/mcp47feb02.c:1027 mcp47feb02_init_ctrl_regs() warn: subtract is higher precedence than shift
drivers/iio/dac/mcp47feb02.c:1027 mcp47feb02_init_ctrl_regs() warn: subtract is higher precedence than shift
drivers/iio/dac/mcp47feb02.c:1027 mcp47feb02_init_ctrl_regs() warn: subtract is higher precedence than shift
drivers/iio/dac/mcp47feb02.c:1027 mcp47feb02_init_ctrl_regs() warn: subtract is higher precedence than shift
Old smatch warnings:
drivers/iio/dac/mcp47feb02.c:1071 mcp47feb02_init_ctrl_regs() warn: subtract is higher precedence than shift
drivers/iio/dac/mcp47feb02.c:1071 mcp47feb02_init_ctrl_regs() warn: subtract is higher precedence than shift
drivers/iio/dac/mcp47feb02.c:1071 mcp47feb02_init_ctrl_regs() warn: subtract is higher precedence than shift
drivers/iio/dac/mcp47feb02.c:1071 mcp47feb02_init_ctrl_regs() warn: subtract is higher precedence than shift
vim +1027 drivers/iio/dac/mcp47feb02.c
bf394cc8036989 Ariana Lazar 2025-12-16 1000
bf394cc8036989 Ariana Lazar 2025-12-16 1001 static int mcp47feb02_init_ctrl_regs(struct mcp47feb02_data *data)
bf394cc8036989 Ariana Lazar 2025-12-16 1002 {
bf394cc8036989 Ariana Lazar 2025-12-16 1003 unsigned int i, vref_ch, gain_ch, pd_ch;
bf394cc8036989 Ariana Lazar 2025-12-16 1004 int ret;
bf394cc8036989 Ariana Lazar 2025-12-16 1005
bf394cc8036989 Ariana Lazar 2025-12-16 1006 ret = regmap_read(data->regmap, MCP47FEB02_VREF_REG_ADDR, &vref_ch);
bf394cc8036989 Ariana Lazar 2025-12-16 1007 if (ret)
bf394cc8036989 Ariana Lazar 2025-12-16 1008 return ret;
bf394cc8036989 Ariana Lazar 2025-12-16 1009
bf394cc8036989 Ariana Lazar 2025-12-16 1010 ret = regmap_read(data->regmap, MCP47FEB02_GAIN_CTRL_STATUS_REG_ADDR, &gain_ch);
bf394cc8036989 Ariana Lazar 2025-12-16 1011 if (ret)
bf394cc8036989 Ariana Lazar 2025-12-16 1012 return ret;
bf394cc8036989 Ariana Lazar 2025-12-16 1013
bf394cc8036989 Ariana Lazar 2025-12-16 1014 ret = regmap_read(data->regmap, MCP47FEB02_POWER_DOWN_REG_ADDR, &pd_ch);
bf394cc8036989 Ariana Lazar 2025-12-16 1015 if (ret)
bf394cc8036989 Ariana Lazar 2025-12-16 1016 return ret;
bf394cc8036989 Ariana Lazar 2025-12-16 1017
bf394cc8036989 Ariana Lazar 2025-12-16 1018 for_each_set_bit(i, &data->active_channels_mask, data->phys_channels) {
bf394cc8036989 Ariana Lazar 2025-12-16 1019 struct device *dev = regmap_get_device(data->regmap);
fc8d14d75345cb Ariana Lazar 2026-09-18 1020 unsigned int pd_tmp, dac_val;
fc8d14d75345cb Ariana Lazar 2026-09-18 1021
fc8d14d75345cb Ariana Lazar 2026-09-18 1022 ret = regmap_read(data->regmap, REG_ADDR(i), &dac_val);
fc8d14d75345cb Ariana Lazar 2026-09-18 1023 if (ret)
fc8d14d75345cb Ariana Lazar 2026-09-18 1024 return ret;
fc8d14d75345cb Ariana Lazar 2026-09-18 1025 data->chdata[i].dac_data = dac_val;
bf394cc8036989 Ariana Lazar 2025-12-16 1026
4a0aed7e813424 Ariana Lazar 2026-09-18 @1027 data->chdata[i].ref_mode = field_get(DAC_CTRL_MASK(i), vref_ch);
29491c675c2bab Ariana Lazar 2026-09-18 1028 data->chdata[i].use_2x_gain = field_get(DAC_GAIN_MASK(i), gain_ch);
bf394cc8036989 Ariana Lazar 2025-12-16 1029
bf394cc8036989 Ariana Lazar 2025-12-16 1030 /*
bf394cc8036989 Ariana Lazar 2025-12-16 1031 * Inform the user that the current voltage reference read from the volatile
bf394cc8036989 Ariana Lazar 2025-12-16 1032 * register of the chip is different from the one specified in the device tree.
bf394cc8036989 Ariana Lazar 2025-12-16 1033 * Considering that the user cannot have an external voltage reference connected
bf394cc8036989 Ariana Lazar 2025-12-16 1034 * to the pin and select the internal Band Gap at the same time, in order to avoid
bf394cc8036989 Ariana Lazar 2025-12-16 1035 * miscofiguring the reference voltage, the volatile register will not be written.
bf394cc8036989 Ariana Lazar 2025-12-16 1036 * In order to overwrite the setting from volatile register with the one from the
bf394cc8036989 Ariana Lazar 2025-12-16 1037 * device tree, the user needs to write the chosen scale.
bf394cc8036989 Ariana Lazar 2025-12-16 1038 */
bf394cc8036989 Ariana Lazar 2025-12-16 1039 switch (data->chdata[i].ref_mode) {
bf394cc8036989 Ariana Lazar 2025-12-16 1040 case MCP47FEB02_INTERNAL_BAND_GAP:
bf394cc8036989 Ariana Lazar 2025-12-16 1041 if (data->phys_channels >= 4 && (i % 2) && data->use_vref1) {
bf394cc8036989 Ariana Lazar 2025-12-16 1042 dev_dbg(dev, "ch[%u]: was configured to use internal band gap", i);
bf394cc8036989 Ariana Lazar 2025-12-16 1043 dev_dbg(dev, "ch[%u]: reference voltage set to VREF1", i);
bf394cc8036989 Ariana Lazar 2025-12-16 1044 break;
bf394cc8036989 Ariana Lazar 2025-12-16 1045 }
bf394cc8036989 Ariana Lazar 2025-12-16 1046 if ((data->phys_channels < 4 || (data->phys_channels >= 4 && !(i % 2))) &&
bf394cc8036989 Ariana Lazar 2025-12-16 1047 data->use_vref) {
bf394cc8036989 Ariana Lazar 2025-12-16 1048 dev_dbg(dev, "ch[%u]: was configured to use internal band gap", i);
bf394cc8036989 Ariana Lazar 2025-12-16 1049 dev_dbg(dev, "ch[%u]: reference voltage set to VREF", i);
bf394cc8036989 Ariana Lazar 2025-12-16 1050 break;
bf394cc8036989 Ariana Lazar 2025-12-16 1051 }
bf394cc8036989 Ariana Lazar 2025-12-16 1052 break;
bf394cc8036989 Ariana Lazar 2025-12-16 1053 case MCP47FEB02_EXTERNAL_VREF_UNBUFFERED:
bf394cc8036989 Ariana Lazar 2025-12-16 1054 case MCP47FEB02_EXTERNAL_VREF_BUFFERED:
bf394cc8036989 Ariana Lazar 2025-12-16 1055 if (data->phys_channels >= 4 && (i % 2) && !data->use_vref1) {
bf394cc8036989 Ariana Lazar 2025-12-16 1056 dev_dbg(dev, "ch[%u]: was configured to use VREF1", i);
bf394cc8036989 Ariana Lazar 2025-12-16 1057 dev_dbg(dev,
bf394cc8036989 Ariana Lazar 2025-12-16 1058 "ch[%u]: reference voltage set to internal band gap", i);
bf394cc8036989 Ariana Lazar 2025-12-16 1059 break;
bf394cc8036989 Ariana Lazar 2025-12-16 1060 }
bf394cc8036989 Ariana Lazar 2025-12-16 1061 if ((data->phys_channels < 4 || (data->phys_channels >= 4 && !(i % 2))) &&
bf394cc8036989 Ariana Lazar 2025-12-16 1062 !data->use_vref) {
bf394cc8036989 Ariana Lazar 2025-12-16 1063 dev_dbg(dev, "ch[%u]: was configured to use VREF", i);
bf394cc8036989 Ariana Lazar 2025-12-16 1064 dev_dbg(dev,
bf394cc8036989 Ariana Lazar 2025-12-16 1065 "ch[%u]: reference voltage set to internal band gap", i);
bf394cc8036989 Ariana Lazar 2025-12-16 1066 break;
bf394cc8036989 Ariana Lazar 2025-12-16 1067 }
bf394cc8036989 Ariana Lazar 2025-12-16 1068 break;
bf394cc8036989 Ariana Lazar 2025-12-16 1069 }
bf394cc8036989 Ariana Lazar 2025-12-16 1070
4a0aed7e813424 Ariana Lazar 2026-09-18 1071 pd_tmp = field_get(DAC_CTRL_MASK(i), pd_ch);
bf394cc8036989 Ariana Lazar 2025-12-16 1072 data->chdata[i].powerdown_mode = pd_tmp ? (pd_tmp - 1) : pd_tmp;
bf394cc8036989 Ariana Lazar 2025-12-16 1073 data->chdata[i].powerdown = !!(data->chdata[i].powerdown_mode);
bf394cc8036989 Ariana Lazar 2025-12-16 1074 }
bf394cc8036989 Ariana Lazar 2025-12-16 1075
bf394cc8036989 Ariana Lazar 2025-12-16 1076 return 0;
bf394cc8036989 Ariana Lazar 2025-12-16 1077 }
bf394cc8036989 Ariana Lazar 2025-12-16 1078
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-09-24 23:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-24 23:44 [linux-next:master 7223/10113] drivers/iio/dac/mcp47feb02.c:1027 mcp47feb02_init_ctrl_regs() warn: subtract is higher precedence than shift kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.