Re: [PATCH] mtd: remove DEBUGFS_RO_ATTR()

From: kbuild test robot
Date: Sat Dec 01 2018 - 18:30:16 EST


Hi Yangtao,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on mtd/master]
[also build test ERROR on v4.20-rc4 next-20181130]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Yangtao-Li/mtd-remove-DEBUGFS_RO_ATTR/20181202-065958
base: git://git.infradead.org/linux-mtd.git master
config: nds32-allyesconfig (attached as .config)
compiler: nds32le-linux-gcc (GCC) 6.4.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=6.4.0 make.cross ARCH=nds32

All errors (new ones prefixed by >>):

drivers/mtd/devices/docg3.c:1679:1: warning: data definition has no type or storage class
DEBUGFS_RO_ATTR(device_id, dbg_device_id_show);
^~~~~~~~~~~~~~~
drivers/mtd/devices/docg3.c:1679:1: error: type defaults to 'int' in declaration of 'DEBUGFS_RO_ATTR' [-Werror=implicit-int]
drivers/mtd/devices/docg3.c:1679:1: warning: parameter names (without types) in function declaration
drivers/mtd/devices/docg3.c: In function 'doc_dbg_register':
>> drivers/mtd/devices/docg3.c:1752:9: error: 'device_id_fops' undeclared (first use in this function)
&device_id_fops);
^~~~~~~~~~~~~~
drivers/mtd/devices/docg3.c:1752:9: note: each undeclared identifier is reported only once for each function it appears in
At top level:
drivers/mtd/devices/docg3.c:1667:12: warning: 'dbg_device_id_show' defined but not used [-Wunused-function]
static int dbg_device_id_show(struct seq_file *s, void *p)
^~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors

vim +/device_id_fops +1752 drivers/mtd/devices/docg3.c

efa2ca73 Robert Jarzmik 2011-10-05 1666
efa2ca73 Robert Jarzmik 2011-10-05 1667 static int dbg_device_id_show(struct seq_file *s, void *p)
efa2ca73 Robert Jarzmik 2011-10-05 1668 {
efa2ca73 Robert Jarzmik 2011-10-05 1669 struct docg3 *docg3 = (struct docg3 *)s->private;
7b0e67f6 Robert Jarzmik 2012-03-22 1670 int id;
7b0e67f6 Robert Jarzmik 2012-03-22 1671
7b0e67f6 Robert Jarzmik 2012-03-22 1672 mutex_lock(&docg3->cascade->lock);
7b0e67f6 Robert Jarzmik 2012-03-22 1673 id = doc_register_readb(docg3, DOC_DEVICESELECT);
7b0e67f6 Robert Jarzmik 2012-03-22 1674 mutex_unlock(&docg3->cascade->lock);
efa2ca73 Robert Jarzmik 2011-10-05 1675
8c98d255 Joe Perches 2014-09-29 1676 seq_printf(s, "DeviceId = %d\n", id);
8c98d255 Joe Perches 2014-09-29 1677 return 0;
efa2ca73 Robert Jarzmik 2011-10-05 1678 }
efa2ca73 Robert Jarzmik 2011-10-05 @1679 DEBUGFS_RO_ATTR(device_id, dbg_device_id_show);
efa2ca73 Robert Jarzmik 2011-10-05 1680
34e778aa Yangtao Li 2018-12-01 1681 static int protection_show(struct seq_file *s, void *p)
efa2ca73 Robert Jarzmik 2011-10-05 1682 {
efa2ca73 Robert Jarzmik 2011-10-05 1683 struct docg3 *docg3 = (struct docg3 *)s->private;
dbc26d98 Robert Jarzmik 2011-11-19 1684 int protect, dps0, dps0_low, dps0_high, dps1, dps1_low, dps1_high;
dbc26d98 Robert Jarzmik 2011-11-19 1685
7b0e67f6 Robert Jarzmik 2012-03-22 1686 mutex_lock(&docg3->cascade->lock);
dbc26d98 Robert Jarzmik 2011-11-19 1687 protect = doc_register_readb(docg3, DOC_PROTECTION);
dbc26d98 Robert Jarzmik 2011-11-19 1688 dps0 = doc_register_readb(docg3, DOC_DPS0_STATUS);
dbc26d98 Robert Jarzmik 2011-11-19 1689 dps0_low = doc_register_readw(docg3, DOC_DPS0_ADDRLOW);
dbc26d98 Robert Jarzmik 2011-11-19 1690 dps0_high = doc_register_readw(docg3, DOC_DPS0_ADDRHIGH);
dbc26d98 Robert Jarzmik 2011-11-19 1691 dps1 = doc_register_readb(docg3, DOC_DPS1_STATUS);
dbc26d98 Robert Jarzmik 2011-11-19 1692 dps1_low = doc_register_readw(docg3, DOC_DPS1_ADDRLOW);
dbc26d98 Robert Jarzmik 2011-11-19 1693 dps1_high = doc_register_readw(docg3, DOC_DPS1_ADDRHIGH);
7b0e67f6 Robert Jarzmik 2012-03-22 1694 mutex_unlock(&docg3->cascade->lock);
efa2ca73 Robert Jarzmik 2011-10-05 1695
8c98d255 Joe Perches 2014-09-29 1696 seq_printf(s, "Protection = 0x%02x (", protect);
efa2ca73 Robert Jarzmik 2011-10-05 1697 if (protect & DOC_PROTECT_FOUNDRY_OTP_LOCK)
8c98d255 Joe Perches 2014-09-29 1698 seq_puts(s, "FOUNDRY_OTP_LOCK,");
efa2ca73 Robert Jarzmik 2011-10-05 1699 if (protect & DOC_PROTECT_CUSTOMER_OTP_LOCK)
8c98d255 Joe Perches 2014-09-29 1700 seq_puts(s, "CUSTOMER_OTP_LOCK,");
efa2ca73 Robert Jarzmik 2011-10-05 1701 if (protect & DOC_PROTECT_LOCK_INPUT)
8c98d255 Joe Perches 2014-09-29 1702 seq_puts(s, "LOCK_INPUT,");
efa2ca73 Robert Jarzmik 2011-10-05 1703 if (protect & DOC_PROTECT_STICKY_LOCK)
8c98d255 Joe Perches 2014-09-29 1704 seq_puts(s, "STICKY_LOCK,");
efa2ca73 Robert Jarzmik 2011-10-05 1705 if (protect & DOC_PROTECT_PROTECTION_ENABLED)
8c98d255 Joe Perches 2014-09-29 1706 seq_puts(s, "PROTECTION ON,");
efa2ca73 Robert Jarzmik 2011-10-05 1707 if (protect & DOC_PROTECT_IPL_DOWNLOAD_LOCK)
8c98d255 Joe Perches 2014-09-29 1708 seq_puts(s, "IPL_DOWNLOAD_LOCK,");
efa2ca73 Robert Jarzmik 2011-10-05 1709 if (protect & DOC_PROTECT_PROTECTION_ERROR)
8c98d255 Joe Perches 2014-09-29 1710 seq_puts(s, "PROTECT_ERR,");
efa2ca73 Robert Jarzmik 2011-10-05 1711 else
8c98d255 Joe Perches 2014-09-29 1712 seq_puts(s, "NO_PROTECT_ERR");
8c98d255 Joe Perches 2014-09-29 1713 seq_puts(s, ")\n");
efa2ca73 Robert Jarzmik 2011-10-05 1714
8c98d255 Joe Perches 2014-09-29 1715 seq_printf(s, "DPS0 = 0x%02x : Protected area [0x%x - 0x%x] : OTP=%d, READ=%d, WRITE=%d, HW_LOCK=%d, KEY_OK=%d\n",
efa2ca73 Robert Jarzmik 2011-10-05 1716 dps0, dps0_low, dps0_high,
efa2ca73 Robert Jarzmik 2011-10-05 1717 !!(dps0 & DOC_DPS_OTP_PROTECTED),
efa2ca73 Robert Jarzmik 2011-10-05 1718 !!(dps0 & DOC_DPS_READ_PROTECTED),
efa2ca73 Robert Jarzmik 2011-10-05 1719 !!(dps0 & DOC_DPS_WRITE_PROTECTED),
efa2ca73 Robert Jarzmik 2011-10-05 1720 !!(dps0 & DOC_DPS_HW_LOCK_ENABLED),
efa2ca73 Robert Jarzmik 2011-10-05 1721 !!(dps0 & DOC_DPS_KEY_OK));
8c98d255 Joe Perches 2014-09-29 1722 seq_printf(s, "DPS1 = 0x%02x : Protected area [0x%x - 0x%x] : OTP=%d, READ=%d, WRITE=%d, HW_LOCK=%d, KEY_OK=%d\n",
efa2ca73 Robert Jarzmik 2011-10-05 1723 dps1, dps1_low, dps1_high,
efa2ca73 Robert Jarzmik 2011-10-05 1724 !!(dps1 & DOC_DPS_OTP_PROTECTED),
efa2ca73 Robert Jarzmik 2011-10-05 1725 !!(dps1 & DOC_DPS_READ_PROTECTED),
efa2ca73 Robert Jarzmik 2011-10-05 1726 !!(dps1 & DOC_DPS_WRITE_PROTECTED),
efa2ca73 Robert Jarzmik 2011-10-05 1727 !!(dps1 & DOC_DPS_HW_LOCK_ENABLED),
efa2ca73 Robert Jarzmik 2011-10-05 1728 !!(dps1 & DOC_DPS_KEY_OK));
8c98d255 Joe Perches 2014-09-29 1729 return 0;
efa2ca73 Robert Jarzmik 2011-10-05 1730 }
34e778aa Yangtao Li 2018-12-01 1731
34e778aa Yangtao Li 2018-12-01 1732 DEFINE_SHOW_ATTRIBUTE(protection);
efa2ca73 Robert Jarzmik 2011-10-05 1733
e8e3edb9 Mario Rugiero 2017-05-29 1734 static void __init doc_dbg_register(struct mtd_info *floor)
efa2ca73 Robert Jarzmik 2011-10-05 1735 {
e8e3edb9 Mario Rugiero 2017-05-29 1736 struct dentry *root = floor->dbg.dfs_dir;
e8e3edb9 Mario Rugiero 2017-05-29 1737 struct docg3 *docg3 = floor->priv;
efa2ca73 Robert Jarzmik 2011-10-05 1738
1530578a Boris Brezillon 2017-11-11 1739 if (IS_ERR_OR_NULL(root)) {
1530578a Boris Brezillon 2017-11-11 1740 if (IS_ENABLED(CONFIG_DEBUG_FS) &&
1530578a Boris Brezillon 2017-11-11 1741 !IS_ENABLED(CONFIG_MTD_PARTITIONED_MASTER))
1530578a Boris Brezillon 2017-11-11 1742 dev_warn(floor->dev.parent,
1530578a Boris Brezillon 2017-11-11 1743 "CONFIG_MTD_PARTITIONED_MASTER must be enabled to expose debugfs stuff\n");
e8e3edb9 Mario Rugiero 2017-05-29 1744 return;
1530578a Boris Brezillon 2017-11-11 1745 }
efa2ca73 Robert Jarzmik 2011-10-05 1746
e8e3edb9 Mario Rugiero 2017-05-29 1747 debugfs_create_file("docg3_flashcontrol", S_IRUSR, root, docg3,
efa2ca73 Robert Jarzmik 2011-10-05 1748 &flashcontrol_fops);
e8e3edb9 Mario Rugiero 2017-05-29 1749 debugfs_create_file("docg3_asic_mode", S_IRUSR, root, docg3,
e8e3edb9 Mario Rugiero 2017-05-29 1750 &asic_mode_fops);
e8e3edb9 Mario Rugiero 2017-05-29 1751 debugfs_create_file("docg3_device_id", S_IRUSR, root, docg3,
e8e3edb9 Mario Rugiero 2017-05-29 @1752 &device_id_fops);
e8e3edb9 Mario Rugiero 2017-05-29 1753 debugfs_create_file("docg3_protection", S_IRUSR, root, docg3,
e8e3edb9 Mario Rugiero 2017-05-29 1754 &protection_fops);
efa2ca73 Robert Jarzmik 2011-10-05 1755 }
efa2ca73 Robert Jarzmik 2011-10-05 1756

:::::: The code at line 1752 was first introduced by commit
:::::: e8e3edb95ce6a146bc774b6cfad3553f4383edc8 mtd: create per-device and module-scope debugfs entries

:::::: TO: Mario Rugiero <mrugiero@xxxxxxxxx>
:::::: CC: Brian Norris <computersforpeace@xxxxxxxxx>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip