diff mbox series

[v3] netdevice: use ifmap instead of plain fields

Message ID 20230304115626.215026-1-vincenzopalazzodev@gmail.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [v3] netdevice: use ifmap instead of plain fields | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next, async
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit fail Errors and warnings before: 4350 this patch: 1409
netdev/cc_maintainers warning 13 maintainers not CCed: pabeni@redhat.com thomas.lendacky@amd.com khalasa@piap.pl wsa+renesas@sang-engineering.com keescook@chromium.org m.grzeschik@pengutronix.de leon@kernel.org mw@semihalf.com edumazet@google.com kuba@kernel.org nhuck@google.com anthony.l.nguyen@intel.com dmitry.torokhov@gmail.com
netdev/build_clang fail Errors and warnings before: 1015 this patch: 864
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn fail Errors and warnings before: 4563 this patch: 2719
netdev/checkpatch warning CHECK: multiple assignments should be avoided
netdev/kdoc fail Errors and warnings before: 1 this patch: 2
netdev/source_inline success Was 0 now: 0

Commit Message

Vincenzo Palazzo March 4, 2023, 11:56 a.m. UTC
clean the code by using the ifmap instead of plain fields,
and avoid code duplication.

Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/oe-kbuild-all/202303041847.nRrrz1v9-lkp@intel.com/
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
---
 drivers/net/arcnet/com20020_cs.c           |  7 ++++---
 drivers/net/ethernet/davicom/dm9000.c      |  2 +-
 drivers/net/ethernet/intel/e1000e/netdev.c |  4 ++--
 drivers/net/wan/pc300too.c                 |  4 ++--
 drivers/net/wan/pci200syn.c                |  4 ++--
 include/linux/netdevice.h                  |  8 +-------
 net/core/dev_ioctl.c                       | 12 ++++++------
 net/core/rtnetlink.c                       |  6 +++---
 8 files changed, 21 insertions(+), 26 deletions(-)

Comments

kernel test robot March 4, 2023, 2:33 p.m. UTC | #1
Hi Vincenzo,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on net/master]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Vincenzo-Palazzo/netdevice-use-ifmap-instead-of-plain-fields/20230304-195731
patch link:    https://lore.kernel.org/r/20230304115626.215026-1-vincenzopalazzodev%40gmail.com
patch subject: [PATCH v3] netdevice: use ifmap instead of plain fields
config: arm64-randconfig-r026-20230302 (https://download.01.org/0day-ci/archive/20230304/202303042238.bQFk2Esl-lkp@intel.com/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project 67409911353323ca5edf2049ef0df54132fa1ca7)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install arm64 cross compiling tool for clang build
        # apt-get install binutils-aarch64-linux-gnu
        # https://github.com/intel-lab-lkp/linux/commit/89e04810927e646944e5cdd83fb9bb5a41cc5a3d
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Vincenzo-Palazzo/netdevice-use-ifmap-instead-of-plain-fields/20230304-195731
        git checkout 89e04810927e646944e5cdd83fb9bb5a41cc5a3d
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash drivers/net/arcnet/ drivers/net/can/cc770/ drivers/net/can/sja1000/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202303042238.bQFk2Esl-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/net/arcnet/com20020-pci.c:199:8: error: no member named 'base_addr' in 'struct net_device'
                   dev->base_addr = ioaddr;
                   ~~~  ^
   1 error generated.
--
>> drivers/net/can/cc770/cc770_isa.c:204:8: error: no member named 'base_addr' in 'struct net_device'
                   dev->base_addr = mem[idx];
                   ~~~  ^
   drivers/net/can/cc770/cc770_isa.c:209:8: error: no member named 'base_addr' in 'struct net_device'
                   dev->base_addr = port[idx];
                   ~~~  ^
   2 errors generated.
--
>> drivers/net/can/sja1000/sja1000_isa.c:159:8: error: no member named 'base_addr' in 'struct net_device'
                   dev->base_addr = mem[idx];
                   ~~~  ^
   drivers/net/can/sja1000/sja1000_isa.c:164:8: error: no member named 'base_addr' in 'struct net_device'
                   dev->base_addr = port[idx];
                   ~~~  ^
   2 errors generated.


vim +199 drivers/net/arcnet/com20020-pci.c

c51da42a6346c0 Michael Grzeschik  2014-09-29  118  
d6d7d3ed56e3bf Joe Perches        2015-05-05  119  static int com20020pci_probe(struct pci_dev *pdev,
d6d7d3ed56e3bf Joe Perches        2015-05-05  120  			     const struct pci_device_id *id)
^1da177e4c3f41 Linus Torvalds     2005-04-16  121  {
8c14f9c70327a6 Michael Grzeschik  2014-09-29  122  	struct com20020_pci_card_info *ci;
5ef216c1f84825 Michael Grzeschik  2014-09-18  123  	struct com20020_pci_channel_map *mm;
^1da177e4c3f41 Linus Torvalds     2005-04-16  124  	struct net_device *dev;
^1da177e4c3f41 Linus Torvalds     2005-04-16  125  	struct arcnet_local *lp;
c51da42a6346c0 Michael Grzeschik  2014-09-29  126  	struct com20020_priv *priv;
c51da42a6346c0 Michael Grzeschik  2014-09-29  127  	int i, ioaddr, ret;
c51da42a6346c0 Michael Grzeschik  2014-09-29  128  	struct resource *r;
^1da177e4c3f41 Linus Torvalds     2005-04-16  129  
6577b9a551aedb Tong Zhang         2021-03-14  130  	ret = 0;
6577b9a551aedb Tong Zhang         2021-03-14  131  
^1da177e4c3f41 Linus Torvalds     2005-04-16  132  	if (pci_enable_device(pdev))
^1da177e4c3f41 Linus Torvalds     2005-04-16  133  		return -EIO;
c51da42a6346c0 Michael Grzeschik  2014-09-29  134  
c51da42a6346c0 Michael Grzeschik  2014-09-29  135  	priv = devm_kzalloc(&pdev->dev, sizeof(struct com20020_priv),
c51da42a6346c0 Michael Grzeschik  2014-09-29  136  			    GFP_KERNEL);
e8a308affcd79d Kiran Padwal       2015-02-05  137  	if (!priv)
e8a308affcd79d Kiran Padwal       2015-02-05  138  		return -ENOMEM;
e8a308affcd79d Kiran Padwal       2015-02-05  139  
c51da42a6346c0 Michael Grzeschik  2014-09-29  140  	ci = (struct com20020_pci_card_info *)id->driver_data;
bd6f1fd5d33dfe Zheyu Ma           2022-03-02  141  	if (!ci)
bd6f1fd5d33dfe Zheyu Ma           2022-03-02  142  		return -EINVAL;
bd6f1fd5d33dfe Zheyu Ma           2022-03-02  143  
c51da42a6346c0 Michael Grzeschik  2014-09-29  144  	priv->ci = ci;
5ef216c1f84825 Michael Grzeschik  2014-09-18  145  	mm = &ci->misc_map;
c51da42a6346c0 Michael Grzeschik  2014-09-29  146  
6577b9a551aedb Tong Zhang         2021-03-14  147  	pci_set_drvdata(pdev, priv);
6577b9a551aedb Tong Zhang         2021-03-14  148  
c51da42a6346c0 Michael Grzeschik  2014-09-29  149  	INIT_LIST_HEAD(&priv->list_dev);
c51da42a6346c0 Michael Grzeschik  2014-09-29  150  
5ef216c1f84825 Michael Grzeschik  2014-09-18  151  	if (mm->size) {
5ef216c1f84825 Michael Grzeschik  2014-09-18  152  		ioaddr = pci_resource_start(pdev, mm->bar) + mm->offset;
5ef216c1f84825 Michael Grzeschik  2014-09-18  153  		r = devm_request_region(&pdev->dev, ioaddr, mm->size,
5ef216c1f84825 Michael Grzeschik  2014-09-18  154  					"com20020-pci");
5ef216c1f84825 Michael Grzeschik  2014-09-18  155  		if (!r) {
5ef216c1f84825 Michael Grzeschik  2014-09-18  156  			pr_err("IO region %xh-%xh already allocated.\n",
5ef216c1f84825 Michael Grzeschik  2014-09-18  157  			       ioaddr, ioaddr + mm->size - 1);
5ef216c1f84825 Michael Grzeschik  2014-09-18  158  			return -EBUSY;
5ef216c1f84825 Michael Grzeschik  2014-09-18  159  		}
5ef216c1f84825 Michael Grzeschik  2014-09-18  160  		priv->misc = ioaddr;
5ef216c1f84825 Michael Grzeschik  2014-09-18  161  	}
5ef216c1f84825 Michael Grzeschik  2014-09-18  162  
c51da42a6346c0 Michael Grzeschik  2014-09-29  163  	for (i = 0; i < ci->devcount; i++) {
c51da42a6346c0 Michael Grzeschik  2014-09-29  164  		struct com20020_pci_channel_map *cm = &ci->chan_map_tbl[i];
c51da42a6346c0 Michael Grzeschik  2014-09-29  165  		struct com20020_dev *card;
cb108619f2fc77 Michael Grzeschik  2017-06-28  166  		int dev_id_mask = 0xf;
c51da42a6346c0 Michael Grzeschik  2014-09-29  167  
^1da177e4c3f41 Linus Torvalds     2005-04-16  168  		dev = alloc_arcdev(device);
c51da42a6346c0 Michael Grzeschik  2014-09-29  169  		if (!dev) {
c51da42a6346c0 Michael Grzeschik  2014-09-29  170  			ret = -ENOMEM;
6577b9a551aedb Tong Zhang         2021-03-14  171  			break;
c51da42a6346c0 Michael Grzeschik  2014-09-29  172  		}
ae8ede6a0cdcf3 Michael Grzeschik  2015-03-20  173  		dev->dev_port = i;
a1799af4d7deef Stephen Hemminger  2009-01-09  174  
a1799af4d7deef Stephen Hemminger  2009-01-09  175  		dev->netdev_ops = &com20020_netdev_ops;
a1799af4d7deef Stephen Hemminger  2009-01-09  176  
454d7c9b14e20f Wang Chen          2008-11-12  177  		lp = netdev_priv(dev);
^1da177e4c3f41 Linus Torvalds     2005-04-16  178  
a34c0932c3b2f2 Joe Perches        2015-05-05  179  		arc_printk(D_NORMAL, dev, "%s Controls\n", ci->name);
c51da42a6346c0 Michael Grzeschik  2014-09-29  180  		ioaddr = pci_resource_start(pdev, cm->bar) + cm->offset;
c51da42a6346c0 Michael Grzeschik  2014-09-29  181  
c51da42a6346c0 Michael Grzeschik  2014-09-29  182  		r = devm_request_region(&pdev->dev, ioaddr, cm->size,
c51da42a6346c0 Michael Grzeschik  2014-09-29  183  					"com20020-pci");
c51da42a6346c0 Michael Grzeschik  2014-09-29  184  		if (!r) {
05a24b234b9dda Joe Perches        2015-05-05  185  			pr_err("IO region %xh-%xh already allocated\n",
c51da42a6346c0 Michael Grzeschik  2014-09-29  186  			       ioaddr, ioaddr + cm->size - 1);
c51da42a6346c0 Michael Grzeschik  2014-09-29  187  			ret = -EBUSY;
6577b9a551aedb Tong Zhang         2021-03-14  188  			goto err_free_arcdev;
^1da177e4c3f41 Linus Torvalds     2005-04-16  189  		}
^1da177e4c3f41 Linus Torvalds     2005-04-16  190  
c51da42a6346c0 Michael Grzeschik  2014-09-29  191  		/* Dummy access after Reset
c51da42a6346c0 Michael Grzeschik  2014-09-29  192  		 * ARCNET controller needs
c51da42a6346c0 Michael Grzeschik  2014-09-29  193  		 * this access to detect bustype
c51da42a6346c0 Michael Grzeschik  2014-09-29  194  		 */
0fec65130b9f11 Joe Perches        2015-05-05  195  		arcnet_outb(0x00, ioaddr, COM20020_REG_W_COMMAND);
0fec65130b9f11 Joe Perches        2015-05-05  196  		arcnet_inb(ioaddr, COM20020_REG_R_DIAGSTAT);
^1da177e4c3f41 Linus Torvalds     2005-04-16  197  
2a0ea04c83ab82 Michael Grzeschik  2017-06-28  198  		SET_NETDEV_DEV(dev, &pdev->dev);
^1da177e4c3f41 Linus Torvalds     2005-04-16 @199  		dev->base_addr = ioaddr;
13b5ffa0e282f3 Jakub Kicinski     2021-10-12  200  		arcnet_set_addr(dev, node);
ede07a1fc7d70a Michael Grzeschik  2017-06-28  201  		dev->sysfs_groups[0] = &com20020_state_group;
c51da42a6346c0 Michael Grzeschik  2014-09-29  202  		dev->irq = pdev->irq;
^1da177e4c3f41 Linus Torvalds     2005-04-16  203  		lp->card_name = "PCI COM20020";
8c14f9c70327a6 Michael Grzeschik  2014-09-29  204  		lp->card_flags = ci->flags;
^1da177e4c3f41 Linus Torvalds     2005-04-16  205  		lp->backplane = backplane;
^1da177e4c3f41 Linus Torvalds     2005-04-16  206  		lp->clockp = clockp & 7;
^1da177e4c3f41 Linus Torvalds     2005-04-16  207  		lp->clockm = clockm & 3;
^1da177e4c3f41 Linus Torvalds     2005-04-16  208  		lp->timeout = timeout;
^1da177e4c3f41 Linus Torvalds     2005-04-16  209  		lp->hw.owner = THIS_MODULE;
^1da177e4c3f41 Linus Torvalds     2005-04-16  210  
52ab12e4f99437 Michael Grzeschik  2017-06-28  211  		lp->backplane = (inb(priv->misc) >> (2 + i)) & 0x1;
52ab12e4f99437 Michael Grzeschik  2017-06-28  212  
a356ab1c3d4651 Michael Grzeschik  2017-06-28  213  		if (!strncmp(ci->name, "EAE PLX-PCI FB2", 15))
a356ab1c3d4651 Michael Grzeschik  2017-06-28  214  			lp->backplane = 1;
a356ab1c3d4651 Michael Grzeschik  2017-06-28  215  
5ef216c1f84825 Michael Grzeschik  2014-09-18  216  		/* Get the dev_id from the PLX rotary coder */
5ef216c1f84825 Michael Grzeschik  2014-09-18  217  		if (!strncmp(ci->name, "EAE PLX-PCI MA1", 15))
cb108619f2fc77 Michael Grzeschik  2017-06-28  218  			dev_id_mask = 0x3;
cb108619f2fc77 Michael Grzeschik  2017-06-28  219  		dev->dev_id = (inb(priv->misc + ci->rotary) >> 4) & dev_id_mask;
5ef216c1f84825 Michael Grzeschik  2014-09-18  220  
5ef216c1f84825 Michael Grzeschik  2014-09-18  221  		snprintf(dev->name, sizeof(dev->name), "arc%d-%d", dev->dev_id, i);
5ef216c1f84825 Michael Grzeschik  2014-09-18  222  
0fec65130b9f11 Joe Perches        2015-05-05  223  		if (arcnet_inb(ioaddr, COM20020_REG_R_STATUS) == 0xFF) {
c51da42a6346c0 Michael Grzeschik  2014-09-29  224  			pr_err("IO address %Xh is empty!\n", ioaddr);
c51da42a6346c0 Michael Grzeschik  2014-09-29  225  			ret = -EIO;
6577b9a551aedb Tong Zhang         2021-03-14  226  			goto err_free_arcdev;
^1da177e4c3f41 Linus Torvalds     2005-04-16  227  		}
^1da177e4c3f41 Linus Torvalds     2005-04-16  228  		if (com20020_check(dev)) {
c51da42a6346c0 Michael Grzeschik  2014-09-29  229  			ret = -EIO;
6577b9a551aedb Tong Zhang         2021-03-14  230  			goto err_free_arcdev;
^1da177e4c3f41 Linus Torvalds     2005-04-16  231  		}
^1da177e4c3f41 Linus Torvalds     2005-04-16  232  
c51da42a6346c0 Michael Grzeschik  2014-09-29  233  		card = devm_kzalloc(&pdev->dev, sizeof(struct com20020_dev),
c51da42a6346c0 Michael Grzeschik  2014-09-29  234  				    GFP_KERNEL);
01c3521f794ce9 Christophe Jaillet 2017-07-07  235  		if (!card) {
01c3521f794ce9 Christophe Jaillet 2017-07-07  236  			ret = -ENOMEM;
6577b9a551aedb Tong Zhang         2021-03-14  237  			goto err_free_arcdev;
01c3521f794ce9 Christophe Jaillet 2017-07-07  238  		}
c51da42a6346c0 Michael Grzeschik  2014-09-29  239  
c51da42a6346c0 Michael Grzeschik  2014-09-29  240  		card->index = i;
c51da42a6346c0 Michael Grzeschik  2014-09-29  241  		card->pci_priv = priv;
8890624a4e8c2c Michael Grzeschik  2014-09-18  242  		card->tx_led.brightness_set = led_tx_set;
8890624a4e8c2c Michael Grzeschik  2014-09-18  243  		card->tx_led.default_trigger = devm_kasprintf(&pdev->dev,
8890624a4e8c2c Michael Grzeschik  2014-09-18  244  						GFP_KERNEL, "arc%d-%d-tx",
8890624a4e8c2c Michael Grzeschik  2014-09-18  245  						dev->dev_id, i);
8890624a4e8c2c Michael Grzeschik  2014-09-18  246  		card->tx_led.name = devm_kasprintf(&pdev->dev, GFP_KERNEL,
8890624a4e8c2c Michael Grzeschik  2014-09-18  247  						"pci:green:tx:%d-%d",
8890624a4e8c2c Michael Grzeschik  2014-09-18  248  						dev->dev_id, i);
8890624a4e8c2c Michael Grzeschik  2014-09-18  249  
8890624a4e8c2c Michael Grzeschik  2014-09-18  250  		card->tx_led.dev = &dev->dev;
8890624a4e8c2c Michael Grzeschik  2014-09-18  251  		card->recon_led.brightness_set = led_recon_set;
8890624a4e8c2c Michael Grzeschik  2014-09-18  252  		card->recon_led.default_trigger = devm_kasprintf(&pdev->dev,
8890624a4e8c2c Michael Grzeschik  2014-09-18  253  						GFP_KERNEL, "arc%d-%d-recon",
8890624a4e8c2c Michael Grzeschik  2014-09-18  254  						dev->dev_id, i);
8890624a4e8c2c Michael Grzeschik  2014-09-18  255  		card->recon_led.name = devm_kasprintf(&pdev->dev, GFP_KERNEL,
8890624a4e8c2c Michael Grzeschik  2014-09-18  256  						"pci:red:recon:%d-%d",
8890624a4e8c2c Michael Grzeschik  2014-09-18  257  						dev->dev_id, i);
8890624a4e8c2c Michael Grzeschik  2014-09-18  258  		card->recon_led.dev = &dev->dev;
c51da42a6346c0 Michael Grzeschik  2014-09-29  259  		card->dev = dev;
c51da42a6346c0 Michael Grzeschik  2014-09-29  260  
8890624a4e8c2c Michael Grzeschik  2014-09-18  261  		ret = devm_led_classdev_register(&pdev->dev, &card->tx_led);
8890624a4e8c2c Michael Grzeschik  2014-09-18  262  		if (ret)
6577b9a551aedb Tong Zhang         2021-03-14  263  			goto err_free_arcdev;
8890624a4e8c2c Michael Grzeschik  2014-09-18  264  
8890624a4e8c2c Michael Grzeschik  2014-09-18  265  		ret = devm_led_classdev_register(&pdev->dev, &card->recon_led);
8890624a4e8c2c Michael Grzeschik  2014-09-18  266  		if (ret)
6577b9a551aedb Tong Zhang         2021-03-14  267  			goto err_free_arcdev;
8890624a4e8c2c Michael Grzeschik  2014-09-18  268  
c51da42a6346c0 Michael Grzeschik  2014-09-29  269  		dev_set_drvdata(&dev->dev, card);
c51da42a6346c0 Michael Grzeschik  2014-09-29  270  
c51da42a6346c0 Michael Grzeschik  2014-09-29  271  		ret = com20020_found(dev, IRQF_SHARED);
c51da42a6346c0 Michael Grzeschik  2014-09-29  272  		if (ret)
6577b9a551aedb Tong Zhang         2021-03-14  273  			goto err_free_arcdev;
^1da177e4c3f41 Linus Torvalds     2005-04-16  274  
8890624a4e8c2c Michael Grzeschik  2014-09-18  275  		devm_arcnet_led_init(dev, dev->dev_id, i);
8890624a4e8c2c Michael Grzeschik  2014-09-18  276  
c51da42a6346c0 Michael Grzeschik  2014-09-29  277  		list_add(&card->list, &priv->list_dev);
6577b9a551aedb Tong Zhang         2021-03-14  278  		continue;
^1da177e4c3f41 Linus Torvalds     2005-04-16  279  
6577b9a551aedb Tong Zhang         2021-03-14  280  err_free_arcdev:
6577b9a551aedb Tong Zhang         2021-03-14  281  		free_arcdev(dev);
6577b9a551aedb Tong Zhang         2021-03-14  282  		break;
6577b9a551aedb Tong Zhang         2021-03-14  283  	}
6577b9a551aedb Tong Zhang         2021-03-14  284  	if (ret)
c51da42a6346c0 Michael Grzeschik  2014-09-29  285  		com20020pci_remove(pdev);
c51da42a6346c0 Michael Grzeschik  2014-09-29  286  	return ret;
^1da177e4c3f41 Linus Torvalds     2005-04-16  287  }
^1da177e4c3f41 Linus Torvalds     2005-04-16  288
kernel test robot March 4, 2023, 2:44 p.m. UTC | #2
Hi Vincenzo,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on net/master]
[also build test ERROR on net-next/master horms-ipvs/master linus/master v6.2 next-20230303]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Vincenzo-Palazzo/netdevice-use-ifmap-instead-of-plain-fields/20230304-195731
patch link:    https://lore.kernel.org/r/20230304115626.215026-1-vincenzopalazzodev%40gmail.com
patch subject: [PATCH v3] netdevice: use ifmap instead of plain fields
config: mips-randconfig-r034-20230302 (https://download.01.org/0day-ci/archive/20230304/202303042251.hzk9MHP0-lkp@intel.com/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project 67409911353323ca5edf2049ef0df54132fa1ca7)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install mips cross compiling tool for clang build
        # apt-get install binutils-mips-linux-gnu
        # https://github.com/intel-lab-lkp/linux/commit/89e04810927e646944e5cdd83fb9bb5a41cc5a3d
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Vincenzo-Palazzo/netdevice-use-ifmap-instead-of-plain-fields/20230304-195731
        git checkout 89e04810927e646944e5cdd83fb9bb5a41cc5a3d
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=mips olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash drivers/net/hamradio/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202303042251.hzk9MHP0-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/net/hamradio/baycom_epp.c:818:53: error: no member named 'base_addr' in 'struct net_device'
           struct parport *pp = parport_find_base(dev->base_addr);
                                                  ~~~  ^
   drivers/net/hamradio/baycom_epp.c:826:84: error: no member named 'base_addr' in 'struct net_device'
                   printk(KERN_ERR "%s: parport at 0x%lx unknown\n", bc_drvname, dev->base_addr);
                                                                                 ~~~  ^
   include/linux/printk.h:455:60: note: expanded from macro 'printk'
   #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
                                                              ^~~~~~~~~~~
   include/linux/printk.h:427:19: note: expanded from macro 'printk_index_wrap'
                   _p_func(_fmt, ##__VA_ARGS__);                           \
                                   ^~~~~~~~~~~
   drivers/net/hamradio/baycom_epp.c:961:26: error: no member named 'base_addr' in 'struct net_device'
                  bc_drvname, dev->base_addr, dev->irq);
                              ~~~  ^
   include/linux/printk.h:455:60: note: expanded from macro 'printk'
   #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
                                                              ^~~~~~~~~~~
   include/linux/printk.h:427:19: note: expanded from macro 'printk_index_wrap'
                   _p_func(_fmt, ##__VA_ARGS__);                           \
                                   ^~~~~~~~~~~
   drivers/net/hamradio/baycom_epp.c:1037:28: error: no member named 'base_addr' in 'struct net_device'
                   hi.data.mp.iobase = dev->base_addr;
                                       ~~~  ^
   drivers/net/hamradio/baycom_epp.c:1049:8: error: no member named 'base_addr' in 'struct net_device'
                   dev->base_addr = hi.data.mp.iobase;
                   ~~~  ^
   drivers/net/hamradio/baycom_epp.c:1242:8: error: no member named 'base_addr' in 'struct net_device'
                   dev->base_addr = iobase[i];
                   ~~~  ^
   6 errors generated.


vim +818 drivers/net/hamradio/baycom_epp.c

^1da177e4c3f41 Linus Torvalds         2005-04-16  805  
^1da177e4c3f41 Linus Torvalds         2005-04-16  806  /*
^1da177e4c3f41 Linus Torvalds         2005-04-16  807   * Open/initialize the board. This is called (in the current kernel)
^1da177e4c3f41 Linus Torvalds         2005-04-16  808   * sometime after booting when the 'ifconfig' program is run.
^1da177e4c3f41 Linus Torvalds         2005-04-16  809   *
^1da177e4c3f41 Linus Torvalds         2005-04-16  810   * This routine should set everything up anew at each open, even
^1da177e4c3f41 Linus Torvalds         2005-04-16  811   * registers that "should" only need to be set once at boot, so that
^1da177e4c3f41 Linus Torvalds         2005-04-16  812   * there is non-reboot way to recover if something goes wrong.
^1da177e4c3f41 Linus Torvalds         2005-04-16  813   */
^1da177e4c3f41 Linus Torvalds         2005-04-16  814  
^1da177e4c3f41 Linus Torvalds         2005-04-16  815  static int epp_open(struct net_device *dev)
^1da177e4c3f41 Linus Torvalds         2005-04-16  816  {
^1da177e4c3f41 Linus Torvalds         2005-04-16  817  	struct baycom_state *bc = netdev_priv(dev);
^1da177e4c3f41 Linus Torvalds         2005-04-16 @818          struct parport *pp = parport_find_base(dev->base_addr);
^1da177e4c3f41 Linus Torvalds         2005-04-16  819  	unsigned int i, j;
^1da177e4c3f41 Linus Torvalds         2005-04-16  820  	unsigned char tmp[128];
^1da177e4c3f41 Linus Torvalds         2005-04-16  821  	unsigned char stat;
^1da177e4c3f41 Linus Torvalds         2005-04-16  822  	unsigned long tstart;
ca444073a2de97 Sudip Mukherjee        2017-09-17  823  	struct pardev_cb par_cb;
^1da177e4c3f41 Linus Torvalds         2005-04-16  824  	
^1da177e4c3f41 Linus Torvalds         2005-04-16  825          if (!pp) {
^1da177e4c3f41 Linus Torvalds         2005-04-16  826                  printk(KERN_ERR "%s: parport at 0x%lx unknown\n", bc_drvname, dev->base_addr);
^1da177e4c3f41 Linus Torvalds         2005-04-16  827                  return -ENXIO;
^1da177e4c3f41 Linus Torvalds         2005-04-16  828          }
^1da177e4c3f41 Linus Torvalds         2005-04-16  829  #if 0
^1da177e4c3f41 Linus Torvalds         2005-04-16  830          if (pp->irq < 0) {
^1da177e4c3f41 Linus Torvalds         2005-04-16  831                  printk(KERN_ERR "%s: parport at 0x%lx has no irq\n", bc_drvname, pp->base);
^1da177e4c3f41 Linus Torvalds         2005-04-16  832  		parport_put_port(pp);
^1da177e4c3f41 Linus Torvalds         2005-04-16  833                  return -ENXIO;
^1da177e4c3f41 Linus Torvalds         2005-04-16  834          }
^1da177e4c3f41 Linus Torvalds         2005-04-16  835  #endif
^1da177e4c3f41 Linus Torvalds         2005-04-16  836  	if ((~pp->modes) & (PARPORT_MODE_TRISTATE | PARPORT_MODE_PCSPP | PARPORT_MODE_SAFEININT)) {
^1da177e4c3f41 Linus Torvalds         2005-04-16  837                  printk(KERN_ERR "%s: parport at 0x%lx cannot be used\n",
^1da177e4c3f41 Linus Torvalds         2005-04-16  838  		       bc_drvname, pp->base);
^1da177e4c3f41 Linus Torvalds         2005-04-16  839  		parport_put_port(pp);
^1da177e4c3f41 Linus Torvalds         2005-04-16  840                  return -EIO;
^1da177e4c3f41 Linus Torvalds         2005-04-16  841  	}
^1da177e4c3f41 Linus Torvalds         2005-04-16  842  	memset(&bc->modem, 0, sizeof(bc->modem));
ca444073a2de97 Sudip Mukherjee        2017-09-17  843  	memset(&par_cb, 0, sizeof(par_cb));
ca444073a2de97 Sudip Mukherjee        2017-09-17  844  	par_cb.wakeup = epp_wakeup;
ca444073a2de97 Sudip Mukherjee        2017-09-17  845  	par_cb.private = (void *)dev;
ca444073a2de97 Sudip Mukherjee        2017-09-17  846  	par_cb.flags = PARPORT_DEV_EXCL;
ca444073a2de97 Sudip Mukherjee        2017-09-17  847  	for (i = 0; i < NR_PORTS; i++)
ca444073a2de97 Sudip Mukherjee        2017-09-17  848  		if (baycom_device[i] == dev)
ca444073a2de97 Sudip Mukherjee        2017-09-17  849  			break;
ca444073a2de97 Sudip Mukherjee        2017-09-17  850  
ca444073a2de97 Sudip Mukherjee        2017-09-17  851  	if (i == NR_PORTS) {
ca444073a2de97 Sudip Mukherjee        2017-09-17  852  		pr_err("%s: no device found\n", bc_drvname);
ca444073a2de97 Sudip Mukherjee        2017-09-17  853  		parport_put_port(pp);
ca444073a2de97 Sudip Mukherjee        2017-09-17  854  		return -ENODEV;
ca444073a2de97 Sudip Mukherjee        2017-09-17  855  	}
ca444073a2de97 Sudip Mukherjee        2017-09-17  856  
ca444073a2de97 Sudip Mukherjee        2017-09-17  857  	bc->pdev = parport_register_dev_model(pp, dev->name, &par_cb, i);
^1da177e4c3f41 Linus Torvalds         2005-04-16  858  	parport_put_port(pp);
^1da177e4c3f41 Linus Torvalds         2005-04-16  859          if (!bc->pdev) {
^1da177e4c3f41 Linus Torvalds         2005-04-16  860                  printk(KERN_ERR "%s: cannot register parport at 0x%lx\n", bc_drvname, pp->base);
^1da177e4c3f41 Linus Torvalds         2005-04-16  861                  return -ENXIO;
^1da177e4c3f41 Linus Torvalds         2005-04-16  862          }
^1da177e4c3f41 Linus Torvalds         2005-04-16  863          if (parport_claim(bc->pdev)) {
^1da177e4c3f41 Linus Torvalds         2005-04-16  864                  printk(KERN_ERR "%s: parport at 0x%lx busy\n", bc_drvname, pp->base);
^1da177e4c3f41 Linus Torvalds         2005-04-16  865                  parport_unregister_device(bc->pdev);
^1da177e4c3f41 Linus Torvalds         2005-04-16  866                  return -EBUSY;
^1da177e4c3f41 Linus Torvalds         2005-04-16  867          }
^1da177e4c3f41 Linus Torvalds         2005-04-16  868          dev->irq = /*pp->irq*/ 0;
c4028958b6ecad David Howells          2006-11-22  869  	INIT_DELAYED_WORK(&bc->run_work, epp_bh);
^1da177e4c3f41 Linus Torvalds         2005-04-16  870  	bc->work_running = 1;
^1da177e4c3f41 Linus Torvalds         2005-04-16  871  	bc->modem = EPP_CONVENTIONAL;
^1da177e4c3f41 Linus Torvalds         2005-04-16  872  	if (eppconfig(bc))
^1da177e4c3f41 Linus Torvalds         2005-04-16  873  		printk(KERN_INFO "%s: no FPGA detected, assuming conventional EPP modem\n", bc_drvname);
^1da177e4c3f41 Linus Torvalds         2005-04-16  874  	else
^1da177e4c3f41 Linus Torvalds         2005-04-16  875  		bc->modem = /*EPP_FPGA*/ EPP_FPGAEXTSTATUS;
^1da177e4c3f41 Linus Torvalds         2005-04-16  876  	parport_write_control(pp, LPTCTRL_PROGRAM); /* prepare EPP mode; we aren't using interrupts */
^1da177e4c3f41 Linus Torvalds         2005-04-16  877  	/* reset the modem */
^1da177e4c3f41 Linus Torvalds         2005-04-16  878  	tmp[0] = 0;
^1da177e4c3f41 Linus Torvalds         2005-04-16  879  	tmp[1] = EPP_TX_FIFO_ENABLE|EPP_RX_FIFO_ENABLE|EPP_MODEM_ENABLE;
^1da177e4c3f41 Linus Torvalds         2005-04-16  880  	if (pp->ops->epp_write_addr(pp, tmp, 2, 0) != 2)
^1da177e4c3f41 Linus Torvalds         2005-04-16  881  		goto epptimeout;
^1da177e4c3f41 Linus Torvalds         2005-04-16  882  	/* autoprobe baud rate */
^1da177e4c3f41 Linus Torvalds         2005-04-16  883  	tstart = jiffies;
^1da177e4c3f41 Linus Torvalds         2005-04-16  884  	i = 0;
ff5688ae1cedfb Marcelo Feitoza Parisi 2006-01-09  885  	while (time_before(jiffies, tstart + HZ/3)) {
^1da177e4c3f41 Linus Torvalds         2005-04-16  886  		if (pp->ops->epp_read_addr(pp, &stat, 1, 0) != 1)
^1da177e4c3f41 Linus Torvalds         2005-04-16  887  			goto epptimeout;
^1da177e4c3f41 Linus Torvalds         2005-04-16  888  		if ((stat & (EPP_NRAEF|EPP_NRHF)) == EPP_NRHF) {
^1da177e4c3f41 Linus Torvalds         2005-04-16  889  			schedule();
^1da177e4c3f41 Linus Torvalds         2005-04-16  890  			continue;
^1da177e4c3f41 Linus Torvalds         2005-04-16  891  		}
^1da177e4c3f41 Linus Torvalds         2005-04-16  892  		if (pp->ops->epp_read_data(pp, tmp, 128, 0) != 128)
^1da177e4c3f41 Linus Torvalds         2005-04-16  893  			goto epptimeout;
^1da177e4c3f41 Linus Torvalds         2005-04-16  894  		if (pp->ops->epp_read_data(pp, tmp, 128, 0) != 128)
^1da177e4c3f41 Linus Torvalds         2005-04-16  895  			goto epptimeout;
^1da177e4c3f41 Linus Torvalds         2005-04-16  896  		i += 256;
^1da177e4c3f41 Linus Torvalds         2005-04-16  897  	}
^1da177e4c3f41 Linus Torvalds         2005-04-16  898  	for (j = 0; j < 256; j++) {
^1da177e4c3f41 Linus Torvalds         2005-04-16  899  		if (pp->ops->epp_read_addr(pp, &stat, 1, 0) != 1)
^1da177e4c3f41 Linus Torvalds         2005-04-16  900  			goto epptimeout;
^1da177e4c3f41 Linus Torvalds         2005-04-16  901  		if (!(stat & EPP_NREF))
^1da177e4c3f41 Linus Torvalds         2005-04-16  902  			break;
^1da177e4c3f41 Linus Torvalds         2005-04-16  903  		if (pp->ops->epp_read_data(pp, tmp, 1, 0) != 1)
^1da177e4c3f41 Linus Torvalds         2005-04-16  904  			goto epptimeout;
^1da177e4c3f41 Linus Torvalds         2005-04-16  905  		i++;
^1da177e4c3f41 Linus Torvalds         2005-04-16  906  	}
^1da177e4c3f41 Linus Torvalds         2005-04-16  907  	tstart = jiffies - tstart;
^1da177e4c3f41 Linus Torvalds         2005-04-16  908  	bc->bitrate = i * (8 * HZ) / tstart;
^1da177e4c3f41 Linus Torvalds         2005-04-16  909  	j = 1;
^1da177e4c3f41 Linus Torvalds         2005-04-16  910  	i = bc->bitrate >> 3;
^1da177e4c3f41 Linus Torvalds         2005-04-16  911  	while (j < 7 && i > 150) {
^1da177e4c3f41 Linus Torvalds         2005-04-16  912  		j++;
^1da177e4c3f41 Linus Torvalds         2005-04-16  913  		i >>= 1;
^1da177e4c3f41 Linus Torvalds         2005-04-16  914  	}
^1da177e4c3f41 Linus Torvalds         2005-04-16  915  	printk(KERN_INFO "%s: autoprobed bitrate: %d  int divider: %d  int rate: %d\n", 
^1da177e4c3f41 Linus Torvalds         2005-04-16  916  	       bc_drvname, bc->bitrate, j, bc->bitrate >> (j+2));
^1da177e4c3f41 Linus Torvalds         2005-04-16  917  	tmp[0] = EPP_TX_FIFO_ENABLE|EPP_RX_FIFO_ENABLE|EPP_MODEM_ENABLE/*|j*/;
^1da177e4c3f41 Linus Torvalds         2005-04-16  918  	if (pp->ops->epp_write_addr(pp, tmp, 1, 0) != 1)
^1da177e4c3f41 Linus Torvalds         2005-04-16  919  		goto epptimeout;
^1da177e4c3f41 Linus Torvalds         2005-04-16  920  	/*
^1da177e4c3f41 Linus Torvalds         2005-04-16  921  	 * initialise hdlc variables
^1da177e4c3f41 Linus Torvalds         2005-04-16  922  	 */
^1da177e4c3f41 Linus Torvalds         2005-04-16  923  	bc->hdlcrx.state = 0;
^1da177e4c3f41 Linus Torvalds         2005-04-16  924  	bc->hdlcrx.numbits = 0;
^1da177e4c3f41 Linus Torvalds         2005-04-16  925  	bc->hdlctx.state = tx_idle;
^1da177e4c3f41 Linus Torvalds         2005-04-16  926  	bc->hdlctx.bufcnt = 0;
^1da177e4c3f41 Linus Torvalds         2005-04-16  927  	bc->hdlctx.slotcnt = bc->ch_params.slottime;
^1da177e4c3f41 Linus Torvalds         2005-04-16  928  	bc->hdlctx.calibrate = 0;
^1da177e4c3f41 Linus Torvalds         2005-04-16  929  	/* start the bottom half stuff */
^1da177e4c3f41 Linus Torvalds         2005-04-16  930  	schedule_delayed_work(&bc->run_work, 1);
^1da177e4c3f41 Linus Torvalds         2005-04-16  931  	netif_start_queue(dev);
^1da177e4c3f41 Linus Torvalds         2005-04-16  932  	return 0;
^1da177e4c3f41 Linus Torvalds         2005-04-16  933  
^1da177e4c3f41 Linus Torvalds         2005-04-16  934   epptimeout:
^1da177e4c3f41 Linus Torvalds         2005-04-16  935  	printk(KERN_ERR "%s: epp timeout during bitrate probe\n", bc_drvname);
^1da177e4c3f41 Linus Torvalds         2005-04-16  936  	parport_write_control(pp, 0); /* reset the adapter */
^1da177e4c3f41 Linus Torvalds         2005-04-16  937          parport_release(bc->pdev);
^1da177e4c3f41 Linus Torvalds         2005-04-16  938          parport_unregister_device(bc->pdev);
^1da177e4c3f41 Linus Torvalds         2005-04-16  939  	return -EIO;
^1da177e4c3f41 Linus Torvalds         2005-04-16  940  }
^1da177e4c3f41 Linus Torvalds         2005-04-16  941
kernel test robot March 4, 2023, 3:05 p.m. UTC | #3
Hi Vincenzo,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on net/master]
[also build test WARNING on net-next/master horms-ipvs/master linus/master v6.2 next-20230303]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Vincenzo-Palazzo/netdevice-use-ifmap-instead-of-plain-fields/20230304-195731
patch link:    https://lore.kernel.org/r/20230304115626.215026-1-vincenzopalazzodev%40gmail.com
patch subject: [PATCH v3] netdevice: use ifmap instead of plain fields
config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20230304/202303042257.q7Wn15nV-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 12.1.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/intel-lab-lkp/linux/commit/89e04810927e646944e5cdd83fb9bb5a41cc5a3d
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Vincenzo-Palazzo/netdevice-use-ifmap-instead-of-plain-fields/20230304-195731
        git checkout 89e04810927e646944e5cdd83fb9bb5a41cc5a3d
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k SHELL=/bin/bash drivers/net/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202303042257.q7Wn15nV-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from include/linux/printk.h:564,
                    from include/linux/kernel.h:29,
                    from drivers/net/arcnet/com20020_cs.c:37:
   drivers/net/arcnet/com20020_cs.c: In function 'com20020_config':
>> drivers/net/arcnet/com20020_cs.c:268:25: warning: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'int' [-Wformat=]
     268 |         netdev_dbg(dev, "port %#3lx, irq %d\n",
         |                         ^~~~~~~~~~~~~~~~~~~~~~
     269 |                    dev->dev_mapping.base_addr, dev->irq);
         |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                                    |
         |                                    int
   include/linux/dynamic_debug.h:223:29: note: in definition of macro '__dynamic_func_call_cls'
     223 |                 func(&id, ##__VA_ARGS__);                       \
         |                             ^~~~~~~~~~~
   include/linux/dynamic_debug.h:249:9: note: in expansion of macro '_dynamic_func_call_cls'
     249 |         _dynamic_func_call_cls(_DPRINTK_CLASS_DFLT, fmt, func, ##__VA_ARGS__)
         |         ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/dynamic_debug.h:276:9: note: in expansion of macro '_dynamic_func_call'
     276 |         _dynamic_func_call(fmt, __dynamic_netdev_dbg,           \
         |         ^~~~~~~~~~~~~~~~~~
   include/net/net_debug.h:57:9: note: in expansion of macro 'dynamic_netdev_dbg'
      57 |         dynamic_netdev_dbg(__dev, format, ##args);              \
         |         ^~~~~~~~~~~~~~~~~~
   drivers/net/arcnet/com20020_cs.c:268:9: note: in expansion of macro 'netdev_dbg'
     268 |         netdev_dbg(dev, "port %#3lx, irq %d\n",
         |         ^~~~~~~~~~
   drivers/net/arcnet/com20020_cs.c:268:35: note: format string is defined here
     268 |         netdev_dbg(dev, "port %#3lx, irq %d\n",
         |                               ~~~~^
         |                                   |
         |                                   long unsigned int
         |                               %#3x


vim +268 drivers/net/arcnet/com20020_cs.c

^1da177e4c3f41 drivers/net/pcmcia/com20020_cs.c Linus Torvalds    2005-04-16  194  
15b99ac1729503 drivers/net/pcmcia/com20020_cs.c Dominik Brodowski 2006-03-31  195  static int com20020_config(struct pcmcia_device *link)
^1da177e4c3f41 drivers/net/pcmcia/com20020_cs.c Linus Torvalds    2005-04-16  196  {
^1da177e4c3f41 drivers/net/pcmcia/com20020_cs.c Linus Torvalds    2005-04-16  197  	struct arcnet_local *lp;
2dfd2533e9e700 drivers/net/arcnet/com20020_cs.c Himangi Saraogi   2014-08-09  198  	struct com20020_dev *info;
^1da177e4c3f41 drivers/net/pcmcia/com20020_cs.c Linus Torvalds    2005-04-16  199  	struct net_device *dev;
dd0fab5b940c0b drivers/net/pcmcia/com20020_cs.c Dominik Brodowski 2009-10-24  200  	int i, ret;
^1da177e4c3f41 drivers/net/pcmcia/com20020_cs.c Linus Torvalds    2005-04-16  201  	int ioaddr;
^1da177e4c3f41 drivers/net/pcmcia/com20020_cs.c Linus Torvalds    2005-04-16  202  
^1da177e4c3f41 drivers/net/pcmcia/com20020_cs.c Linus Torvalds    2005-04-16  203  	info = link->priv;
^1da177e4c3f41 drivers/net/pcmcia/com20020_cs.c Linus Torvalds    2005-04-16  204  	dev = info->dev;
^1da177e4c3f41 drivers/net/pcmcia/com20020_cs.c Linus Torvalds    2005-04-16  205  
dd0fab5b940c0b drivers/net/pcmcia/com20020_cs.c Dominik Brodowski 2009-10-24  206  	dev_dbg(&link->dev, "config...\n");
^1da177e4c3f41 drivers/net/pcmcia/com20020_cs.c Linus Torvalds    2005-04-16  207  
dd0fab5b940c0b drivers/net/pcmcia/com20020_cs.c Dominik Brodowski 2009-10-24  208  	dev_dbg(&link->dev, "com20020_config\n");
^1da177e4c3f41 drivers/net/pcmcia/com20020_cs.c Linus Torvalds    2005-04-16  209  
90abdc3b973229 drivers/net/pcmcia/com20020_cs.c Dominik Brodowski 2010-07-24  210  	dev_dbg(&link->dev, "baseport1 is %Xh\n",
90abdc3b973229 drivers/net/pcmcia/com20020_cs.c Dominik Brodowski 2010-07-24  211  		(unsigned int)link->resource[0]->start);
90abdc3b973229 drivers/net/pcmcia/com20020_cs.c Dominik Brodowski 2010-07-24  212  
4c89e88bfde6a3 drivers/net/pcmcia/com20020_cs.c Dominik Brodowski 2008-08-03  213  	i = -ENODEV;
90abdc3b973229 drivers/net/pcmcia/com20020_cs.c Dominik Brodowski 2010-07-24  214  	link->io_lines = 16;
90abdc3b973229 drivers/net/pcmcia/com20020_cs.c Dominik Brodowski 2010-07-24  215  
7f5e760c1b2690 drivers/net/arcnet/com20020_cs.c Joe Perches       2015-05-05  216  	if (!link->resource[0]->start) {
7f5e760c1b2690 drivers/net/arcnet/com20020_cs.c Joe Perches       2015-05-05  217  		for (ioaddr = 0x100; ioaddr < 0x400; ioaddr += 0x10) {
90abdc3b973229 drivers/net/pcmcia/com20020_cs.c Dominik Brodowski 2010-07-24  218  			link->resource[0]->start = ioaddr;
90abdc3b973229 drivers/net/pcmcia/com20020_cs.c Dominik Brodowski 2010-07-24  219  			i = pcmcia_request_io(link);
4c89e88bfde6a3 drivers/net/pcmcia/com20020_cs.c Dominik Brodowski 2008-08-03  220  			if (i == 0)
^1da177e4c3f41 drivers/net/pcmcia/com20020_cs.c Linus Torvalds    2005-04-16  221  				break;
^1da177e4c3f41 drivers/net/pcmcia/com20020_cs.c Linus Torvalds    2005-04-16  222  		}
7f5e760c1b2690 drivers/net/arcnet/com20020_cs.c Joe Perches       2015-05-05  223  	} else {
90abdc3b973229 drivers/net/pcmcia/com20020_cs.c Dominik Brodowski 2010-07-24  224  		i = pcmcia_request_io(link);
7f5e760c1b2690 drivers/net/arcnet/com20020_cs.c Joe Perches       2015-05-05  225  	}
^1da177e4c3f41 drivers/net/pcmcia/com20020_cs.c Linus Torvalds    2005-04-16  226  
7f5e760c1b2690 drivers/net/arcnet/com20020_cs.c Joe Perches       2015-05-05  227  	if (i != 0) {
dd0fab5b940c0b drivers/net/pcmcia/com20020_cs.c Dominik Brodowski 2009-10-24  228  		dev_dbg(&link->dev, "requestIO failed totally!\n");
^1da177e4c3f41 drivers/net/pcmcia/com20020_cs.c Linus Torvalds    2005-04-16  229  		goto failed;
^1da177e4c3f41 drivers/net/pcmcia/com20020_cs.c Linus Torvalds    2005-04-16  230  	}
^1da177e4c3f41 drivers/net/pcmcia/com20020_cs.c Linus Torvalds    2005-04-16  231  
89e04810927e64 drivers/net/arcnet/com20020_cs.c Vincenzo Palazzo  2023-03-04  232  	/* FIXME: multiple assignments should be avoided */
89e04810927e64 drivers/net/arcnet/com20020_cs.c Vincenzo Palazzo  2023-03-04  233  	ioaddr = dev->dev_mapping.base_addr = link->resource[0]->start;
dd0fab5b940c0b drivers/net/pcmcia/com20020_cs.c Dominik Brodowski 2009-10-24  234  	dev_dbg(&link->dev, "got ioaddr %Xh\n", ioaddr);
^1da177e4c3f41 drivers/net/pcmcia/com20020_cs.c Linus Torvalds    2005-04-16  235  
5fa9167a1bf5f5 drivers/net/pcmcia/com20020_cs.c Dominik Brodowski 2009-11-08  236  	dev_dbg(&link->dev, "request IRQ %d\n",
eb14120f743d29 drivers/net/pcmcia/com20020_cs.c Dominik Brodowski 2010-03-07  237  		link->irq);
7f5e760c1b2690 drivers/net/arcnet/com20020_cs.c Joe Perches       2015-05-05  238  	if (!link->irq) {
dd0fab5b940c0b drivers/net/pcmcia/com20020_cs.c Dominik Brodowski 2009-10-24  239  		dev_dbg(&link->dev, "requestIRQ failed totally!\n");
^1da177e4c3f41 drivers/net/pcmcia/com20020_cs.c Linus Torvalds    2005-04-16  240  		goto failed;
^1da177e4c3f41 drivers/net/pcmcia/com20020_cs.c Linus Torvalds    2005-04-16  241  	}
^1da177e4c3f41 drivers/net/pcmcia/com20020_cs.c Linus Torvalds    2005-04-16  242  
eb14120f743d29 drivers/net/pcmcia/com20020_cs.c Dominik Brodowski 2010-03-07  243  	dev->irq = link->irq;
^1da177e4c3f41 drivers/net/pcmcia/com20020_cs.c Linus Torvalds    2005-04-16  244  
1ac71e5a35eebe drivers/net/pcmcia/com20020_cs.c Dominik Brodowski 2010-07-29  245  	ret = pcmcia_enable_device(link);
dd0fab5b940c0b drivers/net/pcmcia/com20020_cs.c Dominik Brodowski 2009-10-24  246  	if (ret)
dd0fab5b940c0b drivers/net/pcmcia/com20020_cs.c Dominik Brodowski 2009-10-24  247  		goto failed;
^1da177e4c3f41 drivers/net/pcmcia/com20020_cs.c Linus Torvalds    2005-04-16  248  
7f5e760c1b2690 drivers/net/arcnet/com20020_cs.c Joe Perches       2015-05-05  249  	if (com20020_check(dev)) {
^1da177e4c3f41 drivers/net/pcmcia/com20020_cs.c Linus Torvalds    2005-04-16  250  		regdump(dev);
^1da177e4c3f41 drivers/net/pcmcia/com20020_cs.c Linus Torvalds    2005-04-16  251  		goto failed;
^1da177e4c3f41 drivers/net/pcmcia/com20020_cs.c Linus Torvalds    2005-04-16  252  	}
^1da177e4c3f41 drivers/net/pcmcia/com20020_cs.c Linus Torvalds    2005-04-16  253  
4cf1653aa90c63 drivers/net/pcmcia/com20020_cs.c Wang Chen         2008-11-12  254  	lp = netdev_priv(dev);
^1da177e4c3f41 drivers/net/pcmcia/com20020_cs.c Linus Torvalds    2005-04-16  255  	lp->card_name = "PCMCIA COM20020";
^1da177e4c3f41 drivers/net/pcmcia/com20020_cs.c Linus Torvalds    2005-04-16  256  	lp->card_flags = ARC_CAN_10MBIT; /* pretend all of them can 10Mbit */
^1da177e4c3f41 drivers/net/pcmcia/com20020_cs.c Linus Torvalds    2005-04-16  257  
dd2e5a156525f1 drivers/net/pcmcia/com20020_cs.c Dominik Brodowski 2009-11-03  258  	SET_NETDEV_DEV(dev, &link->dev);
^1da177e4c3f41 drivers/net/pcmcia/com20020_cs.c Linus Torvalds    2005-04-16  259  
^1da177e4c3f41 drivers/net/pcmcia/com20020_cs.c Linus Torvalds    2005-04-16  260  	i = com20020_found(dev, 0);	/* calls register_netdev */
^1da177e4c3f41 drivers/net/pcmcia/com20020_cs.c Linus Torvalds    2005-04-16  261  
^1da177e4c3f41 drivers/net/pcmcia/com20020_cs.c Linus Torvalds    2005-04-16  262  	if (i != 0) {
636b8116d4e116 drivers/net/pcmcia/com20020_cs.c Joe Perches       2010-08-12  263  		dev_notice(&link->dev,
636b8116d4e116 drivers/net/pcmcia/com20020_cs.c Joe Perches       2010-08-12  264  			   "com20020_found() failed\n");
^1da177e4c3f41 drivers/net/pcmcia/com20020_cs.c Linus Torvalds    2005-04-16  265  		goto failed;
^1da177e4c3f41 drivers/net/pcmcia/com20020_cs.c Linus Torvalds    2005-04-16  266  	}
^1da177e4c3f41 drivers/net/pcmcia/com20020_cs.c Linus Torvalds    2005-04-16  267  
636b8116d4e116 drivers/net/pcmcia/com20020_cs.c Joe Perches       2010-08-12 @268  	netdev_dbg(dev, "port %#3lx, irq %d\n",
89e04810927e64 drivers/net/arcnet/com20020_cs.c Vincenzo Palazzo  2023-03-04  269  		   dev->dev_mapping.base_addr, dev->irq);
15b99ac1729503 drivers/net/pcmcia/com20020_cs.c Dominik Brodowski 2006-03-31  270  	return 0;
^1da177e4c3f41 drivers/net/pcmcia/com20020_cs.c Linus Torvalds    2005-04-16  271  
^1da177e4c3f41 drivers/net/pcmcia/com20020_cs.c Linus Torvalds    2005-04-16  272  failed:
dd0fab5b940c0b drivers/net/pcmcia/com20020_cs.c Dominik Brodowski 2009-10-24  273  	dev_dbg(&link->dev, "com20020_config failed...\n");
^1da177e4c3f41 drivers/net/pcmcia/com20020_cs.c Linus Torvalds    2005-04-16  274  	com20020_release(link);
15b99ac1729503 drivers/net/pcmcia/com20020_cs.c Dominik Brodowski 2006-03-31  275  	return -ENODEV;
^1da177e4c3f41 drivers/net/pcmcia/com20020_cs.c Linus Torvalds    2005-04-16  276  } /* com20020_config */
^1da177e4c3f41 drivers/net/pcmcia/com20020_cs.c Linus Torvalds    2005-04-16  277
Jakub Kicinski March 4, 2023, 7:06 p.m. UTC | #4
On Sat,  4 Mar 2023 12:56:26 +0100 Vincenzo Palazzo wrote:
> clean the code by using the ifmap instead of plain fields,
> and avoid code duplication.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Link: https://lore.kernel.org/oe-kbuild-all/202303041847.nRrrz1v9-lkp@intel.com/
> Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>

Please don't, as already explained it's not worth the code churn.

Nacked-by: Jakub Kicinski <kuba@kernel.org>
Vincenzo Palazzo March 4, 2023, 7:33 p.m. UTC | #5
On Sat Mar 4, 2023 at 8:06 PM CET, Jakub Kicinski wrote:
> On Sat,  4 Mar 2023 12:56:26 +0100 Vincenzo Palazzo wrote:
> > clean the code by using the ifmap instead of plain fields,
> > and avoid code duplication.
> > 
> > Reported-by: kernel test robot <lkp@intel.com>
> > Link: https://lore.kernel.org/oe-kbuild-all/202303041847.nRrrz1v9-lkp@intel.com/
> > Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
>
> Please don't, as already explained it's not worth the code churn.

Ah! ok I got it, yes maybe this should be an RFC, I thought also that
this change will impact in so many things!

Ok, so I will remove just the FIXME that at this point is not 
useful anymore.

Cheers!

Vincent.
diff mbox series

Patch

diff --git a/drivers/net/arcnet/com20020_cs.c b/drivers/net/arcnet/com20020_cs.c
index dc3253b318da..5e5e065acfb9 100644
--- a/drivers/net/arcnet/com20020_cs.c
+++ b/drivers/net/arcnet/com20020_cs.c
@@ -229,7 +229,8 @@  static int com20020_config(struct pcmcia_device *link)
 		goto failed;
 	}
 
-	ioaddr = dev->base_addr = link->resource[0]->start;
+	/* FIXME: multiple assignments should be avoided */
+	ioaddr = dev->dev_mapping.base_addr = link->resource[0]->start;
 	dev_dbg(&link->dev, "got ioaddr %Xh\n", ioaddr);
 
 	dev_dbg(&link->dev, "request IRQ %d\n",
@@ -265,7 +266,7 @@  static int com20020_config(struct pcmcia_device *link)
 	}
 
 	netdev_dbg(dev, "port %#3lx, irq %d\n",
-		   dev->base_addr, dev->irq);
+		   dev->dev_mapping.base_addr, dev->irq);
 	return 0;
 
 failed:
@@ -297,7 +298,7 @@  static int com20020_resume(struct pcmcia_device *link)
 	struct net_device *dev = info->dev;
 
 	if (link->open) {
-		int ioaddr = dev->base_addr;
+		int ioaddr = dev->dev_mapping.base_addr;
 		struct arcnet_local *lp = netdev_priv(dev);
 
 		arcnet_outb(lp->config | 0x80, ioaddr, COM20020_REG_W_CONFIG);
diff --git a/drivers/net/ethernet/davicom/dm9000.c b/drivers/net/ethernet/davicom/dm9000.c
index b21e56de6167..5f87903fc516 100644
--- a/drivers/net/ethernet/davicom/dm9000.c
+++ b/drivers/net/ethernet/davicom/dm9000.c
@@ -1569,7 +1569,7 @@  dm9000_probe(struct platform_device *pdev)
 	}
 
 	/* fill in parameters for net-dev structure */
-	ndev->base_addr = (unsigned long)db->io_addr;
+	ndev->dev_mapping.base_addr = (unsigned long)db->io_addr;
 
 	/* ensure at least we have a default set of IO routines */
 	dm9000_set_io(db, iosize);
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index e1eb1de88bf9..059ff8bcdbbc 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -7476,8 +7476,8 @@  static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	netif_napi_add(netdev, &adapter->napi, e1000e_poll);
 	strscpy(netdev->name, pci_name(pdev), sizeof(netdev->name));
 
-	netdev->mem_start = mmio_start;
-	netdev->mem_end = mmio_start + mmio_len;
+	netdev->dev_mapping.mem_start = mmio_start;
+	netdev->dev_mapping.mem_end = mmio_start + mmio_len;
 
 	adapter->bd_number = cards_found++;
 
diff --git a/drivers/net/wan/pc300too.c b/drivers/net/wan/pc300too.c
index 4766446f0fa0..2fd9ce9825e0 100644
--- a/drivers/net/wan/pc300too.c
+++ b/drivers/net/wan/pc300too.c
@@ -434,8 +434,8 @@  static int pc300_pci_init_one(struct pci_dev *pdev,
 
 		spin_lock_init(&port->lock);
 		dev->irq = card->irq;
-		dev->mem_start = ramphys;
-		dev->mem_end = ramphys + ramsize - 1;
+		dev->dev_mapping.mem_start = ramphys;
+		dev->dev_mapping.mem_end = ramphys + ramsize - 1;
 		dev->tx_queue_len = 50;
 		dev->netdev_ops = &pc300_ops;
 		hdlc->attach = sca_attach;
diff --git a/drivers/net/wan/pci200syn.c b/drivers/net/wan/pci200syn.c
index ea86c7035653..6cd2c40ef281 100644
--- a/drivers/net/wan/pci200syn.c
+++ b/drivers/net/wan/pci200syn.c
@@ -373,8 +373,8 @@  static int pci200_pci_init_one(struct pci_dev *pdev,
 
 		spin_lock_init(&port->lock);
 		dev->irq = card->irq;
-		dev->mem_start = ramphys;
-		dev->mem_end = ramphys + ramsize - 1;
+		dev->dev_mapping.mem_start = ramphys;
+		dev->dev_mapping.mem_end = ramphys + ramsize - 1;
 		dev->tx_queue_len = 50;
 		dev->netdev_ops = &pci200_ops;
 		hdlc->attach = sca_attach;
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 6a14b7b11766..c5987e90a078 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2031,13 +2031,7 @@  struct net_device {
 	char			name[IFNAMSIZ];
 	struct netdev_name_node	*name_node;
 	struct dev_ifalias	__rcu *ifalias;
-	/*
-	 *	I/O specific fields
-	 *	FIXME: Merge these and struct ifmap into one
-	 */
-	unsigned long		mem_end;
-	unsigned long		mem_start;
-	unsigned long		base_addr;
+	struct ifmap dev_mapping;
 
 	/*
 	 *	Some hardware also needs these fields (state,dev_list,
diff --git a/net/core/dev_ioctl.c b/net/core/dev_ioctl.c
index 5cdbfbf9a7dc..89469cb97e35 100644
--- a/net/core/dev_ioctl.c
+++ b/net/core/dev_ioctl.c
@@ -88,9 +88,9 @@  static int dev_getifmap(struct net_device *dev, struct ifreq *ifr)
 	if (in_compat_syscall()) {
 		struct compat_ifmap *cifmap = (struct compat_ifmap *)ifmap;
 
-		cifmap->mem_start = dev->mem_start;
-		cifmap->mem_end   = dev->mem_end;
-		cifmap->base_addr = dev->base_addr;
+		cifmap->mem_start = dev->dev_mapping.mem_start;
+		cifmap->mem_end   = dev->dev_mapping.mem_end;
+		cifmap->base_addr = dev->dev_mapping.base_addr;
 		cifmap->irq       = dev->irq;
 		cifmap->dma       = dev->dma;
 		cifmap->port      = dev->if_port;
@@ -98,9 +98,9 @@  static int dev_getifmap(struct net_device *dev, struct ifreq *ifr)
 		return 0;
 	}
 
-	ifmap->mem_start  = dev->mem_start;
-	ifmap->mem_end    = dev->mem_end;
-	ifmap->base_addr  = dev->base_addr;
+	ifmap->mem_start  = dev->dev_mapping.mem_start;
+	ifmap->mem_end    = dev->dev_mapping.mem_end;
+	ifmap->base_addr  = dev->dev_mapping.base_addr;
 	ifmap->irq        = dev->irq;
 	ifmap->dma        = dev->dma;
 	ifmap->port       = dev->if_port;
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 5d8eb57867a9..ff8fc1bbda31 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1445,9 +1445,9 @@  static int rtnl_fill_link_ifmap(struct sk_buff *skb, struct net_device *dev)
 	struct rtnl_link_ifmap map;
 
 	memset(&map, 0, sizeof(map));
-	map.mem_start   = dev->mem_start;
-	map.mem_end     = dev->mem_end;
-	map.base_addr   = dev->base_addr;
+	map.mem_start   = dev->dev_mapping.mem_start;
+	map.mem_end     = dev->dev_mapping.mem_end;
+	map.base_addr   = dev->dev_mapping.base_addr;
 	map.irq         = dev->irq;
 	map.dma         = dev->dma;
 	map.port        = dev->if_port;