Re: [PATCH] imon_raw: respect DMA coherency

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

 



Hi Oliver,

I love your patch! Perhaps something to improve:

[auto build test WARNING on media-tree/master]
[also build test WARNING on v5.18-rc6 next-20220512]
[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]

url:    https://github.com/intel-lab-lkp/linux/commits/Oliver-Neukum/imon_raw-respect-DMA-coherency/20220512-210422
base:   git://linuxtv.org/media_tree.git master
config: sh-allmodconfig (https://download.01.org/0day-ci/archive/20220513/202205131229.FeABo9N9-lkp@xxxxxxxxx/config)
compiler: sh4-linux-gcc (GCC) 11.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.4-dirty
        # https://github.com/intel-lab-lkp/linux/commit/5e1a1b1e9c8288033f5f1f1d70a3d7506114fad3
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Oliver-Neukum/imon_raw-respect-DMA-coherency/20220512-210422
        git checkout 5e1a1b1e9c8288033f5f1f1d70a3d7506114fad3
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=sh SHELL=/bin/bash drivers/media/rc/ drivers/platform/mellanox/ net/rxrpc/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>


sparse warnings: (new ones prefixed by >>)
>> drivers/media/rc/imon_raw.c:32:20: sparse: sparse: cast to restricted __be64
>> drivers/media/rc/imon_raw.c:32:20: sparse: sparse: cast to restricted __be64
>> drivers/media/rc/imon_raw.c:32:20: sparse: sparse: cast to restricted __be64
>> drivers/media/rc/imon_raw.c:32:20: sparse: sparse: cast to restricted __be64
>> drivers/media/rc/imon_raw.c:32:20: sparse: sparse: cast to restricted __be64
>> drivers/media/rc/imon_raw.c:32:20: sparse: sparse: cast to restricted __be64
>> drivers/media/rc/imon_raw.c:32:20: sparse: sparse: cast to restricted __be64
>> drivers/media/rc/imon_raw.c:32:20: sparse: sparse: cast to restricted __be64
>> drivers/media/rc/imon_raw.c:32:20: sparse: sparse: cast to restricted __be64
>> drivers/media/rc/imon_raw.c:32:20: sparse: sparse: cast to restricted __be64
>> drivers/media/rc/imon_raw.c:32:20: sparse: sparse: non size-preserving pointer to integer cast

vim +32 drivers/media/rc/imon_raw.c

8a4e8f8dfc6994 Sean Young 2018-01-05  20  
8a4e8f8dfc6994 Sean Young 2018-01-05  21  /*
8d023a5787775c Sean Young 2018-10-18  22   * The first 5 bytes of data represent IR pulse or space. Each bit, starting
8d023a5787775c Sean Young 2018-10-18  23   * from highest bit in the first byte, represents 250µs of data. It is 1
8d023a5787775c Sean Young 2018-10-18  24   * for space and 0 for pulse.
8d023a5787775c Sean Young 2018-10-18  25   *
8d023a5787775c Sean Young 2018-10-18  26   * The station sends 10 packets, and the 7th byte will be number 1 to 10, so
8d023a5787775c Sean Young 2018-10-18  27   * when we receive 10 we assume all the data has arrived.
8a4e8f8dfc6994 Sean Young 2018-01-05  28   */
8a4e8f8dfc6994 Sean Young 2018-01-05  29  static void imon_ir_data(struct imon *imon)
8a4e8f8dfc6994 Sean Young 2018-01-05  30  {
183e19f5b9ee18 Sean Young 2018-08-21  31  	struct ir_raw_event rawir = {};
e70d13f7ac061d Sean Young 2019-08-09 @32  	u64 data = be64_to_cpu(imon->ir_buf);
e70d13f7ac061d Sean Young 2019-08-09  33  	u8 packet_no = data & 0xff;
8d023a5787775c Sean Young 2018-10-18  34  	int offset = 40;
8a4e8f8dfc6994 Sean Young 2018-01-05  35  	int bit;
8a4e8f8dfc6994 Sean Young 2018-01-05  36  
e70d13f7ac061d Sean Young 2019-08-09  37  	if (packet_no == 0xff)
e70d13f7ac061d Sean Young 2019-08-09  38  		return;
e70d13f7ac061d Sean Young 2019-08-09  39  
e70d13f7ac061d Sean Young 2019-08-09  40  	dev_dbg(imon->dev, "data: %*ph", 8, &imon->ir_buf);
e70d13f7ac061d Sean Young 2019-08-09  41  
e70d13f7ac061d Sean Young 2019-08-09  42  	/*
e70d13f7ac061d Sean Young 2019-08-09  43  	 * Only the first 5 bytes contain IR data. Right shift so we move
e70d13f7ac061d Sean Young 2019-08-09  44  	 * the IR bits to the lower 40 bits.
e70d13f7ac061d Sean Young 2019-08-09  45  	 */
e70d13f7ac061d Sean Young 2019-08-09  46  	data >>= 24;
8a4e8f8dfc6994 Sean Young 2018-01-05  47  
8d023a5787775c Sean Young 2018-10-18  48  	do {
e70d13f7ac061d Sean Young 2019-08-09  49  		/*
e70d13f7ac061d Sean Young 2019-08-09  50  		 * Find highest set bit which is less or equal to offset
e70d13f7ac061d Sean Young 2019-08-09  51  		 *
e70d13f7ac061d Sean Young 2019-08-09  52  		 * offset is the bit above (base 0) where we start looking.
e70d13f7ac061d Sean Young 2019-08-09  53  		 *
e70d13f7ac061d Sean Young 2019-08-09  54  		 * data & (BIT_ULL(offset) - 1) masks off any unwanted bits,
e70d13f7ac061d Sean Young 2019-08-09  55  		 * so we have just bits less than offset.
e70d13f7ac061d Sean Young 2019-08-09  56  		 *
e70d13f7ac061d Sean Young 2019-08-09  57  		 * fls will tell us the highest bit set plus 1 (or 0 if no
e70d13f7ac061d Sean Young 2019-08-09  58  		 * bits are set).
e70d13f7ac061d Sean Young 2019-08-09  59  		 */
d587cdb2a5f570 Sean Young 2019-10-07  60  		rawir.pulse = !rawir.pulse;
e70d13f7ac061d Sean Young 2019-08-09  61  		bit = fls64(data & (BIT_ULL(offset) - 1));
8d023a5787775c Sean Young 2018-10-18  62  		if (bit < offset) {
d587cdb2a5f570 Sean Young 2019-10-07  63  			dev_dbg(imon->dev, "%s: %d bits",
d587cdb2a5f570 Sean Young 2019-10-07  64  				rawir.pulse ? "pulse" : "space", offset - bit);
8d023a5787775c Sean Young 2018-10-18  65  			rawir.duration = (offset - bit) * BIT_DURATION;
8a4e8f8dfc6994 Sean Young 2018-01-05  66  			ir_raw_event_store_with_filter(imon->rcdev, &rawir);
8a4e8f8dfc6994 Sean Young 2018-01-05  67  
8a4e8f8dfc6994 Sean Young 2018-01-05  68  			offset = bit;
8d023a5787775c Sean Young 2018-10-18  69  		}
8d023a5787775c Sean Young 2018-10-18  70  
d587cdb2a5f570 Sean Young 2019-10-07  71  		data = ~data;
8d023a5787775c Sean Young 2018-10-18  72  	} while (offset > 0);
8a4e8f8dfc6994 Sean Young 2018-01-05  73  
494fce160f2dac Sean Young 2019-08-09  74  	if (packet_no == 0x0a && !imon->rcdev->idle) {
8a4e8f8dfc6994 Sean Young 2018-01-05  75  		ir_raw_event_set_idle(imon->rcdev, true);
8a4e8f8dfc6994 Sean Young 2018-01-05  76  		ir_raw_event_handle(imon->rcdev);
8a4e8f8dfc6994 Sean Young 2018-01-05  77  	}
8a4e8f8dfc6994 Sean Young 2018-01-05  78  }
8a4e8f8dfc6994 Sean Young 2018-01-05  79  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux