drivers/macintosh/windfarm_lm75_sensor.c:70:21: sparse: sparse: cast to restricted __le16
From: kernel test robot
Date: Sun Nov 19 2023 - 15:56:31 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 037266a5f7239ead1530266f7d7af153d2a867fa
commit: 748ea32d2dbd813d3bd958117bde5191182f909a macintosh: windfarm: Use unsigned type for 1-bit bitfields
date: 9 months ago
config: powerpc64-randconfig-r121-20231119 (https://download.01.org/0day-ci/archive/20231120/202311200432.ia1Xs5Jj-lkp@xxxxxxxxx/config)
compiler: powerpc64-linux-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20231120/202311200432.ia1Xs5Jj-lkp@xxxxxxxxx/reproduce)
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/202311200432.ia1Xs5Jj-lkp@xxxxxxxxx/
sparse warnings: (new ones prefixed by >>)
>> drivers/macintosh/windfarm_lm75_sensor.c:70:21: sparse: sparse: cast to restricted __le16
vim +70 drivers/macintosh/windfarm_lm75_sensor.c
75722d3992f573 Benjamin Herrenschmidt 2005-11-07 42
75722d3992f573 Benjamin Herrenschmidt 2005-11-07 43 static int wf_lm75_get(struct wf_sensor *sr, s32 *value)
75722d3992f573 Benjamin Herrenschmidt 2005-11-07 44 {
75722d3992f573 Benjamin Herrenschmidt 2005-11-07 45 struct wf_lm75_sensor *lm = wf_to_lm75(sr);
75722d3992f573 Benjamin Herrenschmidt 2005-11-07 46 s32 data;
75722d3992f573 Benjamin Herrenschmidt 2005-11-07 47
351ca3e3119792 Jean Delvare 2009-06-15 48 if (lm->i2c == NULL)
75722d3992f573 Benjamin Herrenschmidt 2005-11-07 49 return -ENODEV;
75722d3992f573 Benjamin Herrenschmidt 2005-11-07 50
75722d3992f573 Benjamin Herrenschmidt 2005-11-07 51 /* Init chip if necessary */
75722d3992f573 Benjamin Herrenschmidt 2005-11-07 52 if (!lm->inited) {
351ca3e3119792 Jean Delvare 2009-06-15 53 u8 cfg_new, cfg = (u8)i2c_smbus_read_byte_data(lm->i2c, 1);
75722d3992f573 Benjamin Herrenschmidt 2005-11-07 54
75722d3992f573 Benjamin Herrenschmidt 2005-11-07 55 DBG("wf_lm75: Initializing %s, cfg was: %02x\n",
75722d3992f573 Benjamin Herrenschmidt 2005-11-07 56 sr->name, cfg);
75722d3992f573 Benjamin Herrenschmidt 2005-11-07 57
75722d3992f573 Benjamin Herrenschmidt 2005-11-07 58 /* clear shutdown bit, keep other settings as left by
75722d3992f573 Benjamin Herrenschmidt 2005-11-07 59 * the firmware for now
75722d3992f573 Benjamin Herrenschmidt 2005-11-07 60 */
75722d3992f573 Benjamin Herrenschmidt 2005-11-07 61 cfg_new = cfg & ~0x01;
351ca3e3119792 Jean Delvare 2009-06-15 62 i2c_smbus_write_byte_data(lm->i2c, 1, cfg_new);
75722d3992f573 Benjamin Herrenschmidt 2005-11-07 63 lm->inited = 1;
75722d3992f573 Benjamin Herrenschmidt 2005-11-07 64
75722d3992f573 Benjamin Herrenschmidt 2005-11-07 65 /* If we just powered it up, let's wait 200 ms */
75722d3992f573 Benjamin Herrenschmidt 2005-11-07 66 msleep(200);
75722d3992f573 Benjamin Herrenschmidt 2005-11-07 67 }
75722d3992f573 Benjamin Herrenschmidt 2005-11-07 68
75722d3992f573 Benjamin Herrenschmidt 2005-11-07 69 /* Read temperature register */
351ca3e3119792 Jean Delvare 2009-06-15 @70 data = (s32)le16_to_cpu(i2c_smbus_read_word_data(lm->i2c, 0));
75722d3992f573 Benjamin Herrenschmidt 2005-11-07 71 data <<= 8;
75722d3992f573 Benjamin Herrenschmidt 2005-11-07 72 *value = data;
75722d3992f573 Benjamin Herrenschmidt 2005-11-07 73
75722d3992f573 Benjamin Herrenschmidt 2005-11-07 74 return 0;
75722d3992f573 Benjamin Herrenschmidt 2005-11-07 75 }
75722d3992f573 Benjamin Herrenschmidt 2005-11-07 76
:::::: The code at line 70 was first introduced by commit
:::::: 351ca3e31197929535418f5affc761cd9fb07428 windfarm: Convert to new-style i2c drivers
:::::: TO: Jean Delvare <khali@xxxxxxxxxxxx>
:::::: CC: Jean Delvare <khali@xxxxxxxxxxxx>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki