Bug 209883

Summary: iio: light: build error due to unmet dependency for IIO_TRIGGERED_BUFFER by VCNL4035
Product: Drivers Reporter: Necip Fazil Yildiran (fazilyildiran)
Component: IIOAssignee: Virtual Assignee for Drivers/IIO (drivers_iio)
Status: RESOLVED CODE_FIX    
Severity: low CC: andy.shevchenko, fazilyildiran, lars, paul
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 5.9-rc10 Subsystem:
Regression: No Bisected commit-id:
Attachments: reproduce.tar.gz

Description Necip Fazil Yildiran 2020-10-26 20:51:11 UTC
Created attachment 293229 [details]
reproduce.tar.gz

Attachment (reproduce.tar.gz) content:
 - sample.config: Config file to reproduce the bug.
 - build_out.txt: Output of Kbuild including the error messages.

When IIO_TRIGGERED_BUFFER is enabled and IIO_BUFFER is disabled, it results
in the following Kbuild warning:

WARNING: unmet direct dependencies detected for IIO_TRIGGERED_BUFFER
  Depends on [n]: IIO [=y] && IIO_BUFFER [=n]
  Selected by [y]:
  - VCNL4035 [=y] && IIO [=y] && I2C [=y]

Building the kernel fails due to this unmet direct dependency issue as follows:

[...]
  LD      .tmp_vmlinux1
drivers/iio/buffer/industrialio-triggered-buffer.o: In function `iio_triggered_buffer_cleanup':
/home/necip/linux/clean-linux-5.4.4/drivers/iio/buffer/industrialio-triggered-buffer.c:94: undefined reference to `iio_kfifo_free'
drivers/iio/buffer/industrialio-triggered-buffer.o: In function `iio_triggered_buffer_setup':
/home/necip/linux/clean-linux-5.4.4/drivers/iio/buffer/industrialio-triggered-buffer.c:49: undefined reference to `iio_kfifo_allocate'
/home/necip/linux/clean-linux-5.4.4/drivers/iio/buffer/industrialio-triggered-buffer.c:55: undefined reference to `iio_device_attach_buffer'
/home/necip/linux/clean-linux-5.4.4/drivers/iio/buffer/industrialio-triggered-buffer.c:81: undefined reference to `iio_kfifo_free'
drivers/iio/buffer/industrialio-triggered-buffer.o: In function `iio_triggered_buffer_cleanup':
/home/necip/linux/clean-linux-5.4.4/drivers/iio/buffer/industrialio-triggered-buffer.c:94: undefined reference to `iio_kfifo_free'
drivers/iio/light/vcnl4035.o: In function `iio_push_to_buffers_with_timestamp':
/home/necip/linux/clean-linux-5.4.4/./include/linux/iio/buffer.h:41: undefined reference to `iio_push_to_buffers'
drivers/iio/light/vcnl4035.o:(.rodata+0x4e0): undefined reference to `iio_validate_scan_mask_onehot'
Makefile:1077: recipe for target 'vmlinux' failed
make: *** [vmlinux] Error 1

Steps to reproduce the bug for v5.4.4:
  1. wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
  2. chmod +x ~/bin/make.cross
  3. tar -xvf reproduce.tar.gz # sample.config and build_out.txt
  4. cp sample.config path/to/linux-source-v5.4.4/.config
  5. cd path/to/linux-source-v5.4.4/
  6. ~/bin/make.cross ARCH=x86_64 clean
  7. ~/bin/make.cross ARCH=x86_64 olddefconfig # unmet direct dependency warning
  8. ~/bin/make.cross ARCH=x86_64 # should have a build error

The output for the steps [6-8] can be found in build_out.txt.

The bug is reproducible for v5.10-rc1 as well with the same steps.

Kernel successfully builds when the unmet direct dependencies are resolved
by enabling them in the configuration. Depending on instead of selecting
the symbols, or selecting the dependencies of the selected symbols as well
should fix the bug.

Thanks,
Necip