[xilinx-xlnx:xlnx_rebase_v5.15_LTS 541/1129] drivers/iio/adc/xilinx-ams.c:384:10: warning: signed shift result (0x446A60000) requires 36 bits to represent, but 'long' only has 32 bits

kernel test robot lkp at intel.com
Fri May 6 16:46:59 PDT 2022


tree:   https://github.com/Xilinx/linux-xlnx xlnx_rebase_v5.15_LTS
head:   3076249fc30bf463f8390f89009de928ad3e95ff
commit: d073b83d3f8f3ba83c59f7502371b1cf9eb35e92 [541/1129] iio: adc: Add Xilinx AMS driver
config: mips-buildonly-randconfig-r006-20220506 (https://download.01.org/0day-ci/archive/20220507/202205070742.Oo5N1vbq-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 5e004fb787698440a387750db7f8028e7cb14cfc)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install mips cross compiling tool for clang build
        # apt-get install binutils-mips-linux-gnu
        # https://github.com/Xilinx/linux-xlnx/commit/d073b83d3f8f3ba83c59f7502371b1cf9eb35e92
        git remote add xilinx-xlnx https://github.com/Xilinx/linux-xlnx
        git fetch --no-tags xilinx-xlnx xlnx_rebase_v5.15_LTS
        git checkout d073b83d3f8f3ba83c59f7502371b1cf9eb35e92
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash drivers/iio/adc/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp at intel.com>

All warnings (new ones prefixed by >>):

>> drivers/iio/adc/xilinx-ams.c:384:10: warning: signed shift result (0x446A60000) requires 36 bits to represent, but 'long' only has 32 bits
   = AMS_TEMP_OFFSET;
   ^~~~~~~~~~~~~~~
   drivers/iio/adc/xilinx-ams.h:134:47: note: expanded from macro 'AMS_TEMP_OFFSET'
   #define AMS_TEMP_OFFSET -((280230L << 16) / 509314)
   ~~~~~~~ ^ ~~
>> drivers/iio/adc/xilinx-ams.c:38:20: warning: unused function 'ams_update_reg'
   static inline void ams_update_reg(struct ams unsigned int offset,
   ^
   fatal error: error in backend: Nested variants found in inline asm string: '.if ( 0x00 ) != -1)) 0x00 ) != -1)) : ($( static struct ftrace_branch_data __attribute__((__aligned__(4))) __attribute__((__section__("_ftrace_branch"))) __if_trace = $( .func = __func__, .file = "arch/mips/include/asm/barrier.h", .line = 16, $); 0x00 ) != -1)) : $))) ) && ( (1 << 0) ); .set push; .set mips64r2; .rept 1; sync 0x00; .endr; .set pop; .else; ; .endif'
   PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
   Stack dump:
   0. Program arguments: clang -Wp,-MMD,drivers/iio/adc/.xilinx-ams.o.d -nostdinc -isystem /opt/cross/clang-5e004fb787/lib/clang/15.0.0/include -Iarch/mips/include -I./arch/mips/include/generated -Iinclude -I./include -Iarch/mips/include/uapi -I./arch/mips/include/generated/uapi -Iinclude/uapi -I./include/generated/uapi -include include/linux/compiler-version.h -include include/linux/kconfig.h -include include/linux/compiler_types.h -D__KERNEL__ -DVMLINUX_LOAD_ADDRESS=0xffffffff80000000 -DLINKER_LOAD_ADDRESS=0x80000000 -DDATAOFFSET=0 -Qunused-arguments -fmacro-prefix-map== -DKBUILD_EXTRA_WARN1 -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Wno-format-security -std=gnu89 --target=mipsel-linux -fintegrated-as -Werror=unknown-warning-option -Werror=ignored-optimization-argument -mno-check-zero-division -mabi=32 -G 0 -mno-abicalls -fno-pic -pipe -msoft-float -DGAS_HAS_SET_HARDFLOAT -Wa,-msoft-float -ffreestanding -EL -fno-stack-check -march=mips32 -Wa,--trap -DTOOLCHAIN_SUPPORTS_VIRT -Iarch/mips/include/asm/mach-ralink -Iarch/mips/include/asm/mach-ralink/mt7620 -Iarch/mips/include/asm/mach-generic -fno-asynchronous-unwind-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-address-of-packed-member -Os -Wframe-larger-than=1024 -fstack-protector -Wno-gnu -mno-global-merge -Wno-unused-but-set-variable -Wno-unused-const-variable -ftrivial-auto-var-init=zero -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang -fno-stack-clash-protection -pg -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-array-bounds -fno-strict-overflow -fno-stack-check -Werror=date-time -Werror=incompatible-pointer-types -Wextra -Wunused -Wno-unused-parameter -Wmissing-declarations -Wmissing-format-attribute -Wmissing-prototypes -Wold-style-definition -Wmissing-include-dirs -Wunused-but-set-variable -Wunused-const-variable -Wno-missing-field-initializers -Wno-sign-compare -Wno-type-limits -I drivers/iio/adc -I ./drivers/iio/adc -DMODULE -mlong-calls -DKBUILD_BASENAME="xilinx_ams" -DKBUILD_MODNAME="xilinx_ams" -D__KBUILD_MODNAME=kmod_xilinx_ams -c -o drivers/iio/adc/xilinx-ams.o drivers/iio/adc/xilinx-ams.c
   1. <eof> parser at end of file
   2. Code generation
   3. Running pass 'Function Pass Manager' on module 'drivers/iio/adc/xilinx-ams.c'.
   4. Running pass 'Mips Assembly Printer' on function '@ams_apb_pl_read_reg'
   #0 0x000056341a75dc6f Signals.cpp:0:0
   #1 0x000056341a75ba94 llvm::sys::CleanupOnSignal(unsigned long) (/opt/cross/clang-5e004fb787/bin/clang-15+0x34bba94)
   #2 0x000056341a69adf7 llvm::CrashRecoveryContext::HandleExit(int) (/opt/cross/clang-5e004fb787/bin/clang-15+0x33fadf7)
   #3 0x000056341a7540ce llvm::sys::Process::Exit(int, bool) (/opt/cross/clang-5e004fb787/bin/clang-15+0x34b40ce)
   #4 0x00005634183632db (/opt/cross/clang-5e004fb787/bin/clang-15+0x10c32db)
   #5 0x000056341a6a192c llvm::report_fatal_error(llvm::Twine const&, bool) (/opt/cross/clang-5e004fb787/bin/clang-15+0x340192c)
   #6 0x000056341b3eb5d0 llvm::AsmPrinter::emitInlineAsm(llvm::MachineInstr const (/opt/cross/clang-5e004fb787/bin/clang-15+0x414b5d0)
   #7 0x000056341b3e74d2 llvm::AsmPrinter::emitFunctionBody() (/opt/cross/clang-5e004fb787/bin/clang-15+0x41474d2)
   #8 0x0000563418dfe817 llvm::MipsAsmPrinter::runOnMachineFunction(llvm::MachineFunction&) (/opt/cross/clang-5e004fb787/bin/clang-15+0x1b5e817)
   #9 0x0000563419ae623d llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.53) MachineFunctionPass.cpp:0:0
   #10 0x0000563419f2eef7 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/cross/clang-5e004fb787/bin/clang-15+0x2c8eef7)
   #11 0x0000563419f2f071 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/cross/clang-5e004fb787/bin/clang-15+0x2c8f071)
   #12 0x0000563419f2fbef llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/cross/clang-5e004fb787/bin/clang-15+0x2c8fbef)
   #13 0x000056341aa9334f clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream> >) (/opt/cross/clang-5e004fb787/bin/clang-15+0x37f334f)
   #14 0x000056341b715011 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/cross/clang-5e004fb787/bin/clang-15+0x4475011)
   #15 0x000056341c29e0c1 clang::ParseAST(clang::Sema&, bool, bool) (/opt/cross/clang-5e004fb787/bin/clang-15+0x4ffe0c1)
   #16 0x000056341b7146d5 clang::CodeGenAction::ExecuteAction() (/opt/cross/clang-5e004fb787/bin/clang-15+0x44746d5)
   #17 0x000056341b0fa981 clang::FrontendAction::Execute() (/opt/cross/clang-5e004fb787/bin/clang-15+0x3e5a981)
   #18 0x000056341b08ef0a clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/cross/clang-5e004fb787/bin/clang-15+0x3deef0a)
   #19 0x000056341b1c1f0b (/opt/cross/clang-5e004fb787/bin/clang-15+0x3f21f0b)
   #20 0x000056341836488c cc1_main(llvm::ArrayRef<char char (/opt/cross/clang-5e004fb787/bin/clang-15+0x10c488c)
   #21 0x000056341836155b ExecuteCC1Tool(llvm::SmallVectorImpl<char driver.cpp:0:0
   #22 0x000056341af1dc95 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> const::'lambda'()>(long) Job.cpp:0:0
   #23 0x000056341a69acb3 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/cross/clang-5e004fb787/bin/clang-15+0x33facb3)
   #24 0x000056341af1e58e clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> const (.part.216) Job.cpp:0:0
   #25 0x000056341aef0917 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const (/opt/cross/clang-5e004fb787/bin/clang-15+0x3c50917)
   #26 0x000056341aef12f7 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command >&) const (/opt/cross/clang-5e004fb787/bin/clang-15+0x3c512f7)
   #27 0x000056341aefa7ea clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command >&) (/opt/cross/clang-5e004fb787/bin/clang-15+0x3c5a7ea)
   #28 0x00005634182ad99f main (/opt/cross/clang-5e004fb787/bin/clang-15+0x100d99f)
   #29 0x00007f70439de7fd __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x237fd)
   #30 0x000056341836107a _start (/opt/cross/clang-5e004fb787/bin/clang-15+0x10c107a)
   clang-15: error: clang frontend command failed with exit code 70 (use -v to see invocation)
   clang version 15.0.0 (git://gitmirror/llvm_project 5e004fb787698440a387750db7f8028e7cb14cfc)
   Target: mipsel-unknown-linux
   Thread model: posix
   InstalledDir: /opt/cross/clang-5e004fb787/bin
   clang-15: note: diagnostic msg:
   Makefile arch drivers include kernel nr_bisected scripts source usr
--
>> drivers/iio/adc/xilinx-ams.c:384:10: warning: signed shift result (0x446A60000) requires 36 bits to represent, but 'long' only has 32 bits
   = AMS_TEMP_OFFSET;
   ^~~~~~~~~~~~~~~
   drivers/iio/adc/xilinx-ams.h:134:47: note: expanded from macro 'AMS_TEMP_OFFSET'
   #define AMS_TEMP_OFFSET -((280230L << 16) / 509314)
   ~~~~~~~ ^ ~~
>> drivers/iio/adc/xilinx-ams.c:38:20: warning: unused function 'ams_update_reg'
   static inline void ams_update_reg(struct ams unsigned int offset,
   ^
   fatal error: error in backend: Nested variants found in inline asm string: '.if ( 0x00 ) != -1)) 0x00 ) != -1)) : ($( static struct ftrace_branch_data __attribute__((__aligned__(4))) __attribute__((__section__("_ftrace_branch"))) __if_trace = $( .func = __func__, .file = "arch/mips/include/asm/barrier.h", .line = 16, $); 0x00 ) != -1)) : $))) ) && ( (1 << 0) ); .set push; .set mips64r2; .rept 1; sync 0x00; .endr; .set pop; .else; ; .endif'
   PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
   Stack dump:
   0. Program arguments: clang -Wp,-MMD,drivers/iio/adc/.xilinx-ams.o.d -nostdinc -isystem /opt/cross/clang-5e004fb787/lib/clang/15.0.0/include -Iarch/mips/include -I./arch/mips/include/generated -Iinclude -I./include -Iarch/mips/include/uapi -I./arch/mips/include/generated/uapi -Iinclude/uapi -I./include/generated/uapi -include include/linux/compiler-version.h -include include/linux/kconfig.h -include include/linux/compiler_types.h -D__KERNEL__ -DVMLINUX_LOAD_ADDRESS=0xffffffff80000000 -DLINKER_LOAD_ADDRESS=0x80000000 -DDATAOFFSET=0 -Qunused-arguments -fmacro-prefix-map== -DKBUILD_EXTRA_WARN1 -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Wno-format-security -std=gnu89 --target=mipsel-linux -fintegrated-as -Werror=unknown-warning-option -Werror=ignored-optimization-argument -mno-check-zero-division -mabi=32 -G 0 -mno-abicalls -fno-pic -pipe -msoft-float -DGAS_HAS_SET_HARDFLOAT -Wa,-msoft-float -ffreestanding -EL -fno-stack-check -march=mips32 -Wa,--trap -DTOOLCHAIN_SUPPORTS_VIRT -Iarch/mips/include/asm/mach-ralink -Iarch/mips/include/asm/mach-ralink/mt7620 -Iarch/mips/include/asm/mach-generic -fno-asynchronous-unwind-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-address-of-packed-member -Os -Wframe-larger-than=1024 -fstack-protector -Wno-gnu -mno-global-merge -Wno-unused-but-set-variable -Wno-unused-const-variable -ftrivial-auto-var-init=zero -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang -fno-stack-clash-protection -pg -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-array-bounds -fno-strict-overflow -fno-stack-check -Werror=date-time -Werror=incompatible-pointer-types -Wextra -Wunused -Wno-unused-parameter -Wmissing-declarations -Wmissing-format-attribute -Wmissing-prototypes -Wold-style-definition -Wmissing-include-dirs -Wunused-but-set-variable -Wunused-const-variable -Wno-missing-field-initializers -Wno-sign-compare -Wno-type-limits -DMODULE -mlong-calls -DKBUILD_BASENAME="xilinx_ams" -DKBUILD_MODNAME="xilinx_ams" -D__KBUILD_MODNAME=kmod_xilinx_ams -c -o drivers/iio/adc/xilinx-ams.o drivers/iio/adc/xilinx-ams.c
   1. <eof> parser at end of file
   2. Code generation
   3. Running pass 'Function Pass Manager' on module 'drivers/iio/adc/xilinx-ams.c'.
   4. Running pass 'Mips Assembly Printer' on function '@ams_apb_pl_read_reg'
   #0 0x0000561b339a2c6f Signals.cpp:0:0
   #1 0x0000561b339a0a94 llvm::sys::CleanupOnSignal(unsigned long) (/opt/cross/clang-5e004fb787/bin/clang-15+0x34bba94)
   #2 0x0000561b338dfdf7 llvm::CrashRecoveryContext::HandleExit(int) (/opt/cross/clang-5e004fb787/bin/clang-15+0x33fadf7)
   #3 0x0000561b339990ce llvm::sys::Process::Exit(int, bool) (/opt/cross/clang-5e004fb787/bin/clang-15+0x34b40ce)
   #4 0x0000561b315a82db (/opt/cross/clang-5e004fb787/bin/clang-15+0x10c32db)
   #5 0x0000561b338e692c llvm::report_fatal_error(llvm::Twine const&, bool) (/opt/cross/clang-5e004fb787/bin/clang-15+0x340192c)
   #6 0x0000561b346305d0 llvm::AsmPrinter::emitInlineAsm(llvm::MachineInstr const (/opt/cross/clang-5e004fb787/bin/clang-15+0x414b5d0)
   #7 0x0000561b3462c4d2 llvm::AsmPrinter::emitFunctionBody() (/opt/cross/clang-5e004fb787/bin/clang-15+0x41474d2)
   #8 0x0000561b32043817 llvm::MipsAsmPrinter::runOnMachineFunction(llvm::MachineFunction&) (/opt/cross/clang-5e004fb787/bin/clang-15+0x1b5e817)
   #9 0x0000561b32d2b23d llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.53) MachineFunctionPass.cpp:0:0
   #10 0x0000561b33173ef7 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/cross/clang-5e004fb787/bin/clang-15+0x2c8eef7)
   #11 0x0000561b33174071 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/cross/clang-5e004fb787/bin/clang-15+0x2c8f071)
   #12 0x0000561b33174bef llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/cross/clang-5e004fb787/bin/clang-15+0x2c8fbef)
   #13 0x0000561b33cd834f clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream> >) (/opt/cross/clang-5e004fb787/bin/clang-15+0x37f334f)
   #14 0x0000561b3495a011 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/cross/clang-5e004fb787/bin/clang-15+0x4475011)
   #15 0x0000561b354e30c1 clang::ParseAST(clang::Sema&, bool, bool) (/opt/cross/clang-5e004fb787/bin/clang-15+0x4ffe0c1)
   #16 0x0000561b349596d5 clang::CodeGenAction::ExecuteAction() (/opt/cross/clang-5e004fb787/bin/clang-15+0x44746d5)
   #17 0x0000561b3433f981 clang::FrontendAction::Execute() (/opt/cross/clang-5e004fb787/bin/clang-15+0x3e5a981)
   #18 0x0000561b342d3f0a clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/cross/clang-5e004fb787/bin/clang-15+0x3deef0a)
   #19 0x0000561b34406f0b (/opt/cross/clang-5e004fb787/bin/clang-15+0x3f21f0b)
   #20 0x0000561b315a988c cc1_main(llvm::ArrayRef<char char (/opt/cross/clang-5e004fb787/bin/clang-15+0x10c488c)
   #21 0x0000561b315a655b ExecuteCC1Tool(llvm::SmallVectorImpl<char driver.cpp:0:0
   #22 0x0000561b34162c95 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> const::'lambda'()>(long) Job.cpp:0:0
   #23 0x0000561b338dfcb3 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/cross/clang-5e004fb787/bin/clang-15+0x33facb3)
   #24 0x0000561b3416358e clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> const (.part.216) Job.cpp:0:0
   #25 0x0000561b34135917 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const (/opt/cross/clang-5e004fb787/bin/clang-15+0x3c50917)
   #26 0x0000561b341362f7 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command >&) const (/opt/cross/clang-5e004fb787/bin/clang-15+0x3c512f7)
   #27 0x0000561b3413f7ea clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command >&) (/opt/cross/clang-5e004fb787/bin/clang-15+0x3c5a7ea)
   #28 0x0000561b314f299f main (/opt/cross/clang-5e004fb787/bin/clang-15+0x100d99f)
   #29 0x00007fedb55967fd __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x237fd)
   #30 0x0000561b315a607a _start (/opt/cross/clang-5e004fb787/bin/clang-15+0x10c107a)
   clang-15: error: clang frontend command failed with exit code 70 (use -v to see invocation)
   clang version 15.0.0 (git://gitmirror/llvm_project 5e004fb787698440a387750db7f8028e7cb14cfc)
   Target: mipsel-unknown-linux
   Thread model: posix
   InstalledDir: /opt/cross/clang-5e004fb787/bin
   clang-15: note: diagnostic msg:
   Makefile arch drivers include kernel nr_bisected scripts source usr


vim +/long +384 drivers/iio/adc/xilinx-ams.c

   313	
   314	static int ams_read_raw(struct iio_dev *indio_dev,
   315				struct iio_chan_spec const *chan,
   316				int *val, int *val2, long mask)
   317	{
   318		struct ams *ams = iio_priv(indio_dev);
   319	
   320		switch (mask) {
   321		case IIO_CHAN_INFO_RAW:
   322			mutex_lock(&ams->mutex);
   323			if (chan->scan_index >= (PS_SEQ_MAX * 3))
   324				ams_read_vcc_reg(ams, chan->address, val);
   325			else if (chan->scan_index >= PS_SEQ_MAX)
   326				ams->pl_bus->read(ams, chan->address, val);
   327			else
   328				ams_ps_read_reg(ams, chan->address, val);
   329			mutex_unlock(&ams->mutex);
   330	
   331			*val2 = 0;
   332			return IIO_VAL_INT;
   333		case IIO_CHAN_INFO_SCALE:
   334			switch (chan->type) {
   335			case IIO_VOLTAGE:
   336				switch (chan->address) {
   337				case AMS_SUPPLY1:
   338				case AMS_SUPPLY2:
   339				case AMS_SUPPLY3:
   340				case AMS_SUPPLY4:
   341					*val = AMS_SUPPLY_SCALE_3VOLT;
   342					break;
   343				case AMS_SUPPLY5:
   344				case AMS_SUPPLY6:
   345					if (chan->scan_index < PS_SEQ_MAX)
   346						*val = AMS_SUPPLY_SCALE_6VOLT;
   347					else
   348						*val = AMS_SUPPLY_SCALE_3VOLT;
   349					break;
   350				case AMS_SUPPLY7:
   351				case AMS_SUPPLY8:
   352					*val = AMS_SUPPLY_SCALE_6VOLT;
   353					break;
   354				case AMS_SUPPLY9:
   355				case AMS_SUPPLY10:
   356					if (chan->scan_index < PS_SEQ_MAX)
   357						*val = AMS_SUPPLY_SCALE_3VOLT;
   358					else
   359						*val = AMS_SUPPLY_SCALE_6VOLT;
   360					break;
   361				case AMS_VREFP:
   362				case AMS_VREFN:
   363						*val = AMS_SUPPLY_SCALE_3VOLT;
   364					break;
   365	
   366				default:
   367					if (chan->scan_index >= (PS_SEQ_MAX * 3))
   368						*val = AMS_SUPPLY_SCALE_3VOLT;
   369					else
   370						*val = AMS_SUPPLY_SCALE_1VOLT;
   371					break;
   372				}
   373				*val2 = AMS_SUPPLY_SCALE_DIV_BIT;
   374				return IIO_VAL_FRACTIONAL_LOG2;
   375			case IIO_TEMP:
   376				*val = AMS_TEMP_SCALE;
   377				*val2 = AMS_TEMP_SCALE_DIV_BIT;
   378				return IIO_VAL_FRACTIONAL_LOG2;
   379			default:
   380				return -EINVAL;
   381			}
   382		case IIO_CHAN_INFO_OFFSET:
   383			/* Only the temperature channel has an offset */
 > 384			*val = AMS_TEMP_OFFSET;
   385			*val2 = 0;
   386			return IIO_VAL_INT;
   387		}
   388	
   389		return -EINVAL;
   390	}
   391	

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



More information about the linux-arm-kernel mailing list