Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 710790

Summary: sys-kernel/gentoo-sources-5.5.6: Type problem in drivers/hwmon/tmp513.c - regression from 5.5.5
Product: Gentoo Linux Reporter: Phil Stracchino (Unix Ronin) <phils>
Component: Current packagesAssignee: Gentoo Kernel Bug Wranglers and Kernel Maintainers <kernel>
Status: RESOLVED FIXED    
Severity: normal CC: axiator, jstein, marci_r, phils
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: .config file
hwmon: (tmp513) Fix build issue by selecting CONFIG_REGMAP and CONFIG_REGMAP_I2C

Description Phil Stracchino (Unix Ronin) 2020-02-25 16:40:58 UTC
babylon5:root:/usr/src/linux-5.5.6-gentoo:20 # make
  CALL    scripts/checksyscalls.sh
  CALL    scripts/atomic/check-atomics.sh
  DESCEND  objtool
  CHK     include/generated/compile.h
  AR      drivers/hwmon/built-in.a
  CC [M]  drivers/hwmon/tmp513.o
drivers/hwmon/tmp513.c:149:15: error: variable ‘tmp51x_regmap_config’ has initializer but incomplete type
  149 | static struct regmap_config tmp51x_regmap_config = {
      |               ^~~~~~~~~~~~~
drivers/hwmon/tmp513.c:150:3: error: ‘struct regmap_config’ has no member named ‘reg_bits’
  150 |  .reg_bits = 8,
      |   ^~~~~~~~
drivers/hwmon/tmp513.c:150:14: warning: excess elements in struct initializer
  150 |  .reg_bits = 8,
      |              ^
drivers/hwmon/tmp513.c:150:14: note: (near initialization for ‘tmp51x_regmap_config’)
drivers/hwmon/tmp513.c:151:3: error: ‘struct regmap_config’ has no member named ‘val_bits’
  151 |  .val_bits = 16,
      |   ^~~~~~~~
drivers/hwmon/tmp513.c:151:14: warning: excess elements in struct initializer
  151 |  .val_bits = 16,
      |              ^~
drivers/hwmon/tmp513.c:151:14: note: (near initialization for ‘tmp51x_regmap_config’)
drivers/hwmon/tmp513.c:152:3: error: ‘struct regmap_config’ has no member named ‘max_register’
  152 |  .max_register = TMP51X_MAX_REGISTER_ADDR,
      |   ^~~~~~~~~~~~
drivers/hwmon/tmp513.c:74:34: warning: excess elements in struct initializer
   74 | #define TMP51X_MAX_REGISTER_ADDR 0xFF
      |                                  ^~~~
drivers/hwmon/tmp513.c:152:18: note: in expansion of macro ‘TMP51X_MAX_REGISTER_ADDR’
  152 |  .max_register = TMP51X_MAX_REGISTER_ADDR,
      |                  ^~~~~~~~~~~~~~~~~~~~~~~~
drivers/hwmon/tmp513.c:74:34: note: (near initialization for ‘tmp51x_regmap_config’)
   74 | #define TMP51X_MAX_REGISTER_ADDR 0xFF
      |                                  ^~~~
drivers/hwmon/tmp513.c:152:18: note: in expansion of macro ‘TMP51X_MAX_REGISTER_ADDR’
  152 |  .max_register = TMP51X_MAX_REGISTER_ADDR,
      |                  ^~~~~~~~~~~~~~~~~~~~~~~~
drivers/hwmon/tmp513.c: In function ‘tmp51x_probe’:
drivers/hwmon/tmp513.c:735:17: error: implicit declaration of function ‘devm_regmap_init_i2c’ [-Werror=implicit-function-declaration]
  735 |  data->regmap = devm_regmap_init_i2c(client, &tmp51x_regmap_config);
      |                 ^~~~~~~~~~~~~~~~~~~~
drivers/hwmon/tmp513.c:735:15: warning: assignment to ‘struct regmap *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
  735 |  data->regmap = devm_regmap_init_i2c(client, &tmp51x_regmap_config);
      |               ^
drivers/hwmon/tmp513.c: At top level:
drivers/hwmon/tmp513.c:149:29: error: storage size of ‘tmp51x_regmap_config’ isn’t known
  149 | static struct regmap_config tmp51x_regmap_config = {
      |                             ^~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:266: drivers/hwmon/tmp513.o] Error 1
make[1]: *** [scripts/Makefile.build:503: drivers/hwmon] Error 2
make: *** [Makefile:1693: drivers] Error 2


// SPDX-License-Identifier: GPL-2.0
/*
 * Driver for Texas Instruments TMP512, TMP513 power monitor chips
 *



This driver built just fine in gentoo-sources-5.5.5 and earlier.
Comment 1 Mike Pagano gentoo-dev 2020-03-05 14:41:54 UTC
Please attach the output of emerge --info
Have you tried with 5.5.7 ?
Comment 2 Phil Stracchino (Unix Ronin) 2020-03-05 17:01:23 UTC
(In reply to Mike Pagano from comment #1)
> Please attach the output of emerge --info
> Have you tried with 5.5.7 ?

5.5.7 is currently installed (though not active), but I have not re-enabled the tmp513 driver.  I'll give it a shot and report.


babylon5:alaric:~:2 $ emerge -p --info =sys-kernel/gentoo-sources-5.5.6
Portage 2.3.89 (python 3.6.10-final-0, default/linux/amd64/17.1/desktop, gcc-9.2.0, glibc-2.29-r7, 5.4.15-gentoo-babylon5 x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-5.4.15-gentoo-babylon5-x86_64-AMD_Phenom-tm-_II_X6_1090T_Processor-with-gentoo-2.6
KiB Mem:    16399300 total,   1127220 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Thu, 05 Mar 2020 07:00:01 +0000
Head commit of repository gentoo: c502ba7ee66f140b7878f241da84d379e76cef23
Head commit of repository palemoon: 776b815f1dafb9db463124bd260871ada366568c

sh bash 4.4_p23-r1
ld GNU ld (Gentoo 2.32 p2) 2.32.0
app-shells/bash:          4.4_p23-r1::gentoo
dev-java/java-config:     2.2.0-r4::gentoo
dev-lang/perl:            5.30.1::gentoo
dev-lang/python:          2.7.17-r1::gentoo, 3.6.10::gentoo, 3.7.6::gentoo
dev-util/cmake:           3.16.4::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.6-r1::gentoo
sys-apps/openrc:          0.42.1::gentoo
sys-apps/sandbox:         2.13::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r4::gentoo
sys-devel/automake:       1.16.1-r1::gentoo
sys-devel/binutils:       2.32-r1::gentoo, 2.33.1-r1::gentoo
sys-devel/gcc:            9.2.0-r2::gentoo
sys-devel/gcc-config:     2.2::gentoo
sys-devel/libtool:        2.4.6-r6::gentoo
sys-devel/make:           4.2.1-r4::gentoo
sys-kernel/linux-headers: 5.5::gentoo (virtual/os-headers)
sys-libs/glibc:           2.29-r7::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://minbar.caerllewys.net/gentoo-portage
    priority: -1000
    sync-rsync-extra-opts:
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-metamanifest: yes
    sync-rsync-verify-max-age: 24

gentoo-dev-alaric
    location: /var/lib/alaric
    masters: gentoo

palemoon
    location: /var/db/repos/palemoon
    sync-type: git
    sync-uri: https://github.com/deu/palemoon-overlay.git
    masters: gentoo

brother-overlay
    location: /var/lib/layman/brother-overlay
    sync-type: laymansync
    sync-uri: https://github.com/stefan-langenmaier/brother-overlay.git
    masters: gentoo
    priority: 50

jorgicio
    location: /var/lib/layman/jorgicio
    sync-type: laymansync
    sync-uri: https://github.com/jorgicio/jorgicio-gentoo.git
    masters: gentoo
    priority: 50

maggu2810-overlay
    location: /var/lib/layman/maggu2810-overlay
    sync-type: laymansync
    sync-uri: git://github.com/maggu2810/maggu2810-overlay.git
    masters: gentoo
    priority: 50

mysql
    location: /var/lib/layman/mysql
    sync-type: laymansync
    sync-uri: https://anongit.gentoo.org/git/proj/mysql.git
    masters: gentoo
    priority: 50

seeds
    location: /var/lib/layman/seeds
    sync-type: laymansync
    sync-uri: git://github.com/vonavi/seeds.git
    masters: gentoo
    priority: 50

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=amdfam10 -O2 -pipe -mfpmath=sse -mcx16 -mpopcnt"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt /var/bind /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=amdfam10 -O2 -pipe -mfpmath=sse -mcx16 -mpopcnt"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--with-bdeps=y --verbose-conflicts --keep-going"
ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://gentoo.osuosl.org                 http://www.gtlib.gatech.edu/pub/gentoo                 http://mirrors.cs.wmich.edu/gentoo                 http://distfiles.gentoo.org                 "
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en_US en"
MAKEOPTS="-j6"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="3dnow 3dnowext X a52 aac acl acpi alsa amd64 bash-completion berkdb branding bzip2 cairo cdda cddb cdr cli consolekit crypt cups cxx dbus dri dts dvd dvdr emboss encode exif ffmpeg flac fltk fortran gdbm gif gpm gtk iconv icu id3tag imagemagick ipv6 java jpeg jpeg2k lcms ldap libnotify libtirpc mad mmx mmxext mng mp3 mp4 mpeg multilib mysql ncurses nls nptl nsplugin nvidia ogg opengl openmp opus pam pango pcre pcsc-lite pdf png policykit ppds qt5 readline sdl seccomp spell split-usr sse sse2 sse4 ssl startup-notification svg tcpd theora threads tiff tk tools truetype udev udisks unicode upower usb utils v4l v4l2 vdpau vorbis vpx wxwidgets x264 xattr xcb xml xpm xv xvid xvmc zlib" ABI_X86="64" ADA_TARGET="gnat_2018" ALSA_CARDS="emu10k1 hda-intel" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="3dnow 3dnowext mmx mmxext popcnt sse sse2 sse3 sse4a" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="evdev keyboard mouse" KERNEL="linux" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-2" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_6" PYTHON_TARGETS="python2_7 python3_6" RUBY_TARGETS="ruby24 ruby25" USERLAND="GNU" VIDEO_CARDS="nvidia v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, LC_ALL, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 3 Phil Stracchino (Unix Ronin) 2020-03-05 17:58:11 UTC
OK, I can confirm the problem is still present in 5.5.7.
Comment 4 Mike Pagano gentoo-dev 2020-03-20 22:50:52 UTC
Sorry, my responses are slow. I'm in healthcare and it's been a tough week.
Can you also attach your .config, please?
Comment 5 Phil Stracchino (Unix Ronin) 2020-03-20 23:02:28 UTC
(In reply to Mike Pagano from comment #4)
> Sorry, my responses are slow. I'm in healthcare and it's been a tough week.
> Can you also attach your .config, please?

Keep up the good work, man.  You guys have it rougher than anyone right now.


Config will be attached in a moment, but note that this is with CONFIG_SENSORS_TMP513 disabled in order to be able to build it.
Comment 6 Phil Stracchino (Unix Ronin) 2020-03-20 23:03:45 UTC
Created attachment 623522 [details]
.config file

CONFIG_SENSORS_TMP513 disabled to allow building
Comment 7 Mike Pagano gentoo-dev 2020-03-20 23:40:37 UTC
Thanks for the .config. It fails for me also with the driver enabled. I'll be looking at this over the weekend.
Comment 8 Mike Pagano gentoo-dev 2020-03-21 22:26:13 UTC
TLDR: I was able to compile the driver with CONFIG_REGMAP=y and CONFIG_REGMAP_I2C=y

But to get REGMAP_I2C selected, I had to select TMP108 (that's an upstream patch that's needed.)

Long version

First error:
error: variable ‘tmp51x_regmap_config’ has initializer but incomplete type

Code: tmp513.c
static struct regmap_config tmp51x_regmap_config = {

Problem:
What that error means is regmap_config is undefined

But, tmp513.c has #include <linux/regmap.h>

Let's look in include/linux/regmap.h
Here you find on line 352 (5.5.11), the regmap_config is defined
struct regmap_config

If you look above it's only defined if CONFIG_REGMAP is defined.

So,  I needed to define CONFIG_REGMAP.

Then, i got this error:
undefined reference to `__devm_regmap_init_i2c'

And I needed to compile with: CONFIG_REGMAP_I2C
But I should not have to select this. The SENSOR_TMP513 is missing in the Kconfig here. 

So I had to choose TMP108, to get REGMAP_I2C selected. Ug. 

Then it all worked. So, I think there's a Kconfig patch needed here :)

Can you try that workaround and let me know how it goes?
Comment 9 Phil Stracchino (Unix Ronin) 2020-03-21 22:46:52 UTC
So to make sure I understand correctly:

To make CONFIG_SENSORS_TMP513 work, it is necessary to set CONFIG_SENSORS_TMP108 *AND* edit include/linux/regmap.h to manually define CONFIG_REGMAP?
Comment 10 Mike Pagano gentoo-dev 2020-03-22 11:51:52 UTC
Created attachment 624168 [details, diff]
hwmon: (tmp513) Fix build issue by selecting CONFIG_REGMAP and CONFIG_REGMAP_I2C

Apply this patch (it applies to 5.5.11) and just select tmp513 as normal.
Comment 11 Phil Stracchino (Unix Ronin) 2020-03-22 17:38:38 UTC
(In reply to Mike Pagano from comment #10)
> Created attachment 624168 [details, diff] [details, diff]
> hwmon: (tmp513) Fix build issue by selecting CONFIG_REGMAP and
> CONFIG_REGMAP_I2C
> 
> Apply this patch (it applies to 5.5.11) and just select tmp513 as normal.

Testing now ...

... and it looks fine.

  LD [M]  drivers/hwmon/asb100.ko
  LD [M]  drivers/hwmon/asus_atk0110.ko
  LD [M]  drivers/hwmon/hwmon-vid.ko
  LD [M]  drivers/hwmon/i5500_temp.ko
  LD [M]  drivers/hwmon/it87.ko
  LD [M]  drivers/hwmon/mcp3021.ko
  LD [M]  drivers/hwmon/jc42.ko
  LD [M]  drivers/hwmon/pmbus/pmbus.ko
  LD [M]  drivers/hwmon/pmbus/pmbus_core.ko
  LD [M]  drivers/hwmon/tmp513.ko


  INSTALL drivers/hwmon/pmbus/pmbus.ko
  INSTALL drivers/hwmon/pmbus/pmbus_core.ko
  INSTALL drivers/hwmon/tmp513.ko
Comment 12 Mike Pagano gentoo-dev 2020-04-01 20:15:48 UTC
This is the latest gentoo-sources 5.5 and 5.6