net/netfilter/nft_exthdr.c:264:33: sparse: sparse: incorrect type in assignment (different base types)
by kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 8ab774587903771821b59471cc723bba6d893942
commit: 803f4e1eab7a8938ba3a3c30dd4eb5e9eeef5e63 asm-generic: simplify asm/unaligned.h
date: 6 months ago
config: i386-randconfig-s031-20211116 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit...
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 803f4e1eab7a8938ba3a3c30dd4eb5e9eeef5e63
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
sparse warnings: (new ones prefixed by >>)
>> net/netfilter/nft_exthdr.c:264:33: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be16 [usertype] v16 @@ got unsigned short x @@
net/netfilter/nft_exthdr.c:264:33: sparse: expected restricted __be16 [usertype] v16
net/netfilter/nft_exthdr.c:264:33: sparse: got unsigned short x
>> net/netfilter/nft_exthdr.c:279:25: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short x @@ got restricted __be16 [assigned] [usertype] v16 @@
net/netfilter/nft_exthdr.c:279:25: sparse: expected unsigned short x
net/netfilter/nft_exthdr.c:279:25: sparse: got restricted __be16 [assigned] [usertype] v16
net/netfilter/nft_exthdr.c:284:33: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be32 [assigned] [usertype] v32 @@ got unsigned int @@
net/netfilter/nft_exthdr.c:284:33: sparse: expected restricted __be32 [assigned] [usertype] v32
net/netfilter/nft_exthdr.c:284:33: sparse: got unsigned int
>> net/netfilter/nft_exthdr.c:285:33: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be32 [usertype] v32 @@ got unsigned int x @@
net/netfilter/nft_exthdr.c:285:33: sparse: expected restricted __be32 [usertype] v32
net/netfilter/nft_exthdr.c:285:33: sparse: got unsigned int x
>> net/netfilter/nft_exthdr.c:290:25: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int x @@ got restricted __be32 [assigned] [usertype] v32 @@
net/netfilter/nft_exthdr.c:290:25: sparse: expected unsigned int x
net/netfilter/nft_exthdr.c:290:25: sparse: got restricted __be32 [assigned] [usertype] v32
vim +264 net/netfilter/nft_exthdr.c
935b7f64301887 Manuel Messner 2017-02-07 221
99d1712bc41c7c Florian Westphal 2017-08-08 222 static void nft_exthdr_tcp_set_eval(const struct nft_expr *expr,
99d1712bc41c7c Florian Westphal 2017-08-08 223 struct nft_regs *regs,
99d1712bc41c7c Florian Westphal 2017-08-08 224 const struct nft_pktinfo *pkt)
99d1712bc41c7c Florian Westphal 2017-08-08 225 {
99d1712bc41c7c Florian Westphal 2017-08-08 226 u8 buff[sizeof(struct tcphdr) + MAX_TCP_OPTION_SPACE];
99d1712bc41c7c Florian Westphal 2017-08-08 227 struct nft_exthdr *priv = nft_expr_priv(expr);
99d1712bc41c7c Florian Westphal 2017-08-08 228 unsigned int i, optl, tcphdr_len, offset;
99d1712bc41c7c Florian Westphal 2017-08-08 229 struct tcphdr *tcph;
99d1712bc41c7c Florian Westphal 2017-08-08 230 u8 *opt;
99d1712bc41c7c Florian Westphal 2017-08-08 231
99d1712bc41c7c Florian Westphal 2017-08-08 232 tcph = nft_tcp_header_pointer(pkt, sizeof(buff), buff, &tcphdr_len);
99d1712bc41c7c Florian Westphal 2017-08-08 233 if (!tcph)
99d1712bc41c7c Florian Westphal 2017-08-08 234 return;
99d1712bc41c7c Florian Westphal 2017-08-08 235
99d1712bc41c7c Florian Westphal 2017-08-08 236 opt = (u8 *)tcph;
99d1712bc41c7c Florian Westphal 2017-08-08 237 for (i = sizeof(*tcph); i < tcphdr_len - 1; i += optl) {
99d1712bc41c7c Florian Westphal 2017-08-08 238 union {
99d1712bc41c7c Florian Westphal 2017-08-08 239 __be16 v16;
99d1712bc41c7c Florian Westphal 2017-08-08 240 __be32 v32;
99d1712bc41c7c Florian Westphal 2017-08-08 241 } old, new;
99d1712bc41c7c Florian Westphal 2017-08-08 242
99d1712bc41c7c Florian Westphal 2017-08-08 243 optl = optlen(opt, i);
99d1712bc41c7c Florian Westphal 2017-08-08 244
99d1712bc41c7c Florian Westphal 2017-08-08 245 if (priv->type != opt[i])
99d1712bc41c7c Florian Westphal 2017-08-08 246 continue;
99d1712bc41c7c Florian Westphal 2017-08-08 247
99d1712bc41c7c Florian Westphal 2017-08-08 248 if (i + optl > tcphdr_len || priv->len + priv->offset > optl)
99d1712bc41c7c Florian Westphal 2017-08-08 249 return;
99d1712bc41c7c Florian Westphal 2017-08-08 250
7418ee4c8810e4 Florian Westphal 2019-05-23 251 if (skb_ensure_writable(pkt->skb,
7418ee4c8810e4 Florian Westphal 2019-05-23 252 pkt->xt.thoff + i + priv->len))
99d1712bc41c7c Florian Westphal 2017-08-08 253 return;
99d1712bc41c7c Florian Westphal 2017-08-08 254
99d1712bc41c7c Florian Westphal 2017-08-08 255 tcph = nft_tcp_header_pointer(pkt, sizeof(buff), buff,
99d1712bc41c7c Florian Westphal 2017-08-08 256 &tcphdr_len);
99d1712bc41c7c Florian Westphal 2017-08-08 257 if (!tcph)
99d1712bc41c7c Florian Westphal 2017-08-08 258 return;
99d1712bc41c7c Florian Westphal 2017-08-08 259
99d1712bc41c7c Florian Westphal 2017-08-08 260 offset = i + priv->offset;
99d1712bc41c7c Florian Westphal 2017-08-08 261
99d1712bc41c7c Florian Westphal 2017-08-08 262 switch (priv->len) {
99d1712bc41c7c Florian Westphal 2017-08-08 263 case 2:
99d1712bc41c7c Florian Westphal 2017-08-08 @264 old.v16 = get_unaligned((u16 *)(opt + offset));
2e34328b396a69 Sergey Marinkevich 2020-03-29 265 new.v16 = (__force __be16)nft_reg_load16(
2e34328b396a69 Sergey Marinkevich 2020-03-29 266 ®s->data[priv->sreg]);
99d1712bc41c7c Florian Westphal 2017-08-08 267
99d1712bc41c7c Florian Westphal 2017-08-08 268 switch (priv->type) {
99d1712bc41c7c Florian Westphal 2017-08-08 269 case TCPOPT_MSS:
99d1712bc41c7c Florian Westphal 2017-08-08 270 /* increase can cause connection to stall */
99d1712bc41c7c Florian Westphal 2017-08-08 271 if (ntohs(old.v16) <= ntohs(new.v16))
99d1712bc41c7c Florian Westphal 2017-08-08 272 return;
99d1712bc41c7c Florian Westphal 2017-08-08 273 break;
99d1712bc41c7c Florian Westphal 2017-08-08 274 }
99d1712bc41c7c Florian Westphal 2017-08-08 275
99d1712bc41c7c Florian Westphal 2017-08-08 276 if (old.v16 == new.v16)
99d1712bc41c7c Florian Westphal 2017-08-08 277 return;
99d1712bc41c7c Florian Westphal 2017-08-08 278
99d1712bc41c7c Florian Westphal 2017-08-08 @279 put_unaligned(new.v16, (u16*)(opt + offset));
99d1712bc41c7c Florian Westphal 2017-08-08 280 inet_proto_csum_replace2(&tcph->check, pkt->skb,
99d1712bc41c7c Florian Westphal 2017-08-08 281 old.v16, new.v16, false);
99d1712bc41c7c Florian Westphal 2017-08-08 282 break;
99d1712bc41c7c Florian Westphal 2017-08-08 283 case 4:
2e34328b396a69 Sergey Marinkevich 2020-03-29 284 new.v32 = regs->data[priv->sreg];
99d1712bc41c7c Florian Westphal 2017-08-08 @285 old.v32 = get_unaligned((u32 *)(opt + offset));
99d1712bc41c7c Florian Westphal 2017-08-08 286
99d1712bc41c7c Florian Westphal 2017-08-08 287 if (old.v32 == new.v32)
99d1712bc41c7c Florian Westphal 2017-08-08 288 return;
99d1712bc41c7c Florian Westphal 2017-08-08 289
99d1712bc41c7c Florian Westphal 2017-08-08 @290 put_unaligned(new.v32, (u32*)(opt + offset));
99d1712bc41c7c Florian Westphal 2017-08-08 291 inet_proto_csum_replace4(&tcph->check, pkt->skb,
99d1712bc41c7c Florian Westphal 2017-08-08 292 old.v32, new.v32, false);
99d1712bc41c7c Florian Westphal 2017-08-08 293 break;
99d1712bc41c7c Florian Westphal 2017-08-08 294 default:
99d1712bc41c7c Florian Westphal 2017-08-08 295 WARN_ON_ONCE(1);
99d1712bc41c7c Florian Westphal 2017-08-08 296 break;
99d1712bc41c7c Florian Westphal 2017-08-08 297 }
99d1712bc41c7c Florian Westphal 2017-08-08 298
99d1712bc41c7c Florian Westphal 2017-08-08 299 return;
99d1712bc41c7c Florian Westphal 2017-08-08 300 }
99d1712bc41c7c Florian Westphal 2017-08-08 301 }
99d1712bc41c7c Florian Westphal 2017-08-08 302
:::::: The code at line 264 was first introduced by commit
:::::: 99d1712bc41c7c9a5a473c104a4ad15427757b22 netfilter: exthdr: tcp option set support
:::::: TO: Florian Westphal <fw(a)strlen.de>
:::::: CC: Pablo Neira Ayuso <pablo(a)netfilter.org>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
10 months, 1 week
[jgunthorpe:iommufd 2/8] drivers/iommu/iommufd/io_pagetable.c:1212:5: warning: no previous prototype for 'iopt_access_pages'
by kernel test robot
tree: https://github.com/jgunthorpe/linux iommufd
head: 4d06b5807e799e0293171d872d8c1a40f3b466c5
commit: 60716d1561f09cff04bd92ceb6007cc04d309469 [2/8] iommufd: Data structure to provide IOVA to PFN mapping
config: arc-allyesconfig (attached as .config)
compiler: arceb-elf-gcc (GCC) 11.2.0
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
# https://github.com/jgunthorpe/linux/commit/60716d1561f09cff04bd92ceb6007c...
git remote add jgunthorpe https://github.com/jgunthorpe/linux
git fetch --no-tags jgunthorpe iommufd
git checkout 60716d1561f09cff04bd92ceb6007cc04d309469
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=arc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
>> drivers/iommu/iommufd/io_pagetable.c:1212:5: warning: no previous prototype for 'iopt_access_pages' [-Wmissing-prototypes]
1212 | int iopt_access_pages(struct io_pagetable *iopt, unsigned long iova,
| ^~~~~~~~~~~~~~~~~
In file included from include/linux/mm.h:30,
from drivers/iommu/iommufd/io_pagetable.c:28:
drivers/iommu/iommufd/io_pagetable.c: In function 'iopt_access_pages':
>> include/linux/overflow.h:84:22: warning: comparison of distinct pointer types lacks a cast
84 | (void) (&__a == &__b); \
| ^~
drivers/iommu/iommufd/io_pagetable.c:1224:13: note: in expansion of macro 'check_mul_overflow'
1224 | if (check_mul_overflow(npages, PAGE_SIZE, &length) ||
| ^~~~~~~~~~~~~~~~~~
include/linux/overflow.h:66:22: warning: comparison of distinct pointer types lacks a cast
66 | (void) (&__a == &__b); \
| ^~
drivers/iommu/iommufd/io_pagetable.c:1225:13: note: in expansion of macro 'check_add_overflow'
1225 | check_add_overflow(iova, length - 1, &iova_end))
| ^~~~~~~~~~~~~~~~~~
drivers/iommu/iommufd/io_pagetable.c: In function 'iopt_unaccess_pages':
>> include/linux/overflow.h:84:22: warning: comparison of distinct pointer types lacks a cast
84 | (void) (&__a == &__b); \
| ^~
drivers/iommu/iommufd/io_pagetable.c:1280:13: note: in expansion of macro 'check_mul_overflow'
1280 | if (check_mul_overflow(npages, PAGE_SIZE, &length) ||
| ^~~~~~~~~~~~~~~~~~
include/linux/overflow.h:66:22: warning: comparison of distinct pointer types lacks a cast
66 | (void) (&__a == &__b); \
| ^~
drivers/iommu/iommufd/io_pagetable.c:1281:13: note: in expansion of macro 'check_add_overflow'
1281 | check_add_overflow(iova, length - 1, &iova_end))
| ^~~~~~~~~~~~~~~~~~
vim +/iopt_access_pages +1212 drivers/iommu/iommufd/io_pagetable.c
1200
1201 /**
1202 * iopt_access_pages - Return a list of pages under the iova
1203 *
1204 * Reads @npages starting at iova and returns the struct page * pointers. These
1205 * can be kmap'd by the caller for CPU access.
1206 *
1207 * The caller must perform iopt_unaccess_pages() when done to balance this.
1208 *
1209 * CHECKME: callers that need a DMA mapping via a sgl should create another
1210 * interface to build the SGL efficiently)
1211 */
> 1212 int iopt_access_pages(struct io_pagetable *iopt, unsigned long iova,
1213 size_t npages, struct page **out_pages, bool write)
1214 {
1215 unsigned long cur_iova;
1216 unsigned long iova_end;
1217 struct iopt_area *area;
1218 size_t length;
1219 int rc;
1220
1221 down_read(&iopt->rwsem);
1222 if (!npages || iova % PAGE_SIZE)
1223 return -EINVAL;
1224 if (check_mul_overflow(npages, PAGE_SIZE, &length) ||
1225 check_add_overflow(iova, length - 1, &iova_end))
1226 return -EOVERFLOW;
1227
1228 cur_iova = iova;
1229 for (area = iopt_area_iter_first(iopt, iova, iova_end); area;
1230 area = iopt_area_iter_next(area, iova, iova_end)) {
1231 unsigned long intr_start = max(iova, iopt_area_iova(area));
1232 unsigned long intr_end =
1233 min(iova_end, iopt_area_last_iova(area));
1234 size_t npages = (intr_end - intr_start + 1) / PAGE_SIZE;
1235
1236 /* Need contiguous areas un the access */
1237 if (cur_iova != intr_start) {
1238 rc = -EINVAL;
1239 goto out_remove;
1240 }
1241
1242 npages = (intr_end - intr_start + 1) / PAGE_SIZE;
1243 rc = iopt_pages_add_user(
1244 area->pages,
1245 (intr_start - iopt_area_iova(area)) / PAGE_SIZE, npages,
1246 out_pages + (intr_end - iopt_area_iova(area) + 1) /
1247 PAGE_SIZE,
1248 write);
1249 if (rc)
1250 goto out_remove;
1251 cur_iova += npages * PAGE_SIZE;
1252 atomic_inc(&area->num_users);
1253 }
1254
1255 up_read(&iopt->rwsem);
1256 return 0;
1257
1258 out_remove:
1259 iopt_unaccess_pages(iopt, iova, (cur_iova - iova) / PAGE_SIZE);
1260 return rc;
1261 }
1262
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
10 months, 1 week
Re: [PATCH] drivers/md: fix potential memleak
by kernel test robot
Hi Bernard,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on song-md/md-next]
[also build test ERROR on v5.16-rc1 next-20211117]
[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/0day-ci/linux/commits/Bernard-Zhao/drivers-md-fix-pote...
base: git://git.kernel.org/pub/scm/linux/kernel/git/song/md.git md-next
config: x86_64-rhel-8.3-func (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/0d67c5d17f8404c6975f34e0c0edccdaa...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Bernard-Zhao/drivers-md-fix-potential-memleak/20211115-112133
git checkout 0d67c5d17f8404c6975f34e0c0edccdaa9ab913d
# save the attached .config to linux build tree
mkdir build_dir
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/iommu/ drivers/md/ drivers/misc/sgi-gru/ fs/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
drivers/md/md-bitmap.c: In function 'get_bitmap_from_slot':
>> drivers/md/md-bitmap.c:1964:27: error: expected ';' before 'return'
1964 | md_bitmap_destroy(mddev)
| ^
| ;
1965 | return ERR_PTR(rv);
| ~~~~~~
vim +1964 drivers/md/md-bitmap.c
1954
1955 /* caller need to free returned bitmap with md_bitmap_free() */
1956 struct bitmap *get_bitmap_from_slot(struct mddev *mddev, int slot)
1957 {
1958 int rv = 0;
1959 struct bitmap *bitmap;
1960
1961 bitmap = md_bitmap_create(mddev, slot);
1962 if (IS_ERR(bitmap)) {
1963 rv = PTR_ERR(bitmap);
> 1964 md_bitmap_destroy(mddev)
1965 return ERR_PTR(rv);
1966 }
1967
1968 rv = md_bitmap_init_from_disk(bitmap, 0);
1969 if (rv) {
1970 md_bitmap_free(bitmap);
1971 return ERR_PTR(rv);
1972 }
1973
1974 return bitmap;
1975 }
1976 EXPORT_SYMBOL(get_bitmap_from_slot);
1977
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
10 months, 1 week
Re: [PATCH v19 1/4] Add flags option to get xattr method paired to __vfs_getxattr
by kernel test robot
Hi David,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on linus/master]
[also build test ERROR on v5.16-rc1 next-20211117]
[cannot apply to mszeredi-vfs/overlayfs-next tytso-ext4/dev jmorris-security/next-testing]
[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/0day-ci/linux/commits/David-Anderson/overlayfs-overrid...
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 8ab774587903771821b59471cc723bba6d893942
config: arm-randconfig-c002-20211116 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 11.2.0
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
# https://github.com/0day-ci/linux/commit/73277167dc9cad1e636a76e9f993d8f30...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review David-Anderson/overlayfs-override_creds-off-nested-get-xattr-fix/20211117-100030
git checkout 73277167dc9cad1e636a76e9f993d8f30b289d02
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=arm
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
In file included from fs/open.c:19:
include/linux/security.h: In function 'security_inode_need_killpriv':
>> include/linux/security.h:901:40: error: passing argument 1 of 'cap_inode_need_killpriv' from incompatible pointer type [-Werror=incompatible-pointer-types]
901 | return cap_inode_need_killpriv(dentry);
| ^~~~~~
| |
| struct dentry *
include/linux/security.h:153:52: note: expected 'struct user_namespace *' but argument is of type 'struct dentry *'
153 | int cap_inode_need_killpriv(struct user_namespace *mnt_userns,
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
>> include/linux/security.h:901:16: error: too few arguments to function 'cap_inode_need_killpriv'
901 | return cap_inode_need_killpriv(dentry);
| ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/security.h:153:5: note: declared here
153 | int cap_inode_need_killpriv(struct user_namespace *mnt_userns,
| ^~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
--
In file included from include/linux/fs_context.h:14,
from include/linux/pseudo_fs.h:4,
from fs/pipe.c:17:
include/linux/security.h: In function 'security_inode_need_killpriv':
>> include/linux/security.h:901:40: error: passing argument 1 of 'cap_inode_need_killpriv' from incompatible pointer type [-Werror=incompatible-pointer-types]
901 | return cap_inode_need_killpriv(dentry);
| ^~~~~~
| |
| struct dentry *
include/linux/security.h:153:52: note: expected 'struct user_namespace *' but argument is of type 'struct dentry *'
153 | int cap_inode_need_killpriv(struct user_namespace *mnt_userns,
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
>> include/linux/security.h:901:16: error: too few arguments to function 'cap_inode_need_killpriv'
901 | return cap_inode_need_killpriv(dentry);
| ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/security.h:153:5: note: declared here
153 | int cap_inode_need_killpriv(struct user_namespace *mnt_userns,
| ^~~~~~~~~~~~~~~~~~~~~~~
fs/pipe.c: At top level:
fs/pipe.c:755:15: warning: no previous prototype for 'account_pipe_buffers' [-Wmissing-prototypes]
755 | unsigned long account_pipe_buffers(struct user_struct *user,
| ^~~~~~~~~~~~~~~~~~~~
fs/pipe.c:761:6: warning: no previous prototype for 'too_many_pipe_buffers_soft' [-Wmissing-prototypes]
761 | bool too_many_pipe_buffers_soft(unsigned long user_bufs)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
fs/pipe.c:768:6: warning: no previous prototype for 'too_many_pipe_buffers_hard' [-Wmissing-prototypes]
768 | bool too_many_pipe_buffers_hard(unsigned long user_bufs)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
fs/pipe.c:775:6: warning: no previous prototype for 'pipe_is_unprivileged_user' [-Wmissing-prototypes]
775 | bool pipe_is_unprivileged_user(void)
| ^~~~~~~~~~~~~~~~~~~~~~~~~
fs/pipe.c:1245:5: warning: no previous prototype for 'pipe_resize_ring' [-Wmissing-prototypes]
1245 | int pipe_resize_ring(struct pipe_inode_info *pipe, unsigned int nr_slots)
| ^~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
--
In file included from fs/inode.c:12:
include/linux/security.h: In function 'security_inode_need_killpriv':
>> include/linux/security.h:901:40: error: passing argument 1 of 'cap_inode_need_killpriv' from incompatible pointer type [-Werror=incompatible-pointer-types]
901 | return cap_inode_need_killpriv(dentry);
| ^~~~~~
| |
| struct dentry *
include/linux/security.h:153:52: note: expected 'struct user_namespace *' but argument is of type 'struct dentry *'
153 | int cap_inode_need_killpriv(struct user_namespace *mnt_userns,
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
>> include/linux/security.h:901:16: error: too few arguments to function 'cap_inode_need_killpriv'
901 | return cap_inode_need_killpriv(dentry);
| ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/security.h:153:5: note: declared here
153 | int cap_inode_need_killpriv(struct user_namespace *mnt_userns,
| ^~~~~~~~~~~~~~~~~~~~~~~
fs/inode.c: In function 'dentry_needs_remove_privs':
>> fs/inode.c:1921:44: error: passing argument 1 of 'security_inode_need_killpriv' from incompatible pointer type [-Werror=incompatible-pointer-types]
1921 | ret = security_inode_need_killpriv(mnt_userns, dentry);
| ^~~~~~~~~~
| |
| struct user_namespace *
In file included from fs/inode.c:12:
include/linux/security.h:899:63: note: expected 'struct dentry *' but argument is of type 'struct user_namespace *'
899 | static inline int security_inode_need_killpriv(struct dentry *dentry)
| ~~~~~~~~~~~~~~~^~~~~~
>> fs/inode.c:1921:15: error: too many arguments to function 'security_inode_need_killpriv'
1921 | ret = security_inode_need_killpriv(mnt_userns, dentry);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from fs/inode.c:12:
include/linux/security.h:899:19: note: declared here
899 | static inline int security_inode_need_killpriv(struct dentry *dentry)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/security.h: In function 'security_inode_need_killpriv':
include/linux/security.h:902:1: error: control reaches end of non-void function [-Werror=return-type]
902 | }
| ^
cc1: some warnings being treated as errors
--
In file included from fs/attr.c:17:
include/linux/security.h: In function 'security_inode_need_killpriv':
>> include/linux/security.h:901:40: error: passing argument 1 of 'cap_inode_need_killpriv' from incompatible pointer type [-Werror=incompatible-pointer-types]
901 | return cap_inode_need_killpriv(dentry);
| ^~~~~~
| |
| struct dentry *
include/linux/security.h:153:52: note: expected 'struct user_namespace *' but argument is of type 'struct dentry *'
153 | int cap_inode_need_killpriv(struct user_namespace *mnt_userns,
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
>> include/linux/security.h:901:16: error: too few arguments to function 'cap_inode_need_killpriv'
901 | return cap_inode_need_killpriv(dentry);
| ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/security.h:153:5: note: declared here
153 | int cap_inode_need_killpriv(struct user_namespace *mnt_userns,
| ^~~~~~~~~~~~~~~~~~~~~~~
fs/attr.c: In function 'notify_change':
>> fs/attr.c:345:54: error: passing argument 1 of 'security_inode_need_killpriv' from incompatible pointer type [-Werror=incompatible-pointer-types]
345 | error = security_inode_need_killpriv(mnt_userns, dentry);
| ^~~~~~~~~~
| |
| struct user_namespace *
In file included from fs/attr.c:17:
include/linux/security.h:899:63: note: expected 'struct dentry *' but argument is of type 'struct user_namespace *'
899 | static inline int security_inode_need_killpriv(struct dentry *dentry)
| ~~~~~~~~~~~~~~~^~~~~~
>> fs/attr.c:345:25: error: too many arguments to function 'security_inode_need_killpriv'
345 | error = security_inode_need_killpriv(mnt_userns, dentry);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from fs/attr.c:17:
include/linux/security.h:899:19: note: declared here
899 | static inline int security_inode_need_killpriv(struct dentry *dentry)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/security.h: In function 'security_inode_need_killpriv':
include/linux/security.h:902:1: error: control reaches end of non-void function [-Werror=return-type]
902 | }
| ^
cc1: some warnings being treated as errors
--
In file included from include/linux/perf_event.h:59,
from include/linux/trace_events.h:10,
from include/trace/syscall.h:7,
from include/linux/syscalls.h:88,
from fs/d_path.c:2:
include/linux/security.h: In function 'security_inode_need_killpriv':
>> include/linux/security.h:901:40: error: passing argument 1 of 'cap_inode_need_killpriv' from incompatible pointer type [-Werror=incompatible-pointer-types]
901 | return cap_inode_need_killpriv(dentry);
| ^~~~~~
| |
| struct dentry *
include/linux/security.h:153:52: note: expected 'struct user_namespace *' but argument is of type 'struct dentry *'
153 | int cap_inode_need_killpriv(struct user_namespace *mnt_userns,
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
>> include/linux/security.h:901:16: error: too few arguments to function 'cap_inode_need_killpriv'
901 | return cap_inode_need_killpriv(dentry);
| ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/security.h:153:5: note: declared here
153 | int cap_inode_need_killpriv(struct user_namespace *mnt_userns,
| ^~~~~~~~~~~~~~~~~~~~~~~
fs/d_path.c: At top level:
fs/d_path.c:318:7: warning: no previous prototype for 'simple_dname' [-Wmissing-prototypes]
318 | char *simple_dname(struct dentry *dentry, char *buffer, int buflen)
| ^~~~~~~~~~~~
cc1: some warnings being treated as errors
--
In file included from kernel/trace/trace.c:20:
include/linux/security.h: In function 'security_inode_need_killpriv':
>> include/linux/security.h:901:40: error: passing argument 1 of 'cap_inode_need_killpriv' from incompatible pointer type [-Werror=incompatible-pointer-types]
901 | return cap_inode_need_killpriv(dentry);
| ^~~~~~
| |
| struct dentry *
include/linux/security.h:153:52: note: expected 'struct user_namespace *' but argument is of type 'struct dentry *'
153 | int cap_inode_need_killpriv(struct user_namespace *mnt_userns,
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
>> include/linux/security.h:901:16: error: too few arguments to function 'cap_inode_need_killpriv'
901 | return cap_inode_need_killpriv(dentry);
| ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/security.h:153:5: note: declared here
153 | int cap_inode_need_killpriv(struct user_namespace *mnt_userns,
| ^~~~~~~~~~~~~~~~~~~~~~~
kernel/trace/trace.c: In function 'trace_check_vprintf':
kernel/trace/trace.c:3813:17: warning: function 'trace_check_vprintf' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
3813 | trace_seq_vprintf(&iter->seq, iter->fmt, ap);
| ^~~~~~~~~~~~~~~~~
kernel/trace/trace.c:3868:17: warning: function 'trace_check_vprintf' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
3868 | trace_seq_vprintf(&iter->seq, p, ap);
| ^~~~~~~~~~~~~~~~~
At top level:
kernel/trace/trace.c:1668:37: warning: 'tracing_max_lat_fops' defined but not used [-Wunused-const-variable=]
1668 | static const struct file_operations tracing_max_lat_fops;
| ^~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
--
In file included from include/linux/perf_event.h:59,
from include/linux/hw_breakpoint.h:5,
from kernel/trace/trace.h:15,
from kernel/trace/trace_output.h:6,
from kernel/trace/trace_output.c:15:
include/linux/security.h: In function 'security_inode_need_killpriv':
>> include/linux/security.h:901:40: error: passing argument 1 of 'cap_inode_need_killpriv' from incompatible pointer type [-Werror=incompatible-pointer-types]
901 | return cap_inode_need_killpriv(dentry);
| ^~~~~~
| |
| struct dentry *
include/linux/security.h:153:52: note: expected 'struct user_namespace *' but argument is of type 'struct dentry *'
153 | int cap_inode_need_killpriv(struct user_namespace *mnt_userns,
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
>> include/linux/security.h:901:16: error: too few arguments to function 'cap_inode_need_killpriv'
901 | return cap_inode_need_killpriv(dentry);
| ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/security.h:153:5: note: declared here
153 | int cap_inode_need_killpriv(struct user_namespace *mnt_userns,
| ^~~~~~~~~~~~~~~~~~~~~~~
kernel/trace/trace_output.c: In function 'trace_output_raw':
kernel/trace/trace_output.c:332:9: warning: function 'trace_output_raw' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
332 | trace_seq_vprintf(s, trace_event_format(iter, fmt), ap);
| ^~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
--
In file included from include/linux/perf_event.h:59,
from include/linux/hw_breakpoint.h:5,
from kernel/trace/trace.h:15,
from kernel/trace/trace_preemptirq.c:13:
include/linux/security.h: In function 'security_inode_need_killpriv':
>> include/linux/security.h:901:40: error: passing argument 1 of 'cap_inode_need_killpriv' from incompatible pointer type [-Werror=incompatible-pointer-types]
901 | return cap_inode_need_killpriv(dentry);
| ^~~~~~
| |
| struct dentry *
include/linux/security.h:153:52: note: expected 'struct user_namespace *' but argument is of type 'struct dentry *'
153 | int cap_inode_need_killpriv(struct user_namespace *mnt_userns,
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
>> include/linux/security.h:901:16: error: too few arguments to function 'cap_inode_need_killpriv'
901 | return cap_inode_need_killpriv(dentry);
| ^~~~~~~~~~~~~~~~~~~~~~~
include/linux/security.h:153:5: note: declared here
153 | int cap_inode_need_killpriv(struct user_namespace *mnt_userns,
| ^~~~~~~~~~~~~~~~~~~~~~~
kernel/trace/trace_preemptirq.c: At top level:
kernel/trace/trace_preemptirq.c:88:16: warning: no previous prototype for 'trace_hardirqs_on_caller' [-Wmissing-prototypes]
88 | __visible void trace_hardirqs_on_caller(unsigned long caller_addr)
| ^~~~~~~~~~~~~~~~~~~~~~~~
kernel/trace/trace_preemptirq.c:103:16: warning: no previous prototype for 'trace_hardirqs_off_caller' [-Wmissing-prototypes]
103 | __visible void trace_hardirqs_off_caller(unsigned long caller_addr)
| ^~~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
vim +/cap_inode_need_killpriv +901 include/linux/security.h
^1da177e4c3f415 Linus Torvalds 2005-04-16 898
b53767719b6cd87 Serge E. Hallyn 2007-10-16 899 static inline int security_inode_need_killpriv(struct dentry *dentry)
b53767719b6cd87 Serge E. Hallyn 2007-10-16 900 {
b53767719b6cd87 Serge E. Hallyn 2007-10-16 @901 return cap_inode_need_killpriv(dentry);
b53767719b6cd87 Serge E. Hallyn 2007-10-16 902 }
b53767719b6cd87 Serge E. Hallyn 2007-10-16 903
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
10 months, 1 week
[mchehab-media-next:master 36/147] ERROR: modpost: "v4l2_async_register_subdev" [drivers/staging/media/max96712/max96712.ko] undefined!
by kernel test robot
tree: git://linuxtv.org/mchehab/media-next.git master
head: f2616ee88150b1fce581ac0349fb6c51f0f817b3
commit: 5814f32fef137e34577c4f053272c53e7ca33cd9 [36/147] media: staging: max96712: Add basic support for MAX96712 GMSL2 deserializer
config: csky-randconfig-p001-20211117 (attached as .config)
compiler: csky-linux-gcc (GCC) 11.2.0
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
git remote add mchehab-media-next git://linuxtv.org/mchehab/media-next.git
git fetch --no-tags mchehab-media-next master
git checkout 5814f32fef137e34577c4f053272c53e7ca33cd9
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=csky
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>, old ones prefixed by <<):
>> ERROR: modpost: "v4l2_async_register_subdev" [drivers/staging/media/max96712/max96712.ko] undefined!
>> ERROR: modpost: "v4l2_ctrl_handler_free" [drivers/staging/media/max96712/max96712.ko] undefined!
>> ERROR: modpost: "v4l2_ctrl_new_std_menu_items" [drivers/staging/media/max96712/max96712.ko] undefined!
>> ERROR: modpost: "v4l2_ctrl_new_std" [drivers/staging/media/max96712/max96712.ko] undefined!
>> ERROR: modpost: "v4l2_ctrl_handler_init_class" [drivers/staging/media/max96712/max96712.ko] undefined!
>> ERROR: modpost: "v4l2_fwnode_endpoint_parse" [drivers/staging/media/max96712/max96712.ko] undefined!
>> ERROR: modpost: "v4l2_async_unregister_subdev" [drivers/staging/media/max96712/max96712.ko] undefined!
Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for VIDEO_V4L2_SUBDEV_API
Depends on MEDIA_SUPPORT && VIDEO_DEV && MEDIA_CONTROLLER
Selected by
- VIDEO_MAX96712 && STAGING && STAGING_MEDIA && MEDIA_SUPPORT && I2C && OF_GPIO
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
10 months, 1 week
drivers/pci/controller/pcie-mt7621.c:151:16: sparse: sparse: symbol 'mt7621_pci_ops' was not declared. Should it be static?
by kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 8ab774587903771821b59471cc723bba6d893942
commit: 2bdd5238e756aac3ecbffc7c22b884485e84062e PCI: mt7621: Add MediaTek MT7621 PCIe host controller driver
date: 4 weeks ago
config: mips-allyesconfig (attached as .config)
compiler: mips-linux-gcc (GCC) 11.2.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://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit...
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 2bdd5238e756aac3ecbffc7c22b884485e84062e
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=mips SHELL=/bin/bash drivers/pci/controller/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
sparse warnings: (new ones prefixed by >>)
command-line: note: in included file:
builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQUIRE redefined
builtin:0:0: sparse: this was the original definition
builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_SEQ_CST redefined
builtin:0:0: sparse: this was the original definition
builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQ_REL redefined
builtin:0:0: sparse: this was the original definition
builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_RELEASE redefined
builtin:0:0: sparse: this was the original definition
>> drivers/pci/controller/pcie-mt7621.c:151:16: sparse: sparse: symbol 'mt7621_pci_ops' was not declared. Should it be static?
drivers/pci/controller/pcie-mt7621.c: note: in included file (through arch/mips/include/asm/mips-cps.h, arch/mips/include/asm/smp-ops.h, arch/mips/include/asm/smp.h, ...):
arch/mips/include/asm/mips-cm.h:151:1: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __iomem *mem @@ got void * @@
arch/mips/include/asm/mips-cm.h:151:1: sparse: expected void const volatile [noderef] __iomem *mem
arch/mips/include/asm/mips-cm.h:151:1: sparse: got void *
arch/mips/include/asm/mips-cm.h:151:1: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __iomem *mem @@ got void * @@
arch/mips/include/asm/mips-cm.h:151:1: sparse: expected void const volatile [noderef] __iomem *mem
arch/mips/include/asm/mips-cm.h:151:1: sparse: got void *
arch/mips/include/asm/mips-cm.h:151:1: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __iomem *mem @@ got void * @@
arch/mips/include/asm/mips-cm.h:151:1: sparse: expected void const volatile [noderef] __iomem *mem
arch/mips/include/asm/mips-cm.h:151:1: sparse: got void *
arch/mips/include/asm/mips-cm.h:151:1: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __iomem *mem @@ got void * @@
arch/mips/include/asm/mips-cm.h:151:1: sparse: expected void const volatile [noderef] __iomem *mem
arch/mips/include/asm/mips-cm.h:151:1: sparse: got void *
arch/mips/include/asm/mips-cm.h:151:1: sparse: sparse: incorrect type in return expression (different address spaces) @@ expected void * @@ got void [noderef] __iomem * @@
arch/mips/include/asm/mips-cm.h:151:1: sparse: expected void *
arch/mips/include/asm/mips-cm.h:151:1: sparse: got void [noderef] __iomem *
arch/mips/include/asm/mips-cm.h:151:1: sparse: sparse: incorrect type in return expression (different address spaces) @@ expected void * @@ got void [noderef] __iomem * @@
arch/mips/include/asm/mips-cm.h:151:1: sparse: expected void *
arch/mips/include/asm/mips-cm.h:151:1: sparse: got void [noderef] __iomem *
arch/mips/include/asm/mips-cm.h:151:1: sparse: sparse: incorrect type in return expression (different address spaces) @@ expected void * @@ got void [noderef] __iomem * @@
arch/mips/include/asm/mips-cm.h:151:1: sparse: expected void *
arch/mips/include/asm/mips-cm.h:151:1: sparse: got void [noderef] __iomem *
arch/mips/include/asm/mips-cm.h:151:1: sparse: sparse: incorrect type in return expression (different address spaces) @@ expected void * @@ got void [noderef] __iomem * @@
arch/mips/include/asm/mips-cm.h:151:1: sparse: expected void *
arch/mips/include/asm/mips-cm.h:151:1: sparse: got void [noderef] __iomem *
arch/mips/include/asm/mips-cm.h:130:1: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __iomem *mem @@ got void * @@
arch/mips/include/asm/mips-cm.h:130:1: sparse: expected void const volatile [noderef] __iomem *mem
arch/mips/include/asm/mips-cm.h:130:1: sparse: got void *
arch/mips/include/asm/mips-cm.h:130:1: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __iomem *mem @@ got void * @@
arch/mips/include/asm/mips-cm.h:130:1: sparse: expected void const volatile [noderef] __iomem *mem
arch/mips/include/asm/mips-cm.h:130:1: sparse: got void *
arch/mips/include/asm/mips-cm.h:130:1: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __iomem *mem @@ got void * @@
arch/mips/include/asm/mips-cm.h:130:1: sparse: expected void const volatile [noderef] __iomem *mem
arch/mips/include/asm/mips-cm.h:130:1: sparse: got void *
arch/mips/include/asm/mips-cm.h:130:1: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __iomem *mem @@ got void * @@
arch/mips/include/asm/mips-cm.h:130:1: sparse: expected void const volatile [noderef] __iomem *mem
arch/mips/include/asm/mips-cm.h:130:1: sparse: got void *
arch/mips/include/asm/mips-cm.h:130:1: sparse: sparse: incorrect type in return expression (different address spaces) @@ expected void * @@ got void [noderef] __iomem * @@
arch/mips/include/asm/mips-cm.h:130:1: sparse: expected void *
arch/mips/include/asm/mips-cm.h:130:1: sparse: got void [noderef] __iomem *
arch/mips/include/asm/mips-cm.h:130:1: sparse: sparse: incorrect type in return expression (different address spaces) @@ expected void * @@ got void [noderef] __iomem * @@
arch/mips/include/asm/mips-cm.h:130:1: sparse: expected void *
arch/mips/include/asm/mips-cm.h:130:1: sparse: got void [noderef] __iomem *
arch/mips/include/asm/mips-cm.h:130:1: sparse: sparse: incorrect type in return expression (different address spaces) @@ expected void * @@ got void [noderef] __iomem * @@
arch/mips/include/asm/mips-cm.h:130:1: sparse: expected void *
arch/mips/include/asm/mips-cm.h:130:1: sparse: got void [noderef] __iomem *
arch/mips/include/asm/mips-cm.h:130:1: sparse: sparse: incorrect type in return expression (different address spaces) @@ expected void * @@ got void [noderef] __iomem * @@
arch/mips/include/asm/mips-cm.h:130:1: sparse: expected void *
arch/mips/include/asm/mips-cm.h:130:1: sparse: got void [noderef] __iomem *
drivers/pci/controller/pcie-mt7621.c: note: in included file (through arch/mips/include/asm/mips-cps.h, arch/mips/include/asm/smp-ops.h, arch/mips/include/asm/smp.h, ...):
arch/mips/include/asm/mips-cpc.h:100:1: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __iomem *mem @@ got void * @@
arch/mips/include/asm/mips-cpc.h:100:1: sparse: expected void const volatile [noderef] __iomem *mem
arch/mips/include/asm/mips-cpc.h:100:1: sparse: got void *
arch/mips/include/asm/mips-cpc.h:100:1: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __iomem *mem @@ got void * @@
arch/mips/include/asm/mips-cpc.h:100:1: sparse: expected void const volatile [noderef] __iomem *mem
arch/mips/include/asm/mips-cpc.h:100:1: sparse: got void *
arch/mips/include/asm/mips-cpc.h:100:1: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __iomem *mem @@ got void * @@
arch/mips/include/asm/mips-cpc.h:100:1: sparse: expected void const volatile [noderef] __iomem *mem
arch/mips/include/asm/mips-cpc.h:100:1: sparse: got void *
arch/mips/include/asm/mips-cpc.h:100:1: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __iomem *mem @@ got void * @@
arch/mips/include/asm/mips-cpc.h:100:1: sparse: expected void const volatile [noderef] __iomem *mem
arch/mips/include/asm/mips-cpc.h:100:1: sparse: got void *
arch/mips/include/asm/mips-cpc.h:100:1: sparse: sparse: incorrect type in return expression (different address spaces) @@ expected void * @@ got void [noderef] __iomem * @@
arch/mips/include/asm/mips-cpc.h:100:1: sparse: expected void *
arch/mips/include/asm/mips-cpc.h:100:1: sparse: got void [noderef] __iomem *
arch/mips/include/asm/mips-cpc.h:100:1: sparse: sparse: incorrect type in return expression (different address spaces) @@ expected void * @@ got void [noderef] __iomem * @@
arch/mips/include/asm/mips-cpc.h:100:1: sparse: expected void *
arch/mips/include/asm/mips-cpc.h:100:1: sparse: got void [noderef] __iomem *
arch/mips/include/asm/mips-cpc.h:100:1: sparse: sparse: incorrect type in return expression (different address spaces) @@ expected void * @@ got void [noderef] __iomem * @@
arch/mips/include/asm/mips-cpc.h:100:1: sparse: expected void *
arch/mips/include/asm/mips-cpc.h:100:1: sparse: got void [noderef] __iomem *
arch/mips/include/asm/mips-cpc.h:100:1: sparse: sparse: incorrect type in return expression (different address spaces) @@ expected void * @@ got void [noderef] __iomem * @@
arch/mips/include/asm/mips-cpc.h:100:1: sparse: expected void *
arch/mips/include/asm/mips-cpc.h:100:1: sparse: got void [noderef] __iomem *
drivers/pci/controller/pcie-mt7621.c: note: in included file (through arch/mips/include/asm/mips-cps.h, arch/mips/include/asm/smp-ops.h, arch/mips/include/asm/smp.h, ...):
arch/mips/include/asm/mips-cm.h:202:1: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile [noderef] __iomem *mem @@ got void * @@
arch/mips/include/asm/mips-cm.h:202:1: sparse: expected void volatile [noderef] __iomem *mem
arch/mips/include/asm/mips-cm.h:202:1: sparse: got void *
arch/mips/include/asm/mips-cm.h:202:1: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile [noderef] __iomem *mem @@ got void * @@
arch/mips/include/asm/mips-cm.h:202:1: sparse: expected void volatile [noderef] __iomem *mem
arch/mips/include/asm/mips-cm.h:202:1: sparse: got void *
arch/mips/include/asm/mips-cm.h:202:1: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile [noderef] __iomem *mem @@ got void * @@
arch/mips/include/asm/mips-cm.h:202:1: sparse: expected void volatile [noderef] __iomem *mem
arch/mips/include/asm/mips-cm.h:202:1: sparse: got void *
arch/mips/include/asm/mips-cm.h:202:1: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile [noderef] __iomem *mem @@ got void * @@
arch/mips/include/asm/mips-cm.h:202:1: sparse: expected void volatile [noderef] __iomem *mem
arch/mips/include/asm/mips-cm.h:202:1: sparse: got void *
arch/mips/include/asm/mips-cm.h:202:1: sparse: sparse: incorrect type in return expression (different address spaces) @@ expected void * @@ got void [noderef] __iomem * @@
arch/mips/include/asm/mips-cm.h:202:1: sparse: expected void *
arch/mips/include/asm/mips-cm.h:202:1: sparse: got void [noderef] __iomem *
arch/mips/include/asm/mips-cm.h:202:1: sparse: sparse: incorrect type in return expression (different address spaces) @@ expected void * @@ got void [noderef] __iomem * @@
arch/mips/include/asm/mips-cm.h:202:1: sparse: expected void *
arch/mips/include/asm/mips-cm.h:202:1: sparse: got void [noderef] __iomem *
arch/mips/include/asm/mips-cm.h:202:1: sparse: sparse: incorrect type in return expression (different address spaces) @@ expected void * @@ got void [noderef] __iomem * @@
arch/mips/include/asm/mips-cm.h:202:1: sparse: expected void *
arch/mips/include/asm/mips-cm.h:202:1: sparse: got void [noderef] __iomem *
arch/mips/include/asm/mips-cm.h:202:1: sparse: sparse: incorrect type in return expression (different address spaces) @@ expected void * @@ got void [noderef] __iomem * @@
arch/mips/include/asm/mips-cm.h:202:1: sparse: expected void *
arch/mips/include/asm/mips-cm.h:202:1: sparse: got void [noderef] __iomem *
arch/mips/include/asm/mips-cm.h:209:1: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile [noderef] __iomem *mem @@ got void * @@
vim +/mt7621_pci_ops +151 drivers/pci/controller/pcie-mt7621.c
03f152e31f4ae89 drivers/staging/mt7621-pci/pci-mt7621.c John Crispin 2018-03-15 150
8571c62d45cb7e9 drivers/staging/mt7621-pci/pci-mt7621.c Sergio Paracuellos 2018-08-03 @151 struct pci_ops mt7621_pci_ops = {
8571c62d45cb7e9 drivers/staging/mt7621-pci/pci-mt7621.c Sergio Paracuellos 2018-08-03 152 .map_bus = mt7621_pcie_map_bus,
8571c62d45cb7e9 drivers/staging/mt7621-pci/pci-mt7621.c Sergio Paracuellos 2018-08-03 153 .read = pci_generic_config_read,
8571c62d45cb7e9 drivers/staging/mt7621-pci/pci-mt7621.c Sergio Paracuellos 2018-08-03 154 .write = pci_generic_config_write,
03f152e31f4ae89 drivers/staging/mt7621-pci/pci-mt7621.c John Crispin 2018-03-15 155 };
03f152e31f4ae89 drivers/staging/mt7621-pci/pci-mt7621.c John Crispin 2018-03-15 156
:::::: The code at line 151 was first introduced by commit
:::::: 8571c62d45cb7e9fdff87fe5132002d17fbce7a3 staging: mt7621-pci: use generic kernel pci subsystem read and write
:::::: TO: Sergio Paracuellos <sergio.paracuellos(a)gmail.com>
:::::: CC: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
10 months, 1 week
[PATCH v2] sound/soc: adds TAS5754M digital input amplifier component driver
by Joerg Schambacher
Adds a minimum component driver to run the amplifier in I2S master
mode only from standard audio clocks. Therefore, it only allows
44.1, 88.2, 176.4, 48, 96 and 192ksps with 16, 20, 24 and 32 bits
sample size. Digital volume control and the -6dB switch are supported.
Signed-off-by: Joerg Schambacher <joerg(a)hifiberry.com>
---
Added of_match_ptr() macro to fix the error when compiling on non CONFIG_OF
systems.
Joerg
sound/soc/codecs/Kconfig | 8 +
sound/soc/codecs/Makefile | 2 +
sound/soc/codecs/tas5754m.c | 547 ++++++++++++++++++++++++++++++++++++
sound/soc/codecs/tas5754m.h | 259 +++++++++++++++++
4 files changed, 816 insertions(+)
create mode 100644 sound/soc/codecs/tas5754m.c
create mode 100644 sound/soc/codecs/tas5754m.h
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index 82ee233a269d..cf0584948fcf 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -210,6 +210,7 @@ config SND_SOC_ALL_CODECS
imply SND_SOC_TAS5086
imply SND_SOC_TAS571X
imply SND_SOC_TAS5720
+ imply SND_SOC_TAS5754M
imply SND_SOC_TAS6424
imply SND_SOC_TDA7419
imply SND_SOC_TFA9879
@@ -1419,6 +1420,13 @@ config SND_SOC_TAS5720
Enable support for Texas Instruments TAS5720L/M high-efficiency mono
Class-D audio power amplifiers.
+config SND_SOC_TAS5754M
+ tristate "Texas Instruments TAS5754M Digital Input Audio amplifier"
+ depends on I2C
+ help
+ Enable support for Texas Instruments TAS5754M digital input
+ Class-D audio power amplifiers.
+
config SND_SOC_TAS6424
tristate "Texas Instruments TAS6424 Quad-Channel Audio amplifier"
depends on I2C
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile
index 8dcea2c4604a..39984900258a 100644
--- a/sound/soc/codecs/Makefile
+++ b/sound/soc/codecs/Makefile
@@ -227,6 +227,7 @@ snd-soc-sti-sas-objs := sti-sas.o
snd-soc-tas5086-objs := tas5086.o
snd-soc-tas571x-objs := tas571x.o
snd-soc-tas5720-objs := tas5720.o
+snd-soc-tas5754m-objs := tas5754m.o
snd-soc-tas6424-objs := tas6424.o
snd-soc-tda7419-objs := tda7419.o
snd-soc-tas2770-objs := tas2770.o
@@ -555,6 +556,7 @@ obj-$(CONFIG_SND_SOC_TAS2764) += snd-soc-tas2764.o
obj-$(CONFIG_SND_SOC_TAS5086) += snd-soc-tas5086.o
obj-$(CONFIG_SND_SOC_TAS571X) += snd-soc-tas571x.o
obj-$(CONFIG_SND_SOC_TAS5720) += snd-soc-tas5720.o
+obj-$(CONFIG_SND_SOC_TAS5754M) += snd-soc-tas5754m.o
obj-$(CONFIG_SND_SOC_TAS6424) += snd-soc-tas6424.o
obj-$(CONFIG_SND_SOC_TDA7419) += snd-soc-tda7419.o
obj-$(CONFIG_SND_SOC_TAS2770) += snd-soc-tas2770.o
diff --git a/sound/soc/codecs/tas5754m.c b/sound/soc/codecs/tas5754m.c
new file mode 100644
index 000000000000..aef2c65acc26
--- /dev/null
+++ b/sound/soc/codecs/tas5754m.c
@@ -0,0 +1,547 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Driver for the TAS5754M Audio Amplifier in Master mode (only)
+ * supports only standard audio frequencies 44.1 to 192 ksps
+ *
+ * Author: Joerg Schambacher <joerg(a)hifiberry.com>
+ * with fragments from Andy Liu <andy-liu(a)ti.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ */
+
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/clk.h>
+#include <linux/slab.h>
+#include <linux/of.h>
+#include <linux/init.h>
+#include <linux/i2c.h>
+#include <linux/regmap.h>
+#include <linux/delay.h>
+
+#include <sound/tlv.h>
+#include <sound/soc.h>
+#include <sound/pcm.h>
+#include <sound/pcm_params.h>
+#include <sound/initval.h>
+
+#include "tas5754m.h"
+
+#define TAS5754M_RATES (SNDRV_PCM_RATE_48000 | \
+ SNDRV_PCM_RATE_96000 | \
+ SNDRV_PCM_RATE_192000 | \
+ SNDRV_PCM_RATE_44100 | \
+ SNDRV_PCM_RATE_88200 | \
+ SNDRV_PCM_RATE_176400)
+#define TAS5754M_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | \
+ SNDRV_PCM_FMTBIT_S20_LE | \
+ SNDRV_PCM_FMTBIT_S24_LE | \
+ SNDRV_PCM_FMTBIT_S32_LE)
+
+
+static const struct reg_sequence tas5754m_init_sequence[] = {
+ { TAS5754M_RESET, 0x00 },
+ { TAS5754M_MUTE, 0x11 },
+ { TAS5754M_POWER, 0x00 },
+ { TAS5754M_PLL_EN, 0x00 },
+ { TAS5754M_RESET, 0x00 },
+ { TAS5754M_GPIO_OUTPUT_3, 0x02 },
+ { TAS5754M_GPIO_OUTPUT_4, 0x02 },
+ { TAS5754M_GPIO_OUTPUT_6, 0x02 },
+ { TAS5754M_GPIO_EN, 0x2c },
+ { TAS5754M_GPIO_CONTROL_1, 0x04 },
+ { TAS5754M_BCLK_LRCLK_CFG, 0x11 },
+ { TAS5754M_MASTER_MODE, 0x7c },
+ { TAS5754M_ERROR_DETECT, 0x77 },
+ { TAS5754M_PLL_EN, 0x01 },
+ { TAS5754M_PLL_REF, 0x00 },
+ { TAS5754M_PLL_COEFF_0, 0x03 },
+ { TAS5754M_PLL_COEFF_1, 0x0c },
+ { TAS5754M_PLL_COEFF_2, 0x00 },
+ { TAS5754M_PLL_COEFF_3, 0x00 },
+ { TAS5754M_PLL_COEFF_4, 0x00 },
+ { TAS5754M_DAC_REF, 0x30 },
+ { TAS5754M_DSP_CLKDIV, 0x01 },
+ { TAS5754M_DAC_CLKDIV, 0x0f },
+ { TAS5754M_NCP_CLKDIV, 0x03 },
+ { TAS5754M_OSR_CLKDIV, 0x00 },
+ { TAS5754M_FS_SPEED_MODE, 0x00 },
+ { TAS5754M_MASTER_CLKDIV_1, 0x0f },
+ { TAS5754M_MASTER_CLKDIV_2, 0x1f },
+ { TAS5754M_I2S_1, 0x00 },
+ { TAS5754M_I2S_2, 0x01 },
+ { TAS5754M_PLL_EN, 0x01 },
+ { TAS5754M_MASTER_MODE, 0x7f },
+ { TAS5754M_MUTE, 0x11 },
+};
+
+static const struct reg_default tas5754m_reg_defaults[] = {
+ { TAS5754M_RESET, 0x00 },
+ { TAS5754M_POWER, 0x00 },
+ { TAS5754M_MUTE, 0x00 },
+ { TAS5754M_DSP, 0x00 },
+ { TAS5754M_PLL_REF, 0x00 },
+ { TAS5754M_DAC_REF, 0x00 },
+ { TAS5754M_DAC_ROUTING, 0x11 },
+ { TAS5754M_DSP_PROGRAM, 0x01 },
+ { TAS5754M_CLKDET, 0x00 },
+ { TAS5754M_AUTO_MUTE, 0x00 },
+ { TAS5754M_ERROR_DETECT, 0x00 },
+ { TAS5754M_DIGITAL_VOLUME_1, 0x00 },
+ { TAS5754M_DIGITAL_VOLUME_2, 0x30 },
+ { TAS5754M_DIGITAL_VOLUME_3, 0x30 },
+ { TAS5754M_DIGITAL_MUTE_1, 0x22 },
+ { TAS5754M_DIGITAL_MUTE_2, 0x00 },
+ { TAS5754M_DIGITAL_MUTE_3, 0x07 },
+ { TAS5754M_OUTPUT_AMPLITUDE, 0x00 },
+ { TAS5754M_ANALOG_GAIN_CTRL, 0x00 },
+ { TAS5754M_UNDERVOLTAGE_PROT, 0x00 },
+ { TAS5754M_ANALOG_MUTE_CTRL, 0x00 },
+ { TAS5754M_ANALOG_GAIN_BOOST, 0x00 },
+ { TAS5754M_VCOM_CTRL_1, 0x00 },
+ { TAS5754M_VCOM_CTRL_2, 0x01 },
+ { TAS5754M_BCLK_LRCLK_CFG, 0x00 },
+ { TAS5754M_MASTER_MODE, 0x7c },
+ { TAS5754M_GPIO_DACIN, 0x00 },
+ { TAS5754M_GPIO_PLLIN, 0x00 },
+ { TAS5754M_SYNCHRONIZE, 0x10 },
+ { TAS5754M_PLL_COEFF_0, 0x00 },
+ { TAS5754M_PLL_COEFF_1, 0x00 },
+ { TAS5754M_PLL_COEFF_2, 0x00 },
+ { TAS5754M_PLL_COEFF_3, 0x00 },
+ { TAS5754M_PLL_COEFF_4, 0x00 },
+ { TAS5754M_DSP_CLKDIV, 0x00 },
+ { TAS5754M_DAC_CLKDIV, 0x00 },
+ { TAS5754M_NCP_CLKDIV, 0x00 },
+ { TAS5754M_OSR_CLKDIV, 0x00 },
+ { TAS5754M_MASTER_CLKDIV_1, 0x00 },
+ { TAS5754M_MASTER_CLKDIV_2, 0x00 },
+ { TAS5754M_FS_SPEED_MODE, 0x00 },
+ { TAS5754M_IDAC_1, 0x01 },
+ { TAS5754M_IDAC_2, 0x00 },
+};
+
+static bool tas5754m_readable(struct device *dev, unsigned int reg)
+{
+ switch (reg) {
+ case TAS5754M_RESET:
+ case TAS5754M_POWER:
+ case TAS5754M_MUTE:
+ case TAS5754M_PLL_EN:
+ case TAS5754M_SPI_MISO_FUNCTION:
+ case TAS5754M_DSP:
+ case TAS5754M_GPIO_EN:
+ case TAS5754M_BCLK_LRCLK_CFG:
+ case TAS5754M_DSP_GPIO_INPUT:
+ case TAS5754M_MASTER_MODE:
+ case TAS5754M_PLL_REF:
+ case TAS5754M_DAC_REF:
+ case TAS5754M_GPIO_DACIN:
+ case TAS5754M_GPIO_PLLIN:
+ case TAS5754M_SYNCHRONIZE:
+ case TAS5754M_PLL_COEFF_0:
+ case TAS5754M_PLL_COEFF_1:
+ case TAS5754M_PLL_COEFF_2:
+ case TAS5754M_PLL_COEFF_3:
+ case TAS5754M_PLL_COEFF_4:
+ case TAS5754M_DSP_CLKDIV:
+ case TAS5754M_DAC_CLKDIV:
+ case TAS5754M_NCP_CLKDIV:
+ case TAS5754M_OSR_CLKDIV:
+ case TAS5754M_MASTER_CLKDIV_1:
+ case TAS5754M_MASTER_CLKDIV_2:
+ case TAS5754M_FS_SPEED_MODE:
+ case TAS5754M_IDAC_1:
+ case TAS5754M_IDAC_2:
+ case TAS5754M_ERROR_DETECT:
+ case TAS5754M_I2S_1:
+ case TAS5754M_I2S_2:
+ case TAS5754M_DAC_ROUTING:
+ case TAS5754M_DSP_PROGRAM:
+ case TAS5754M_CLKDET:
+ case TAS5754M_AUTO_MUTE:
+ case TAS5754M_DIGITAL_VOLUME_1:
+ case TAS5754M_DIGITAL_VOLUME_2:
+ case TAS5754M_DIGITAL_VOLUME_3:
+ case TAS5754M_DIGITAL_MUTE_1:
+ case TAS5754M_DIGITAL_MUTE_2:
+ case TAS5754M_DIGITAL_MUTE_3:
+ case TAS5754M_GPIO_OUTPUT_1:
+ case TAS5754M_GPIO_OUTPUT_2:
+ case TAS5754M_GPIO_OUTPUT_3:
+ case TAS5754M_GPIO_OUTPUT_4:
+ case TAS5754M_GPIO_OUTPUT_5:
+ case TAS5754M_GPIO_OUTPUT_6:
+ case TAS5754M_GPIO_CONTROL_1:
+ case TAS5754M_GPIO_CONTROL_2:
+ case TAS5754M_OVERFLOW:
+ case TAS5754M_RATE_DET_1:
+ case TAS5754M_RATE_DET_2:
+ case TAS5754M_RATE_DET_3:
+ case TAS5754M_RATE_DET_4:
+ case TAS5754M_CLOCK_STATUS:
+ case TAS5754M_ANALOG_MUTE_DET:
+ case TAS5754M_GPIN:
+ case TAS5754M_DIGITAL_MUTE_DET:
+ case TAS5754M_OUTPUT_AMPLITUDE:
+ case TAS5754M_ANALOG_GAIN_CTRL:
+ case TAS5754M_UNDERVOLTAGE_PROT:
+ case TAS5754M_ANALOG_MUTE_CTRL:
+ case TAS5754M_ANALOG_GAIN_BOOST:
+ case TAS5754M_VCOM_CTRL_1:
+ case TAS5754M_VCOM_CTRL_2:
+ case TAS5754M_CRAM_CTRL:
+ case TAS5754M_FLEX_A:
+ case TAS5754M_FLEX_B:
+ return true;
+ default:
+ return reg < 0x7f;
+ }
+}
+
+static bool tas5754m_volatile(struct device *dev, unsigned int reg)
+{
+ switch (reg) {
+ case TAS5754M_PLL_EN:
+ case TAS5754M_OVERFLOW:
+ case TAS5754M_RATE_DET_1:
+ case TAS5754M_RATE_DET_2:
+ case TAS5754M_RATE_DET_3:
+ case TAS5754M_RATE_DET_4:
+ case TAS5754M_CLOCK_STATUS:
+ case TAS5754M_ANALOG_MUTE_DET:
+ case TAS5754M_GPIN:
+ case TAS5754M_DIGITAL_MUTE_DET:
+ case TAS5754M_CRAM_CTRL:
+ return true;
+ default:
+ return reg < 0x7f;
+ }
+}
+
+struct tas5754m_priv {
+ struct regmap *regmap;
+ struct clk *sclk;
+};
+
+static const struct regmap_range_cfg tas5754m_range = {
+ .name = "Pages",
+ .range_min = TAS5754M_VIRT_BASE,
+ .range_max = TAS5754M_MAX_REGISTER,
+ .selector_reg = TAS5754M_PAGE,
+ .selector_mask = 0x7f,
+ .window_start = 0,
+ .window_len = 128,
+};
+
+const struct regmap_config tas5754m_regmap = {
+ .reg_bits = 8,
+ .val_bits = 8,
+
+ .ranges = &tas5754m_range,
+ .num_ranges = 1,
+ .max_register = TAS5754M_MAX_REGISTER,
+
+ .reg_defaults = tas5754m_reg_defaults,
+ .num_reg_defaults = ARRAY_SIZE(tas5754m_reg_defaults),
+ .readable_reg = tas5754m_readable,
+ .volatile_reg = tas5754m_volatile,
+
+ .cache_type = REGCACHE_RBTREE,
+};
+EXPORT_SYMBOL_GPL(tas5754m_regmap);
+
+static const DECLARE_TLV_DB_SCALE(digital_tlv, -10350, 50, 1);
+static const DECLARE_TLV_DB_SCALE(analog_tlv, -600, 600, 0);
+
+static const struct snd_kcontrol_new tas5754m_controls[] = {
+SOC_DOUBLE_R_TLV("Digital Playback Volume", TAS5754M_DIGITAL_VOLUME_2,
+ TAS5754M_DIGITAL_VOLUME_3, 0, 255, 1, digital_tlv),
+SOC_DOUBLE_TLV("Analog Playback Volume", TAS5754M_ANALOG_GAIN_CTRL,
+ TAS5754M_LAGN_SHIFT, TAS5754M_RAGN_SHIFT, 1, 1, analog_tlv),
+};
+
+static int tas5754m_set_bias_level(struct snd_soc_component *component,
+ enum snd_soc_bias_level level)
+{
+ struct tas5754m_priv *tas5754m =
+ snd_soc_component_get_drvdata(component);
+ int ret;
+
+ switch (level) {
+ case SND_SOC_BIAS_ON:
+ case SND_SOC_BIAS_PREPARE:
+ break;
+
+ case SND_SOC_BIAS_STANDBY:
+ ret = regmap_update_bits(tas5754m->regmap,
+ TAS5754M_POWER, TAS5754M_RQST, 0);
+ if (ret != 0) {
+ dev_err(component->dev,
+ "Failed to remove standby: %d\n", ret);
+ return ret;
+ }
+ break;
+
+ case SND_SOC_BIAS_OFF:
+ ret = regmap_update_bits(tas5754m->regmap,
+ TAS5754M_POWER, TAS5754M_RQST, TAS5754M_RQST);
+ if (ret != 0) {
+ dev_err(component->dev,
+ "Failed to request standby: %d\n", ret);
+ return ret;
+ }
+ break;
+ }
+
+ return 0;
+}
+
+static int tas5754m_hw_params(struct snd_pcm_substream *substream,
+ struct snd_pcm_hw_params *params,
+ struct snd_soc_dai *dai)
+{
+ struct snd_soc_component *component = dai->component;
+ struct tas5754m_priv *tas5754m =
+ snd_soc_component_get_drvdata(component);
+ unsigned long bclk;
+ unsigned long mclk;
+ int sample_len;
+ int bclk_div;
+ int lrclk_div;
+ int alen;
+ int ret;
+
+ switch (params_width(params)) {
+ case 16:
+ sample_len = 16;
+ alen = TAS5754M_ALEN_16;
+ break;
+ case 20:
+ sample_len = 32;
+ alen = TAS5754M_ALEN_20;
+ break;
+ case 24:
+ sample_len = 32;
+ alen = TAS5754M_ALEN_24;
+ break;
+ case 32:
+ sample_len = 32;
+ alen = TAS5754M_ALEN_32;
+ break;
+ default:
+ dev_err(component->dev, "Unsupported sample size: %d\n",
+ params_width(params));
+ return -EINVAL;
+ }
+ ret = regmap_update_bits(tas5754m->regmap, TAS5754M_I2S_1, alen, alen);
+ if (ret != 0) {
+ dev_err(component->dev,
+ "Cannot set sample size: %d\n", ret);
+ return ret;
+ }
+
+ switch (params_rate(params)) {
+ case 44100:
+ case 48000:
+ ret = regmap_write(tas5754m->regmap,
+ TAS5754M_FS_SPEED_MODE, TAS5754M_FSSP_48KHZ);
+ break;
+ case 88200:
+ case 96000:
+ ret = regmap_write(tas5754m->regmap,
+ TAS5754M_FS_SPEED_MODE, TAS5754M_FSSP_96KHZ);
+ break;
+ case 176400:
+ case 192000:
+ ret = regmap_write(tas5754m->regmap,
+ TAS5754M_FS_SPEED_MODE, TAS5754M_FSSP_192KHZ);
+ break;
+ default:
+ dev_err(component->dev, "Sample rate not supported: %d\n",
+ params_rate(params));
+ return -EINVAL;
+ }
+ if (ret != 0) {
+ dev_err(component->dev, "Failed to config PLL\n");
+ return ret;
+ }
+
+
+ mclk = clk_get_rate(tas5754m->sclk);
+ bclk = sample_len * 2 * params_rate(params);
+ bclk_div = mclk / bclk;
+ lrclk_div = sample_len * 2;
+
+ // stop LR / SCLK clocks
+ ret = regmap_write(tas5754m->regmap, TAS5754M_MASTER_MODE, 0x7c);
+
+ // set SCLK divider
+ ret |= regmap_write(tas5754m->regmap, TAS5754M_MASTER_CLKDIV_1,
+ bclk_div - 1);
+
+ // set LRCLK divider
+ ret |= regmap_write(tas5754m->regmap, TAS5754M_MASTER_CLKDIV_2,
+ lrclk_div - 1);
+
+ // restart LR / SCLK clocks
+ ret |= regmap_write(tas5754m->regmap, TAS5754M_MASTER_MODE, 0x7f);
+ if (ret != 0) {
+ dev_err(component->dev, "Failed to config PLL\n");
+ return ret;
+ }
+
+ return 0;
+}
+
+static const struct snd_soc_component_driver tas5754m_soc_component = {
+ .set_bias_level = tas5754m_set_bias_level,
+ .idle_bias_on = true,
+ .controls = tas5754m_controls,
+ .num_controls = ARRAY_SIZE(tas5754m_controls),
+};
+
+static int tas5754m_mute(struct snd_soc_dai *dai, int mute, int stream)
+{
+ struct snd_soc_component *component = dai->component;
+
+ if (mute) {
+ snd_soc_component_write(component, TAS5754M_MUTE, 0x11);
+ } else {
+ usleep_range(1000, 2000);
+ snd_soc_component_write(component, TAS5754M_MUTE, 0x00);
+ }
+ return 0;
+}
+
+static const struct snd_soc_dai_ops tas5754m_dai_ops = {
+ .mute_stream = tas5754m_mute,
+ .hw_params = tas5754m_hw_params,
+};
+
+static struct snd_soc_dai_driver tas5754m_dai = {
+ .name = "tas5754m-amplifier",
+ .playback = {
+ .stream_name = "Playback",
+ .channels_min = 2,
+ .channels_max = 2,
+ .rates = TAS5754M_RATES,
+ .formats = TAS5754M_FORMATS,
+ },
+ .ops = &tas5754m_dai_ops,
+};
+
+static int tas5754m_probe(struct device *dev, struct regmap *regmap)
+{
+ struct tas5754m_priv *tas5754m;
+ int ret;
+
+ tas5754m = devm_kzalloc(dev, sizeof(struct tas5754m_priv), GFP_KERNEL);
+ if (!tas5754m)
+ return -ENOMEM;
+
+ dev_set_drvdata(dev, tas5754m);
+ tas5754m->regmap = regmap;
+
+ ret = regmap_multi_reg_write(regmap, tas5754m_init_sequence,
+ ARRAY_SIZE(tas5754m_init_sequence));
+
+ if (ret != 0) {
+ dev_err(dev, "Failed to initialize TAS5754M: %d\n", ret);
+ goto err;
+ }
+
+ tas5754m->sclk = devm_clk_get(dev, NULL);
+ if (PTR_ERR(tas5754m->sclk) == -EPROBE_DEFER) {
+ ret = -EPROBE_DEFER;
+ goto err;
+ }
+ if (!IS_ERR(tas5754m->sclk)) {
+ ret = clk_prepare_enable(tas5754m->sclk);
+ if (ret != 0) {
+ dev_err(dev, "Failed to enable SCLK: %d\n", ret);
+ goto err;
+ }
+ }
+
+ ret = snd_soc_register_component(dev,
+ &tas5754m_soc_component, &tas5754m_dai, 1);
+ if (ret != 0) {
+ dev_err(dev, "Failed to register CODEC: %d\n", ret);
+ goto err;
+ }
+
+ return 0;
+
+err:
+ return ret;
+
+}
+
+static int tas5754m_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
+{
+ struct regmap *regmap;
+ struct regmap_config config = tas5754m_regmap;
+
+ /* enable auto-increment mode */
+ config.read_flag_mask = 0x80;
+ config.write_flag_mask = 0x80;
+
+ regmap = devm_regmap_init_i2c(i2c, &config);
+ if (IS_ERR(regmap))
+ return PTR_ERR(regmap);
+
+ return tas5754m_probe(&i2c->dev, regmap);
+}
+
+static int tas5754m_remove(struct device *dev)
+{
+ snd_soc_unregister_component(dev);
+
+ return 0;
+}
+
+static int tas5754m_i2c_remove(struct i2c_client *i2c)
+{
+ tas5754m_remove(&i2c->dev);
+
+ return 0;
+}
+
+static const struct i2c_device_id tas5754m_i2c_id[] = {
+ { "tas5754m", },
+ { }
+};
+MODULE_DEVICE_TABLE(i2c, tas5754m_i2c_id);
+
+#ifdef CONFIG_OF
+static const struct of_device_id tas5754m_of_match[] = {
+ { .compatible = "ti,tas5754m", },
+ { .compatible = "ti,tas5756m", },
+ { }
+};
+MODULE_DEVICE_TABLE(of, tas5754m_of_match);
+#endif
+
+static struct i2c_driver tas5754m_i2c_driver = {
+ .probe = tas5754m_i2c_probe,
+ .remove = tas5754m_i2c_remove,
+ .id_table = tas5754m_i2c_id,
+ .driver = {
+ .name = "tas5754m",
+ .of_match_table = of_match_ptr(tas5754m_of_match),
+ },
+};
+
+module_i2c_driver(tas5754m_i2c_driver);
+
+MODULE_AUTHOR("Joerg Schambacher <joerg(a)hifiberry.com>");
+MODULE_DESCRIPTION("TAS5754M Audio Amplifier Driver - Master mode only");
+MODULE_LICENSE("GPL");
diff --git a/sound/soc/codecs/tas5754m.h b/sound/soc/codecs/tas5754m.h
new file mode 100644
index 000000000000..492b8abede6c
--- /dev/null
+++ b/sound/soc/codecs/tas5754m.h
@@ -0,0 +1,259 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Driver for the TAS5754M DAC+amplifier combo devices
+ *
+ * Author: (copied from pcm512x.h)
+ * Mark Brown <broonie(a)kernel.org>
+ * Copyright 2014 Linaro Ltd
+ */
+
+#ifndef _SND_SOC_TAS5754M
+#define _SND_SOC_TAS5754M
+
+#include <linux/pm.h>
+#include <linux/regmap.h>
+
+#define TAS5754M_VIRT_BASE 0x000
+#define TAS5754M_PAGE_LEN 0x80
+#define TAS5754M_PAGE_BASE(n) (TAS5754M_VIRT_BASE + (TAS5754M_PAGE_LEN * n))
+
+#define TAS5754M_PAGE 0
+
+#define TAS5754M_RESET (TAS5754M_PAGE_BASE(0) + 1)
+#define TAS5754M_POWER (TAS5754M_PAGE_BASE(0) + 2)
+#define TAS5754M_MUTE (TAS5754M_PAGE_BASE(0) + 3)
+#define TAS5754M_PLL_EN (TAS5754M_PAGE_BASE(0) + 4)
+#define TAS5754M_SPI_MISO_FUNCTION (TAS5754M_PAGE_BASE(0) + 6)
+#define TAS5754M_DSP (TAS5754M_PAGE_BASE(0) + 7)
+#define TAS5754M_GPIO_EN (TAS5754M_PAGE_BASE(0) + 8)
+#define TAS5754M_BCLK_LRCLK_CFG (TAS5754M_PAGE_BASE(0) + 9)
+#define TAS5754M_DSP_GPIO_INPUT (TAS5754M_PAGE_BASE(0) + 10)
+#define TAS5754M_MASTER_MODE (TAS5754M_PAGE_BASE(0) + 12)
+#define TAS5754M_PLL_REF (TAS5754M_PAGE_BASE(0) + 13)
+#define TAS5754M_DAC_REF (TAS5754M_PAGE_BASE(0) + 14)
+#define TAS5754M_GPIO_DACIN (TAS5754M_PAGE_BASE(0) + 16)
+#define TAS5754M_GPIO_PLLIN (TAS5754M_PAGE_BASE(0) + 18)
+#define TAS5754M_SYNCHRONIZE (TAS5754M_PAGE_BASE(0) + 19)
+#define TAS5754M_PLL_COEFF_0 (TAS5754M_PAGE_BASE(0) + 20)
+#define TAS5754M_PLL_COEFF_1 (TAS5754M_PAGE_BASE(0) + 21)
+#define TAS5754M_PLL_COEFF_2 (TAS5754M_PAGE_BASE(0) + 22)
+#define TAS5754M_PLL_COEFF_3 (TAS5754M_PAGE_BASE(0) + 23)
+#define TAS5754M_PLL_COEFF_4 (TAS5754M_PAGE_BASE(0) + 24)
+#define TAS5754M_DSP_CLKDIV (TAS5754M_PAGE_BASE(0) + 27)
+#define TAS5754M_DAC_CLKDIV (TAS5754M_PAGE_BASE(0) + 28)
+#define TAS5754M_NCP_CLKDIV (TAS5754M_PAGE_BASE(0) + 29)
+#define TAS5754M_OSR_CLKDIV (TAS5754M_PAGE_BASE(0) + 30)
+#define TAS5754M_MASTER_CLKDIV_1 (TAS5754M_PAGE_BASE(0) + 32)
+#define TAS5754M_MASTER_CLKDIV_2 (TAS5754M_PAGE_BASE(0) + 33)
+#define TAS5754M_FS_SPEED_MODE (TAS5754M_PAGE_BASE(0) + 34)
+#define TAS5754M_IDAC_1 (TAS5754M_PAGE_BASE(0) + 35)
+#define TAS5754M_IDAC_2 (TAS5754M_PAGE_BASE(0) + 36)
+#define TAS5754M_ERROR_DETECT (TAS5754M_PAGE_BASE(0) + 37)
+#define TAS5754M_I2S_1 (TAS5754M_PAGE_BASE(0) + 40)
+#define TAS5754M_I2S_2 (TAS5754M_PAGE_BASE(0) + 41)
+#define TAS5754M_DAC_ROUTING (TAS5754M_PAGE_BASE(0) + 42)
+#define TAS5754M_DSP_PROGRAM (TAS5754M_PAGE_BASE(0) + 43)
+#define TAS5754M_CLKDET (TAS5754M_PAGE_BASE(0) + 44)
+#define TAS5754M_AUTO_MUTE (TAS5754M_PAGE_BASE(0) + 59)
+#define TAS5754M_DIGITAL_VOLUME_1 (TAS5754M_PAGE_BASE(0) + 60)
+#define TAS5754M_DIGITAL_VOLUME_2 (TAS5754M_PAGE_BASE(0) + 61)
+#define TAS5754M_DIGITAL_VOLUME_3 (TAS5754M_PAGE_BASE(0) + 62)
+#define TAS5754M_DIGITAL_MUTE_1 (TAS5754M_PAGE_BASE(0) + 63)
+#define TAS5754M_DIGITAL_MUTE_2 (TAS5754M_PAGE_BASE(0) + 64)
+#define TAS5754M_DIGITAL_MUTE_3 (TAS5754M_PAGE_BASE(0) + 65)
+#define TAS5754M_GPIO_OUTPUT_1 (TAS5754M_PAGE_BASE(0) + 80)
+#define TAS5754M_GPIO_OUTPUT_2 (TAS5754M_PAGE_BASE(0) + 81)
+#define TAS5754M_GPIO_OUTPUT_3 (TAS5754M_PAGE_BASE(0) + 82)
+#define TAS5754M_GPIO_OUTPUT_4 (TAS5754M_PAGE_BASE(0) + 83)
+#define TAS5754M_GPIO_OUTPUT_5 (TAS5754M_PAGE_BASE(0) + 84)
+#define TAS5754M_GPIO_OUTPUT_6 (TAS5754M_PAGE_BASE(0) + 85)
+#define TAS5754M_GPIO_CONTROL_1 (TAS5754M_PAGE_BASE(0) + 86)
+#define TAS5754M_GPIO_CONTROL_2 (TAS5754M_PAGE_BASE(0) + 87)
+#define TAS5754M_OVERFLOW (TAS5754M_PAGE_BASE(0) + 90)
+#define TAS5754M_RATE_DET_1 (TAS5754M_PAGE_BASE(0) + 91)
+#define TAS5754M_RATE_DET_2 (TAS5754M_PAGE_BASE(0) + 92)
+#define TAS5754M_RATE_DET_3 (TAS5754M_PAGE_BASE(0) + 93)
+#define TAS5754M_RATE_DET_4 (TAS5754M_PAGE_BASE(0) + 94)
+#define TAS5754M_CLOCK_STATUS (TAS5754M_PAGE_BASE(0) + 95)
+#define TAS5754M_ANALOG_MUTE_DET (TAS5754M_PAGE_BASE(0) + 108)
+#define TAS5754M_GPIN (TAS5754M_PAGE_BASE(0) + 119)
+#define TAS5754M_DIGITAL_MUTE_DET (TAS5754M_PAGE_BASE(0) + 120)
+
+#define TAS5754M_OUTPUT_AMPLITUDE (TAS5754M_PAGE_BASE(1) + 1)
+#define TAS5754M_ANALOG_GAIN_CTRL (TAS5754M_PAGE_BASE(1) + 2)
+#define TAS5754M_UNDERVOLTAGE_PROT (TAS5754M_PAGE_BASE(1) + 5)
+#define TAS5754M_ANALOG_MUTE_CTRL (TAS5754M_PAGE_BASE(1) + 6)
+#define TAS5754M_ANALOG_GAIN_BOOST (TAS5754M_PAGE_BASE(1) + 7)
+#define TAS5754M_VCOM_CTRL_1 (TAS5754M_PAGE_BASE(1) + 8)
+#define TAS5754M_VCOM_CTRL_2 (TAS5754M_PAGE_BASE(1) + 9)
+
+#define TAS5754M_CRAM_CTRL (TAS5754M_PAGE_BASE(44) + 1)
+
+#define TAS5754M_FLEX_A (TAS5754M_PAGE_BASE(253) + 63)
+#define TAS5754M_FLEX_B (TAS5754M_PAGE_BASE(253) + 64)
+
+#define TAS5754M_MAX_REGISTER (TAS5754M_PAGE_BASE(253) + 64)
+
+/* Page 0, Register 1 - reset */
+#define TAS5754M_RSTR (1 << 0)
+#define TAS5754M_RSTM (1 << 4)
+
+/* Page 0, Register 2 - power */
+#define TAS5754M_RQPD (1 << 0)
+#define TAS5754M_RQPD_SHIFT 0
+#define TAS5754M_RQST (1 << 4)
+#define TAS5754M_RQST_SHIFT 4
+
+/* Page 0, Register 3 - mute */
+#define TAS5754M_RQMR (1 << 0)
+#define TAS5754M_RQMR_SHIFT 0
+#define TAS5754M_RQML (1 << 4)
+#define TAS5754M_RQML_SHIFT 4
+
+/* Page 0, Register 4 - PLL */
+#define TAS5754M_PLLE (1 << 0)
+#define TAS5754M_PLLE_SHIFT 0
+#define TAS5754M_PLCK (1 << 4)
+#define TAS5754M_PLCK_SHIFT 4
+
+/* Page 0, Register 7 - DSP */
+#define TAS5754M_SDSL (1 << 0)
+#define TAS5754M_SDSL_SHIFT 0
+#define TAS5754M_DEMP (1 << 4)
+#define TAS5754M_DEMP_SHIFT 4
+
+/* Page 0, Register 8 - GPIO output enable */
+#define TAS5754M_G1OE (1 << 0)
+#define TAS5754M_G2OE (1 << 1)
+#define TAS5754M_G3OE (1 << 2)
+#define TAS5754M_G4OE (1 << 3)
+#define TAS5754M_G5OE (1 << 4)
+#define TAS5754M_G6OE (1 << 5)
+
+/* Page 0, Register 9 - BCK, LRCLK configuration */
+#define TAS5754M_LRKO (1 << 0)
+#define TAS5754M_LRKO_SHIFT 0
+#define TAS5754M_BCKO (1 << 4)
+#define TAS5754M_BCKO_SHIFT 4
+#define TAS5754M_BCKP (1 << 5)
+#define TAS5754M_BCKP_SHIFT 5
+
+/* Page 0, Register 12 - Master mode BCK, LRCLK reset */
+#define TAS5754M_RLRK (1 << 0)
+#define TAS5754M_RLRK_SHIFT 0
+#define TAS5754M_RBCK (1 << 1)
+#define TAS5754M_RBCK_SHIFT 1
+
+/* Page 0, Register 13 - PLL reference */
+#define TAS5754M_SREF (7 << 4)
+#define TAS5754M_SREF_SHIFT 4
+#define TAS5754M_SREF_SCK (0 << 4)
+#define TAS5754M_SREF_BCK (1 << 4)
+#define TAS5754M_SREF_GPIO (3 << 4)
+
+/* Page 0, Register 14 - DAC reference */
+#define TAS5754M_SDAC (7 << 4)
+#define TAS5754M_SDAC_SHIFT 4
+#define TAS5754M_SDAC_MCK (0 << 4)
+#define TAS5754M_SDAC_PLL (1 << 4)
+#define TAS5754M_SDAC_SCK (3 << 4)
+#define TAS5754M_SDAC_BCK (4 << 4)
+#define TAS5754M_SDAC_GPIO (5 << 4)
+
+/* Page 0, Register 16, 18 - GPIO source for DAC, PLL */
+#define TAS5754M_GREF (7 << 0)
+#define TAS5754M_GREF_SHIFT 0
+#define TAS5754M_GREF_GPIO1 (0 << 0)
+#define TAS5754M_GREF_GPIO2 (1 << 0)
+#define TAS5754M_GREF_GPIO3 (2 << 0)
+#define TAS5754M_GREF_GPIO4 (3 << 0)
+#define TAS5754M_GREF_GPIO5 (4 << 0)
+#define TAS5754M_GREF_GPIO6 (5 << 0)
+
+/* Page 0, Register 19 - synchronize */
+#define TAS5754M_RQSY (1 << 0)
+#define TAS5754M_RQSY_RESUME (0 << 0)
+#define TAS5754M_RQSY_HALT (1 << 0)
+
+/* Page 0, Register 34 - fs speed mode */
+#define TAS5754M_FSSP (3 << 0)
+#define TAS5754M_FSSP_SHIFT 0
+#define TAS5754M_FSSP_48KHZ (0 << 0)
+#define TAS5754M_FSSP_96KHZ (1 << 0)
+#define TAS5754M_FSSP_192KHZ (2 << 0)
+#define TAS5754M_FSSP_384KHZ (3 << 0)
+
+/* Page 0, Register 37 - Error detection */
+#define TAS5754M_IPLK (1 << 0)
+#define TAS5754M_DCAS (1 << 1)
+#define TAS5754M_IDCM (1 << 2)
+#define TAS5754M_IDCH (1 << 3)
+#define TAS5754M_IDSK (1 << 4)
+#define TAS5754M_IDBK (1 << 5)
+#define TAS5754M_IDFS (1 << 6)
+
+/* Page 0, Register 40 - I2S configuration */
+#define TAS5754M_ALEN (3 << 0)
+#define TAS5754M_ALEN_SHIFT 0
+#define TAS5754M_ALEN_16 (0 << 0)
+#define TAS5754M_ALEN_20 (1 << 0)
+#define TAS5754M_ALEN_24 (2 << 0)
+#define TAS5754M_ALEN_32 (3 << 0)
+#define TAS5754M_AFMT (3 << 4)
+#define TAS5754M_AFMT_SHIFT 4
+#define TAS5754M_AFMT_I2S (0 << 4)
+#define TAS5754M_AFMT_DSP (1 << 4)
+#define TAS5754M_AFMT_RTJ (2 << 4)
+#define TAS5754M_AFMT_LTJ (3 << 4)
+
+/* Page 0, Register 42 - DAC routing */
+#define TAS5754M_AUPR_SHIFT 0
+#define TAS5754M_AUPL_SHIFT 4
+
+/* Page 0, Register 59 - auto mute */
+#define TAS5754M_ATMR_SHIFT 0
+#define TAS5754M_ATML_SHIFT 4
+
+/* Page 0, Register 63 - ramp rates */
+#define TAS5754M_VNDF_SHIFT 6
+#define TAS5754M_VNDS_SHIFT 4
+#define TAS5754M_VNUF_SHIFT 2
+#define TAS5754M_VNUS_SHIFT 0
+
+/* Page 0, Register 64 - emergency ramp rates */
+#define TAS5754M_VEDF_SHIFT 6
+#define TAS5754M_VEDS_SHIFT 4
+
+/* Page 0, Register 65 - Digital mute enables */
+#define TAS5754M_ACTL_SHIFT 2
+#define TAS5754M_AMLE_SHIFT 1
+#define TAS5754M_AMRE_SHIFT 0
+
+/* Page 0, Register 80-85, GPIO output selection */
+#define TAS5754M_GxSL (31 << 0)
+#define TAS5754M_GxSL_SHIFT 0
+#define TAS5754M_GxSL_OFF (0 << 0)
+#define TAS5754M_GxSL_DSP (1 << 0)
+#define TAS5754M_GxSL_REG (2 << 0)
+#define TAS5754M_GxSL_AMUTB (3 << 0)
+#define TAS5754M_GxSL_AMUTL (4 << 0)
+#define TAS5754M_GxSL_AMUTR (5 << 0)
+#define TAS5754M_GxSL_CLKI (6 << 0)
+#define TAS5754M_GxSL_SDOUT (7 << 0)
+#define TAS5754M_GxSL_ANMUL (8 << 0)
+#define TAS5754M_GxSL_ANMUR (9 << 0)
+#define TAS5754M_GxSL_PLLLK (10 << 0)
+#define TAS5754M_GxSL_CPCLK (11 << 0)
+#define TAS5754M_GxSL_UV0_7 (14 << 0)
+#define TAS5754M_GxSL_UV0_3 (15 << 0)
+#define TAS5754M_GxSL_PLLCK (16 << 0)
+
+/* Page 1, Register 2 - analog volume control */
+#define TAS5754M_RAGN_SHIFT 0
+#define TAS5754M_LAGN_SHIFT 4
+
+/* Page 1, Register 7 - analog boost control */
+#define TAS5754M_AGBR_SHIFT 0
+#define TAS5754M_AGBL_SHIFT 4
+
+#endif
base-commit: f6274b06e326d8471cdfb52595f989a90f5e888f
--
2.17.1
10 months, 1 week
[cel:topic-nfsd-tracepoints 95/162] fs/nfsd/xdr4.h:751:20: error: 'struct svc_fh' has no member named 'fh_pre_saved'
by kernel test robot
tree: git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux topic-nfsd-tracepoints
head: b6c4274cc47f0469a384be035e9f685deeb018c6
commit: 04e6d55241045c0be33f948e1a8560a4c74ad82b [95/162] NFSD: Add NFSv4 XDR tracepoint infrastructure
config: microblaze-buildonly-randconfig-r006-20211116 (attached as .config)
compiler: microblaze-linux-gcc (GCC) 11.2.0
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
# https://git.kernel.org/pub/scm/linux/kernel/git/cel/linux.git/commit/?id=...
git remote add cel git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux
git fetch --no-tags cel topic-nfsd-tracepoints
git checkout 04e6d55241045c0be33f948e1a8560a4c74ad82b
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=microblaze SHELL=/bin/bash fs/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
In file included from include/uapi/linux/swab.h:6,
from include/linux/swab.h:5,
from include/uapi/linux/byteorder/little_endian.h:13,
from include/linux/byteorder/little_endian.h:5,
from arch/microblaze/include/uapi/asm/byteorder.h:6,
from include/linux/statfs.h:7,
from include/linux/vfs.h:5,
from fs/nfsd/xdr.h:7,
from fs/nfsd/xdr3.h:11,
from fs/nfsd/xdrtrace.c:10:
fs/nfsd/xdr4.h: In function 'set_change_info':
>> fs/nfsd/xdr4.h:751:20: error: 'struct svc_fh' has no member named 'fh_pre_saved'
751 | BUG_ON(!fhp->fh_pre_saved);
| ^~
include/linux/compiler.h:33:55: note: in definition of macro '__branch_check__'
33 | ______r = __builtin_expect(!!(x), expect); \
| ^
include/asm-generic/bug.h:65:36: note: in expansion of macro 'unlikely'
65 | #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)
| ^~~~~~~~
fs/nfsd/xdr4.h:751:9: note: in expansion of macro 'BUG_ON'
751 | BUG_ON(!fhp->fh_pre_saved);
| ^~~~~~
>> fs/nfsd/xdr4.h:751:20: error: 'struct svc_fh' has no member named 'fh_pre_saved'
751 | BUG_ON(!fhp->fh_pre_saved);
| ^~
include/linux/compiler.h:35:54: note: in definition of macro '__branch_check__'
35 | expect, is_constant); \
| ^~~~~~~~~~~
include/asm-generic/bug.h:65:36: note: in expansion of macro 'unlikely'
65 | #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)
| ^~~~~~~~
fs/nfsd/xdr4.h:751:9: note: in expansion of macro 'BUG_ON'
751 | BUG_ON(!fhp->fh_pre_saved);
| ^~~~~~
In file included from fs/nfsd/xdr4trace.h:10,
from fs/nfsd/xdrtrace.h:98,
from fs/nfsd/xdrtrace.c:13:
>> fs/nfsd/xdr4.h:752:34: error: 'struct svc_fh' has no member named 'fh_post_saved'
752 | cinfo->atomic = (u32)(fhp->fh_post_saved && !fhp->fh_no_atomic_attr);
| ^~
>> fs/nfsd/xdr4.h:754:35: error: 'struct svc_fh' has no member named 'fh_pre_change'
754 | cinfo->before_change = fhp->fh_pre_change;
| ^~
>> fs/nfsd/xdr4.h:755:34: error: 'struct svc_fh' has no member named 'fh_post_change'
755 | cinfo->after_change = fhp->fh_post_change;
| ^~
In file included from include/trace/define_trace.h:102,
from fs/nfsd/xdrtrace.h:106,
from fs/nfsd/xdrtrace.c:13:
include/trace/../../fs/nfsd/xdr3trace.h: In function 'trace_event_raw_event_encode_wcc_data_pre_attr':
include/trace/../../fs/nfsd/xdr3trace.h:1125:36: error: 'const struct svc_fh' has no member named 'fh_pre_size'
1125 | __entry->size = fhp->fh_pre_size;
| ^~
include/trace/trace_events.h:743:11: note: in definition of macro 'DECLARE_EVENT_CLASS'
743 | { assign; } \
| ^~~~~~
include/trace/trace_events.h:79:30: note: in expansion of macro 'PARAMS'
79 | PARAMS(assign), \
| ^~~~~~
include/trace/../../fs/nfsd/xdr3trace.h:1105:1: note: in expansion of macro 'TRACE_EVENT'
1105 | TRACE_EVENT(encode_wcc_data_pre_attr,
| ^~~~~~~~~~~
include/trace/../../fs/nfsd/xdr3trace.h:1121:9: note: in expansion of macro 'TP_fast_assign'
1121 | TP_fast_assign(
| ^~~~~~~~~~~~~~
include/trace/../../fs/nfsd/xdr3trace.h:1126:41: error: 'const struct svc_fh' has no member named 'fh_pre_mtime'
1126 | __entry->mtime_sec = fhp->fh_pre_mtime.tv_sec;
| ^~
include/trace/trace_events.h:743:11: note: in definition of macro 'DECLARE_EVENT_CLASS'
743 | { assign; } \
| ^~~~~~
include/trace/trace_events.h:79:30: note: in expansion of macro 'PARAMS'
79 | PARAMS(assign), \
| ^~~~~~
include/trace/../../fs/nfsd/xdr3trace.h:1105:1: note: in expansion of macro 'TRACE_EVENT'
1105 | TRACE_EVENT(encode_wcc_data_pre_attr,
| ^~~~~~~~~~~
include/trace/../../fs/nfsd/xdr3trace.h:1121:9: note: in expansion of macro 'TP_fast_assign'
1121 | TP_fast_assign(
| ^~~~~~~~~~~~~~
include/trace/../../fs/nfsd/xdr3trace.h:1127:42: error: 'const struct svc_fh' has no member named 'fh_pre_mtime'
1127 | __entry->mtime_nsec = fhp->fh_pre_mtime.tv_nsec;
| ^~
include/trace/trace_events.h:743:11: note: in definition of macro 'DECLARE_EVENT_CLASS'
743 | { assign; } \
| ^~~~~~
include/trace/trace_events.h:79:30: note: in expansion of macro 'PARAMS'
79 | PARAMS(assign), \
| ^~~~~~
include/trace/../../fs/nfsd/xdr3trace.h:1105:1: note: in expansion of macro 'TRACE_EVENT'
1105 | TRACE_EVENT(encode_wcc_data_pre_attr,
| ^~~~~~~~~~~
include/trace/../../fs/nfsd/xdr3trace.h:1121:9: note: in expansion of macro 'TP_fast_assign'
1121 | TP_fast_assign(
| ^~~~~~~~~~~~~~
include/trace/../../fs/nfsd/xdr3trace.h:1128:41: error: 'const struct svc_fh' has no member named 'fh_pre_ctime'
1128 | __entry->ctime_sec = fhp->fh_pre_ctime.tv_sec;
| ^~
include/trace/trace_events.h:743:11: note: in definition of macro 'DECLARE_EVENT_CLASS'
743 | { assign; } \
| ^~~~~~
include/trace/trace_events.h:79:30: note: in expansion of macro 'PARAMS'
79 | PARAMS(assign), \
| ^~~~~~
include/trace/../../fs/nfsd/xdr3trace.h:1105:1: note: in expansion of macro 'TRACE_EVENT'
1105 | TRACE_EVENT(encode_wcc_data_pre_attr,
| ^~~~~~~~~~~
include/trace/../../fs/nfsd/xdr3trace.h:1121:9: note: in expansion of macro 'TP_fast_assign'
1121 | TP_fast_assign(
| ^~~~~~~~~~~~~~
include/trace/../../fs/nfsd/xdr3trace.h:1129:42: error: 'const struct svc_fh' has no member named 'fh_pre_ctime'
1129 | __entry->ctime_nsec = fhp->fh_pre_ctime.tv_nsec;
| ^~
include/trace/trace_events.h:743:11: note: in definition of macro 'DECLARE_EVENT_CLASS'
743 | { assign; } \
| ^~~~~~
include/trace/trace_events.h:79:30: note: in expansion of macro 'PARAMS'
79 | PARAMS(assign), \
| ^~~~~~
include/trace/../../fs/nfsd/xdr3trace.h:1105:1: note: in expansion of macro 'TRACE_EVENT'
1105 | TRACE_EVENT(encode_wcc_data_pre_attr,
| ^~~~~~~~~~~
include/trace/../../fs/nfsd/xdr3trace.h:1121:9: note: in expansion of macro 'TP_fast_assign'
1121 | TP_fast_assign(
| ^~~~~~~~~~~~~~
--
In file included from include/linux/build_bug.h:5,
from include/linux/container_of.h:5,
from include/linux/list.h:5,
from include/linux/rculist.h:10,
from include/linux/sched/signal.h:5,
from fs/nfsd/nfssvc.c:10:
fs/nfsd/xdr4.h: In function 'set_change_info':
>> fs/nfsd/xdr4.h:751:20: error: 'struct svc_fh' has no member named 'fh_pre_saved'
751 | BUG_ON(!fhp->fh_pre_saved);
| ^~
include/linux/compiler.h:33:55: note: in definition of macro '__branch_check__'
33 | ______r = __builtin_expect(!!(x), expect); \
| ^
include/asm-generic/bug.h:65:36: note: in expansion of macro 'unlikely'
65 | #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)
| ^~~~~~~~
fs/nfsd/xdr4.h:751:9: note: in expansion of macro 'BUG_ON'
751 | BUG_ON(!fhp->fh_pre_saved);
| ^~~~~~
>> fs/nfsd/xdr4.h:751:20: error: 'struct svc_fh' has no member named 'fh_pre_saved'
751 | BUG_ON(!fhp->fh_pre_saved);
| ^~
include/linux/compiler.h:35:54: note: in definition of macro '__branch_check__'
35 | expect, is_constant); \
| ^~~~~~~~~~~
include/asm-generic/bug.h:65:36: note: in expansion of macro 'unlikely'
65 | #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)
| ^~~~~~~~
fs/nfsd/xdr4.h:751:9: note: in expansion of macro 'BUG_ON'
751 | BUG_ON(!fhp->fh_pre_saved);
| ^~~~~~
In file included from fs/nfsd/xdr4trace.h:10,
from fs/nfsd/xdrtrace.h:98,
from fs/nfsd/nfssvc.c:32:
>> fs/nfsd/xdr4.h:752:34: error: 'struct svc_fh' has no member named 'fh_post_saved'
752 | cinfo->atomic = (u32)(fhp->fh_post_saved && !fhp->fh_no_atomic_attr);
| ^~
>> fs/nfsd/xdr4.h:754:35: error: 'struct svc_fh' has no member named 'fh_pre_change'
754 | cinfo->before_change = fhp->fh_pre_change;
| ^~
>> fs/nfsd/xdr4.h:755:34: error: 'struct svc_fh' has no member named 'fh_post_change'
755 | cinfo->after_change = fhp->fh_post_change;
| ^~
vim +751 fs/nfsd/xdr4.h
^1da177e4c3f41 include/linux/nfsd/xdr4.h Linus Torvalds 2005-04-16 747
^1da177e4c3f41 include/linux/nfsd/xdr4.h Linus Torvalds 2005-04-16 748 static inline void
^1da177e4c3f41 include/linux/nfsd/xdr4.h Linus Torvalds 2005-04-16 749 set_change_info(struct nfsd4_change_info *cinfo, struct svc_fh *fhp)
^1da177e4c3f41 include/linux/nfsd/xdr4.h Linus Torvalds 2005-04-16 750 {
c1ac3ffcd0bc7e fs/nfsd/xdr4.h Neil Brown 2010-12-02 @751 BUG_ON(!fhp->fh_pre_saved);
716a8bc7f706ee fs/nfsd/xdr4.h Trond Myklebust 2020-11-30 @752 cinfo->atomic = (u32)(fhp->fh_post_saved && !fhp->fh_no_atomic_attr);
c1ac3ffcd0bc7e fs/nfsd/xdr4.h Neil Brown 2010-12-02 753
c654b8a9cba600 include/linux/nfsd/xdr4.h J. Bruce Fields 2009-04-16 @754 cinfo->before_change = fhp->fh_pre_change;
c654b8a9cba600 include/linux/nfsd/xdr4.h J. Bruce Fields 2009-04-16 @755 cinfo->after_change = fhp->fh_post_change;
c654b8a9cba600 include/linux/nfsd/xdr4.h J. Bruce Fields 2009-04-16 756 }
^1da177e4c3f41 include/linux/nfsd/xdr4.h Linus Torvalds 2005-04-16 757
:::::: The code at line 751 was first introduced by commit
:::::: c1ac3ffcd0bc7e9617f62be8c7043d53ab84deac nfsd: Fix possible BUG_ON firing in set_change_info
:::::: TO: Neil Brown <neilb(a)suse.de>
:::::: CC: J. Bruce Fields <bfields(a)redhat.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
10 months, 1 week
net/netfilter/nft_osf.c:97:47: sparse: sparse: incorrect type in argument 3 (different base types)
by kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 8ab774587903771821b59471cc723bba6d893942
commit: d991bb1c8da842a2a0b9dc83b1005e655783f861 include/linux/compiler-gcc.h: sparse can do constant folding of __builtin_bswap*()
date: 7 months ago
config: i386-randconfig-s031-20211116 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit...
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout d991bb1c8da842a2a0b9dc83b1005e655783f861
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
sparse warnings: (new ones prefixed by >>)
net/netfilter/nft_osf.c:97:47: sparse: sparse: cast to restricted __be32
>> net/netfilter/nft_osf.c:97:47: sparse: sparse: incorrect type in argument 3 (different base types) @@ expected restricted __be32 [usertype] value @@ got unsigned int [usertype] @@
net/netfilter/nft_osf.c:97:47: sparse: expected restricted __be32 [usertype] value
net/netfilter/nft_osf.c:97:47: sparse: got unsigned int [usertype]
vim +97 net/netfilter/nft_osf.c
b96af92d6eaf9f Fernando Fernandez Mancera 2018-07-25 89
b96af92d6eaf9f Fernando Fernandez Mancera 2018-07-25 90 static int nft_osf_dump(struct sk_buff *skb, const struct nft_expr *expr)
b96af92d6eaf9f Fernando Fernandez Mancera 2018-07-25 91 {
b96af92d6eaf9f Fernando Fernandez Mancera 2018-07-25 92 const struct nft_osf *priv = nft_expr_priv(expr);
b96af92d6eaf9f Fernando Fernandez Mancera 2018-07-25 93
a218dc82f0b5c6 Fernando Fernandez Mancera 2018-10-10 94 if (nla_put_u8(skb, NFTA_OSF_TTL, priv->ttl))
a218dc82f0b5c6 Fernando Fernandez Mancera 2018-10-10 95 goto nla_put_failure;
a218dc82f0b5c6 Fernando Fernandez Mancera 2018-10-10 96
22c7652cdaa8cd Fernando Fernandez Mancera 2019-03-27 @97 if (nla_put_be32(skb, NFTA_OSF_FLAGS, ntohl(priv->flags)))
22c7652cdaa8cd Fernando Fernandez Mancera 2019-03-27 98 goto nla_put_failure;
22c7652cdaa8cd Fernando Fernandez Mancera 2019-03-27 99
b96af92d6eaf9f Fernando Fernandez Mancera 2018-07-25 100 if (nft_dump_register(skb, NFTA_OSF_DREG, priv->dreg))
b96af92d6eaf9f Fernando Fernandez Mancera 2018-07-25 101 goto nla_put_failure;
b96af92d6eaf9f Fernando Fernandez Mancera 2018-07-25 102
b96af92d6eaf9f Fernando Fernandez Mancera 2018-07-25 103 return 0;
b96af92d6eaf9f Fernando Fernandez Mancera 2018-07-25 104
b96af92d6eaf9f Fernando Fernandez Mancera 2018-07-25 105 nla_put_failure:
b96af92d6eaf9f Fernando Fernandez Mancera 2018-07-25 106 return -1;
b96af92d6eaf9f Fernando Fernandez Mancera 2018-07-25 107 }
b96af92d6eaf9f Fernando Fernandez Mancera 2018-07-25 108
:::::: The code at line 97 was first introduced by commit
:::::: 22c7652cdaa8cd33ce78bacceb4e826a3f795873 netfilter: nft_osf: Add version option support
:::::: TO: Fernando Fernandez Mancera <ffmancera(a)riseup.net>
:::::: CC: Pablo Neira Ayuso <pablo(a)netfilter.org>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
10 months, 1 week