diff mbox

[1/5] devres: Move managed io function declarations into device.h

Message ID 20180121211508.GB15151@lenoch (mailing list archive)
State New, archived
Delegated to: Bjorn Helgaas
Headers show

Commit Message

Ladislav Michl Jan. 21, 2018, 9:15 p.m. UTC
Moving managed io function declarations into device.h allows
removing forward struct device and resource definitions from
io(port).h

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
---
 include/linux/device.h | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/io.h     | 39 ----------------------------------
 include/linux/ioport.h | 23 --------------------
 3 files changed, 57 insertions(+), 62 deletions(-)

Comments

kernel test robot Jan. 22, 2018, 9:30 a.m. UTC | #1
Hi Ladislav,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on next-20180119]
[also build test ERROR on v4.15-rc9]
[cannot apply to linus/master pci/next l2-mtd-boris/nand/next v4.15-rc8 v4.15-rc7 v4.15-rc6]
[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/Ladislav-Michl/Add-managed-ioremap-function-for-shared-resources/20180122-164512
config: i386-tinyconfig (attached as .config)
compiler: gcc-7 (Debian 7.2.0-12) 7.2.1 20171025
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

   In file included from include/linux/device.h:23:0,
                    from drivers/base/dd.c:19:
   include/linux/pinctrl/devinfo.h:48:44: warning: 'struct device' declared inside parameter list will not be visible outside of this definition or declaration
    static inline int pinctrl_bind_pins(struct device *dev)
                                               ^~~~~~
   include/linux/pinctrl/devinfo.h:53:44: warning: 'struct device' declared inside parameter list will not be visible outside of this definition or declaration
    static inline int pinctrl_init_done(struct device *dev)
                                               ^~~~~~
   drivers/base/dd.c: In function 'really_probe':
>> drivers/base/dd.c:394:26: error: passing argument 1 of 'pinctrl_bind_pins' from incompatible pointer type [-Werror=incompatible-pointer-types]
     ret = pinctrl_bind_pins(dev);
                             ^~~
   In file included from include/linux/device.h:23:0,
                    from drivers/base/dd.c:19:
   include/linux/pinctrl/devinfo.h:48:19: note: expected 'struct device *' but argument is of type 'struct device *'
    static inline int pinctrl_bind_pins(struct device *dev)
                      ^~~~~~~~~~~~~~~~~
>> drivers/base/dd.c:451:20: error: passing argument 1 of 'pinctrl_init_done' from incompatible pointer type [-Werror=incompatible-pointer-types]
     pinctrl_init_done(dev);
                       ^~~
   In file included from include/linux/device.h:23:0,
                    from drivers/base/dd.c:19:
   include/linux/pinctrl/devinfo.h:53:19: note: expected 'struct device *' but argument is of type 'struct device *'
    static inline int pinctrl_init_done(struct device *dev)
                      ^~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +/pinctrl_bind_pins +394 drivers/base/dd.c

0ff26c662 Adrian Hunter      2017-11-02  360  
21c7f30b1 Cornelia Huck      2007-02-05  361  static int really_probe(struct device *dev, struct device_driver *drv)
07e4a3e27 Patrick Mochel     2005-03-21  362  {
013c074f8 Strashko, Grygorii 2015-11-10  363  	int ret = -EPROBE_DEFER;
58b116bce Grant Likely       2014-04-29  364  	int local_trigger_count = atomic_read(&deferred_trigger_count);
c5f062748 Rob Herring        2016-10-11  365  	bool test_remove = IS_ENABLED(CONFIG_DEBUG_TEST_DRIVER_REMOVE) &&
c5f062748 Rob Herring        2016-10-11  366  			   !drv->suppress_bind_attrs;
07e4a3e27 Patrick Mochel     2005-03-21  367  
013c074f8 Strashko, Grygorii 2015-11-10  368  	if (defer_all_probes) {
013c074f8 Strashko, Grygorii 2015-11-10  369  		/*
013c074f8 Strashko, Grygorii 2015-11-10  370  		 * Value of defer_all_probes can be set only by
013c074f8 Strashko, Grygorii 2015-11-10  371  		 * device_defer_all_probes_enable() which, in turn, will call
013c074f8 Strashko, Grygorii 2015-11-10  372  		 * wait_for_device_probe() right after that to avoid any races.
013c074f8 Strashko, Grygorii 2015-11-10  373  		 */
013c074f8 Strashko, Grygorii 2015-11-10  374  		dev_dbg(dev, "Driver %s force probe deferral\n", drv->name);
013c074f8 Strashko, Grygorii 2015-11-10  375  		driver_deferred_probe_add(dev);
013c074f8 Strashko, Grygorii 2015-11-10  376  		return ret;
013c074f8 Strashko, Grygorii 2015-11-10  377  	}
013c074f8 Strashko, Grygorii 2015-11-10  378  
9ed989537 Rafael J. Wysocki  2016-10-30  379  	ret = device_links_check_suppliers(dev);
0ff26c662 Adrian Hunter      2017-11-02  380  	if (ret == -EPROBE_DEFER)
0ff26c662 Adrian Hunter      2017-11-02  381  		driver_deferred_probe_add_trigger(dev, local_trigger_count);
9ed989537 Rafael J. Wysocki  2016-10-30  382  	if (ret)
9ed989537 Rafael J. Wysocki  2016-10-30  383  		return ret;
9ed989537 Rafael J. Wysocki  2016-10-30  384  
d779249ed Greg Kroah-Hartman 2006-07-18  385  	atomic_inc(&probe_count);
7dc72b284 Greg Kroah-Hartman 2007-11-28  386  	pr_debug("bus: '%s': %s: probing driver %s with device %s\n",
1e0b2cf93 Kay Sievers        2008-10-30  387  		 drv->bus->name, __func__, drv->name, dev_name(dev));
9ac7849e3 Tejun Heo          2007-01-20  388  	WARN_ON(!list_empty(&dev->devres_head));
07e4a3e27 Patrick Mochel     2005-03-21  389  
bea5b158f Rob Herring        2016-08-11  390  re_probe:
07e4a3e27 Patrick Mochel     2005-03-21  391  	dev->driver = drv;
ab78029ec Linus Walleij      2013-01-22  392  
ab78029ec Linus Walleij      2013-01-22  393  	/* If using pinctrl, bind pins now before probing */
ab78029ec Linus Walleij      2013-01-22 @394  	ret = pinctrl_bind_pins(dev);
ab78029ec Linus Walleij      2013-01-22  395  	if (ret)
14b6257a5 Andy Shevchenko    2015-12-04  396  		goto pinctrl_bind_failed;
ab78029ec Linus Walleij      2013-01-22  397  
09515ef5d Sricharan R        2017-04-10  398  	ret = dma_configure(dev);
09515ef5d Sricharan R        2017-04-10  399  	if (ret)
09515ef5d Sricharan R        2017-04-10  400  		goto dma_failed;
09515ef5d Sricharan R        2017-04-10  401  
1901fb260 Kay Sievers        2006-10-07  402  	if (driver_sysfs_add(dev)) {
1901fb260 Kay Sievers        2006-10-07  403  		printk(KERN_ERR "%s: driver_sysfs_add(%s) failed\n",
1e0b2cf93 Kay Sievers        2008-10-30  404  			__func__, dev_name(dev));
1901fb260 Kay Sievers        2006-10-07  405  		goto probe_failed;
1901fb260 Kay Sievers        2006-10-07  406  	}
1901fb260 Kay Sievers        2006-10-07  407  
e90d55327 Rafael J. Wysocki  2015-03-20  408  	if (dev->pm_domain && dev->pm_domain->activate) {
e90d55327 Rafael J. Wysocki  2015-03-20  409  		ret = dev->pm_domain->activate(dev);
e90d55327 Rafael J. Wysocki  2015-03-20  410  		if (ret)
e90d55327 Rafael J. Wysocki  2015-03-20  411  			goto probe_failed;
e90d55327 Rafael J. Wysocki  2015-03-20  412  	}
e90d55327 Rafael J. Wysocki  2015-03-20  413  
52cdbdd49 Grygorii Strashko  2015-07-27  414  	/*
52cdbdd49 Grygorii Strashko  2015-07-27  415  	 * Ensure devices are listed in devices_kset in correct order
52cdbdd49 Grygorii Strashko  2015-07-27  416  	 * It's important to move Dev to the end of devices_kset before
52cdbdd49 Grygorii Strashko  2015-07-27  417  	 * calling .probe, because it could be recursive and parent Dev
52cdbdd49 Grygorii Strashko  2015-07-27  418  	 * should always go first
52cdbdd49 Grygorii Strashko  2015-07-27  419  	 */
52cdbdd49 Grygorii Strashko  2015-07-27  420  	devices_kset_move_last(dev);
52cdbdd49 Grygorii Strashko  2015-07-27  421  
594c8281f Russell King       2006-01-05  422  	if (dev->bus->probe) {
594c8281f Russell King       2006-01-05  423  		ret = dev->bus->probe(dev);
1901fb260 Kay Sievers        2006-10-07  424  		if (ret)
d779249ed Greg Kroah-Hartman 2006-07-18  425  			goto probe_failed;
594c8281f Russell King       2006-01-05  426  	} else if (drv->probe) {
0d3e5a2e3 Patrick Mochel     2005-04-05  427  		ret = drv->probe(dev);
1901fb260 Kay Sievers        2006-10-07  428  		if (ret)
d779249ed Greg Kroah-Hartman 2006-07-18  429  			goto probe_failed;
07e4a3e27 Patrick Mochel     2005-03-21  430  	}
1901fb260 Kay Sievers        2006-10-07  431  
bea5b158f Rob Herring        2016-08-11  432  	if (test_remove) {
bea5b158f Rob Herring        2016-08-11  433  		test_remove = false;
bea5b158f Rob Herring        2016-08-11  434  
bdacd1b42 Rob Herring        2016-10-11  435  		if (dev->bus->remove)
bea5b158f Rob Herring        2016-08-11  436  			dev->bus->remove(dev);
bea5b158f Rob Herring        2016-08-11  437  		else if (drv->remove)
bea5b158f Rob Herring        2016-08-11  438  			drv->remove(dev);
bea5b158f Rob Herring        2016-08-11  439  
bea5b158f Rob Herring        2016-08-11  440  		devres_release_all(dev);
bea5b158f Rob Herring        2016-08-11  441  		driver_sysfs_remove(dev);
bea5b158f Rob Herring        2016-08-11  442  		dev->driver = NULL;
bea5b158f Rob Herring        2016-08-11  443  		dev_set_drvdata(dev, NULL);
bea5b158f Rob Herring        2016-08-11  444  		if (dev->pm_domain && dev->pm_domain->dismiss)
bea5b158f Rob Herring        2016-08-11  445  			dev->pm_domain->dismiss(dev);
bea5b158f Rob Herring        2016-08-11  446  		pm_runtime_reinit(dev);
bea5b158f Rob Herring        2016-08-11  447  
bea5b158f Rob Herring        2016-08-11  448  		goto re_probe;
bea5b158f Rob Herring        2016-08-11  449  	}
bea5b158f Rob Herring        2016-08-11  450  
ef0eebc05 Douglas Anderson   2015-10-20 @451  	pinctrl_init_done(dev);
ef0eebc05 Douglas Anderson   2015-10-20  452  
e90d55327 Rafael J. Wysocki  2015-03-20  453  	if (dev->pm_domain && dev->pm_domain->sync)
e90d55327 Rafael J. Wysocki  2015-03-20  454  		dev->pm_domain->sync(dev);
e90d55327 Rafael J. Wysocki  2015-03-20  455  
1901fb260 Kay Sievers        2006-10-07  456  	driver_bound(dev);
0d3e5a2e3 Patrick Mochel     2005-04-05  457  	ret = 1;
7dc72b284 Greg Kroah-Hartman 2007-11-28  458  	pr_debug("bus: '%s': %s: bound device %s to driver %s\n",
1e0b2cf93 Kay Sievers        2008-10-30  459  		 drv->bus->name, __func__, dev_name(dev), drv->name);
d779249ed Greg Kroah-Hartman 2006-07-18  460  	goto done;
2287c322b Patrick Mochel     2005-03-24  461  
d779249ed Greg Kroah-Hartman 2006-07-18  462  probe_failed:
09515ef5d Sricharan R        2017-04-10  463  	dma_deconfigure(dev);
09515ef5d Sricharan R        2017-04-10  464  dma_failed:
14b6257a5 Andy Shevchenko    2015-12-04  465  	if (dev->bus)
14b6257a5 Andy Shevchenko    2015-12-04  466  		blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
14b6257a5 Andy Shevchenko    2015-12-04  467  					     BUS_NOTIFY_DRIVER_NOT_BOUND, dev);
14b6257a5 Andy Shevchenko    2015-12-04  468  pinctrl_bind_failed:
9ed989537 Rafael J. Wysocki  2016-10-30  469  	device_links_no_driver(dev);
9ac7849e3 Tejun Heo          2007-01-20  470  	devres_release_all(dev);
1901fb260 Kay Sievers        2006-10-07  471  	driver_sysfs_remove(dev);
1901fb260 Kay Sievers        2006-10-07  472  	dev->driver = NULL;
0998d0631 Hans de Goede      2012-05-23  473  	dev_set_drvdata(dev, NULL);
e90d55327 Rafael J. Wysocki  2015-03-20  474  	if (dev->pm_domain && dev->pm_domain->dismiss)
e90d55327 Rafael J. Wysocki  2015-03-20  475  		dev->pm_domain->dismiss(dev);
5de85b9d5 Ulf Hansson        2015-11-18  476  	pm_runtime_reinit(dev);
08810a411 Rafael J. Wysocki  2017-10-25  477  	dev_pm_set_driver_flags(dev, 0);
1901fb260 Kay Sievers        2006-10-07  478  
bb2b40754 Sergei Shtylyov    2015-01-17  479  	switch (ret) {
bb2b40754 Sergei Shtylyov    2015-01-17  480  	case -EPROBE_DEFER:
d1c3414c2 Grant Likely       2012-03-05  481  		/* Driver requested deferred probing */
13fcffbbd Mark Brown         2015-03-10  482  		dev_dbg(dev, "Driver %s requests probe deferral\n", drv->name);
0ff26c662 Adrian Hunter      2017-11-02  483  		driver_deferred_probe_add_trigger(dev, local_trigger_count);
bb2b40754 Sergei Shtylyov    2015-01-17  484  		break;
bb2b40754 Sergei Shtylyov    2015-01-17  485  	case -ENODEV:
bb2b40754 Sergei Shtylyov    2015-01-17  486  	case -ENXIO:
bb2b40754 Sergei Shtylyov    2015-01-17  487  		pr_debug("%s: probe of %s rejects match %d\n",
bb2b40754 Sergei Shtylyov    2015-01-17  488  			 drv->name, dev_name(dev), ret);
bb2b40754 Sergei Shtylyov    2015-01-17  489  		break;
bb2b40754 Sergei Shtylyov    2015-01-17  490  	default:
2287c322b Patrick Mochel     2005-03-24  491  		/* driver matched but the probe failed */
2287c322b Patrick Mochel     2005-03-24  492  		printk(KERN_WARNING
2287c322b Patrick Mochel     2005-03-24  493  		       "%s: probe of %s failed with error %d\n",
1e0b2cf93 Kay Sievers        2008-10-30  494  		       drv->name, dev_name(dev), ret);
2287c322b Patrick Mochel     2005-03-24  495  	}
c578abbc2 Cornelia Huck      2006-11-27  496  	/*
c578abbc2 Cornelia Huck      2006-11-27  497  	 * Ignore errors returned by ->probe so that the next driver can try
c578abbc2 Cornelia Huck      2006-11-27  498  	 * its luck.
c578abbc2 Cornelia Huck      2006-11-27  499  	 */
c578abbc2 Cornelia Huck      2006-11-27  500  	ret = 0;
d779249ed Greg Kroah-Hartman 2006-07-18  501  done:
d779249ed Greg Kroah-Hartman 2006-07-18  502  	atomic_dec(&probe_count);
735a7ffb7 Andrew Morton      2006-10-27  503  	wake_up(&probe_waitqueue);
d779249ed Greg Kroah-Hartman 2006-07-18  504  	return ret;
d779249ed Greg Kroah-Hartman 2006-07-18  505  }
d779249ed Greg Kroah-Hartman 2006-07-18  506  

:::::: The code at line 394 was first introduced by commit
:::::: ab78029ecc347debbd737f06688d788bd9d60c1d drivers/pinctrl: grab default handles from device core

:::::: TO: Linus Walleij <linus.walleij@linaro.org>
:::::: CC: Linus Walleij <linus.walleij@linaro.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
kernel test robot Jan. 22, 2018, 10:08 a.m. UTC | #2
Hi Ladislav,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on next-20180119]
[also build test ERROR on v4.15-rc9]
[cannot apply to linus/master pci/next l2-mtd-boris/nand/next v4.15-rc8 v4.15-rc7 v4.15-rc6]
[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/Ladislav-Michl/Add-managed-ioremap-function-for-shared-resources/20180122-164512
config: i386-randconfig-a0-201803 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All error/warnings (new ones prefixed by >>):

   In file included from drivers/mfd/syscon.c:21:0:
   include/linux/of_address.h: In function 'of_io_request_and_map':
>> include/linux/of_address.h:65:2: error: implicit declaration of function 'IOMEM_ERR_PTR' [-Werror=implicit-function-declaration]
     return IOMEM_ERR_PTR(-EINVAL);
     ^
>> include/linux/of_address.h:65:2: warning: return makes pointer from integer without a cast
   cc1: some warnings being treated as errors
--
   In file included from drivers//fpga/altera-pr-ip-core.c:22:0:
>> include/linux/fpga/altera-pr-ip-core.h:26:28: warning: 'struct device' declared inside parameter list
    int alt_pr_register(struct device *dev, void __iomem *reg_base);
                               ^
>> include/linux/fpga/altera-pr-ip-core.h:26:28: warning: its scope is only this definition or declaration, which is probably not what you want
   include/linux/fpga/altera-pr-ip-core.h:27:30: warning: 'struct device' declared inside parameter list
    int alt_pr_unregister(struct device *dev);
                                 ^
>> drivers//fpga/altera-pr-ip-core.c:187:5: error: conflicting types for 'alt_pr_register'
    int alt_pr_register(struct device *dev, void __iomem *reg_base)
        ^
   In file included from drivers//fpga/altera-pr-ip-core.c:22:0:
   include/linux/fpga/altera-pr-ip-core.h:26:5: note: previous declaration of 'alt_pr_register' was here
    int alt_pr_register(struct device *dev, void __iomem *reg_base);
        ^
   In file included from include/linux/linkage.h:7:0,
                    from include/linux/kernel.h:7,
                    from include/linux/delay.h:22,
                    from drivers//fpga/altera-pr-ip-core.c:21:
   drivers//fpga/altera-pr-ip-core.c:206:19: error: conflicting types for 'alt_pr_register'
    EXPORT_SYMBOL_GPL(alt_pr_register);
                      ^
   include/linux/export.h:65:21: note: in definition of macro '___EXPORT_SYMBOL'
     extern typeof(sym) sym;      \
                        ^
   drivers//fpga/altera-pr-ip-core.c:206:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    EXPORT_SYMBOL_GPL(alt_pr_register);
    ^
   In file included from drivers//fpga/altera-pr-ip-core.c:22:0:
   include/linux/fpga/altera-pr-ip-core.h:26:5: note: previous declaration of 'alt_pr_register' was here
    int alt_pr_register(struct device *dev, void __iomem *reg_base);
        ^
>> drivers//fpga/altera-pr-ip-core.c:208:5: error: conflicting types for 'alt_pr_unregister'
    int alt_pr_unregister(struct device *dev)
        ^
   In file included from drivers//fpga/altera-pr-ip-core.c:22:0:
   include/linux/fpga/altera-pr-ip-core.h:27:5: note: previous declaration of 'alt_pr_unregister' was here
    int alt_pr_unregister(struct device *dev);
        ^
   In file included from include/linux/linkage.h:7:0,
                    from include/linux/kernel.h:7,
                    from include/linux/delay.h:22,
                    from drivers//fpga/altera-pr-ip-core.c:21:
   drivers//fpga/altera-pr-ip-core.c:216:19: error: conflicting types for 'alt_pr_unregister'
    EXPORT_SYMBOL_GPL(alt_pr_unregister);
                      ^
   include/linux/export.h:65:21: note: in definition of macro '___EXPORT_SYMBOL'
     extern typeof(sym) sym;      \
                        ^
   drivers//fpga/altera-pr-ip-core.c:216:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    EXPORT_SYMBOL_GPL(alt_pr_unregister);
    ^
   In file included from drivers//fpga/altera-pr-ip-core.c:22:0:
   include/linux/fpga/altera-pr-ip-core.h:27:5: note: previous declaration of 'alt_pr_unregister' was here
    int alt_pr_unregister(struct device *dev);
        ^
--
   In file included from drivers/fpga/altera-pr-ip-core.c:22:0:
>> include/linux/fpga/altera-pr-ip-core.h:26:28: warning: 'struct device' declared inside parameter list
    int alt_pr_register(struct device *dev, void __iomem *reg_base);
                               ^
>> include/linux/fpga/altera-pr-ip-core.h:26:28: warning: its scope is only this definition or declaration, which is probably not what you want
   include/linux/fpga/altera-pr-ip-core.h:27:30: warning: 'struct device' declared inside parameter list
    int alt_pr_unregister(struct device *dev);
                                 ^
   drivers/fpga/altera-pr-ip-core.c:187:5: error: conflicting types for 'alt_pr_register'
    int alt_pr_register(struct device *dev, void __iomem *reg_base)
        ^
   In file included from drivers/fpga/altera-pr-ip-core.c:22:0:
   include/linux/fpga/altera-pr-ip-core.h:26:5: note: previous declaration of 'alt_pr_register' was here
    int alt_pr_register(struct device *dev, void __iomem *reg_base);
        ^
   In file included from include/linux/linkage.h:7:0,
                    from include/linux/kernel.h:7,
                    from include/linux/delay.h:22,
                    from drivers/fpga/altera-pr-ip-core.c:21:
   drivers/fpga/altera-pr-ip-core.c:206:19: error: conflicting types for 'alt_pr_register'
    EXPORT_SYMBOL_GPL(alt_pr_register);
                      ^
   include/linux/export.h:65:21: note: in definition of macro '___EXPORT_SYMBOL'
     extern typeof(sym) sym;      \
                        ^
   drivers/fpga/altera-pr-ip-core.c:206:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    EXPORT_SYMBOL_GPL(alt_pr_register);
    ^
   In file included from drivers/fpga/altera-pr-ip-core.c:22:0:
   include/linux/fpga/altera-pr-ip-core.h:26:5: note: previous declaration of 'alt_pr_register' was here
    int alt_pr_register(struct device *dev, void __iomem *reg_base);
        ^
   drivers/fpga/altera-pr-ip-core.c:208:5: error: conflicting types for 'alt_pr_unregister'
    int alt_pr_unregister(struct device *dev)
        ^
   In file included from drivers/fpga/altera-pr-ip-core.c:22:0:
   include/linux/fpga/altera-pr-ip-core.h:27:5: note: previous declaration of 'alt_pr_unregister' was here
    int alt_pr_unregister(struct device *dev);
        ^
   In file included from include/linux/linkage.h:7:0,
                    from include/linux/kernel.h:7,
                    from include/linux/delay.h:22,
                    from drivers/fpga/altera-pr-ip-core.c:21:
   drivers/fpga/altera-pr-ip-core.c:216:19: error: conflicting types for 'alt_pr_unregister'
    EXPORT_SYMBOL_GPL(alt_pr_unregister);
                      ^
   include/linux/export.h:65:21: note: in definition of macro '___EXPORT_SYMBOL'
     extern typeof(sym) sym;      \
                        ^
   drivers/fpga/altera-pr-ip-core.c:216:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    EXPORT_SYMBOL_GPL(alt_pr_unregister);
    ^
   In file included from drivers/fpga/altera-pr-ip-core.c:22:0:
   include/linux/fpga/altera-pr-ip-core.h:27:5: note: previous declaration of 'alt_pr_unregister' was here
    int alt_pr_unregister(struct device *dev);
        ^

vim +/IOMEM_ERR_PTR +65 include/linux/of_address.h

29b635c0 Andrew Murray             2013-05-16  24  
29b635c0 Andrew Murray             2013-05-16  25  #define for_each_of_pci_range(parser, range) \
29b635c0 Andrew Murray             2013-05-16  26  	for (; of_pci_range_parser_one(parser, range);)
29b635c0 Andrew Murray             2013-05-16  27  
d0dfa16a Rob Herring               2013-09-16  28  /* Translate a DMA address from device space to CPU space */
d0dfa16a Rob Herring               2013-09-16  29  extern u64 of_translate_dma_address(struct device_node *dev,
d0dfa16a Rob Herring               2013-09-16  30  				    const __be32 *in_addr);
d0dfa16a Rob Herring               2013-09-16  31  
a850a755 Grant Likely              2012-02-14  32  #ifdef CONFIG_OF_ADDRESS
0131d897 Sebastian Andrzej Siewior 2010-12-01  33  extern u64 of_translate_address(struct device_node *np, const __be32 *addr);
1f5bef30 Grant Likely              2010-06-08  34  extern int of_address_to_resource(struct device_node *dev, int index,
1f5bef30 Grant Likely              2010-06-08  35  				  struct resource *r);
90e33f62 Grant Likely              2011-07-05  36  extern struct device_node *of_find_matching_node_by_address(
90e33f62 Grant Likely              2011-07-05  37  					struct device_node *from,
90e33f62 Grant Likely              2011-07-05  38  					const struct of_device_id *matches,
90e33f62 Grant Likely              2011-07-05  39  					u64 base_address);
6b884a8d Grant Likely              2010-06-08  40  extern void __iomem *of_iomap(struct device_node *device, int index);
fcd71d9c Sudip Mukherjee           2015-12-08  41  void __iomem *of_io_request_and_map(struct device_node *device,
fcd71d9c Sudip Mukherjee           2015-12-08  42  				    int index, const char *name);
6b884a8d Grant Likely              2010-06-08  43  
22ae782f Grant Likely              2010-07-29  44  /* Extract an address from a device, returns the region size and
22ae782f Grant Likely              2010-07-29  45   * the address space flags too. The PCI version uses a BAR number
22ae782f Grant Likely              2010-07-29  46   * instead of an absolute index
22ae782f Grant Likely              2010-07-29  47   */
47b1e689 Kim Phillips              2012-10-08  48  extern const __be32 *of_get_address(struct device_node *dev, int index,
22ae782f Grant Likely              2010-07-29  49  			   u64 *size, unsigned int *flags);
22ae782f Grant Likely              2010-07-29  50  
29b635c0 Andrew Murray             2013-05-16  51  extern int of_pci_range_parser_init(struct of_pci_range_parser *parser,
29b635c0 Andrew Murray             2013-05-16  52  			struct device_node *node);
a060c210 Marc Gonzalez             2017-09-26  53  extern int of_pci_dma_range_parser_init(struct of_pci_range_parser *parser,
a060c210 Marc Gonzalez             2017-09-26  54  			struct device_node *node);
29b635c0 Andrew Murray             2013-05-16  55  extern struct of_pci_range *of_pci_range_parser_one(
29b635c0 Andrew Murray             2013-05-16  56  					struct of_pci_range_parser *parser,
29b635c0 Andrew Murray             2013-05-16  57  					struct of_pci_range *range);
18308c94 Grygorii Strashko         2014-04-24  58  extern int of_dma_get_range(struct device_node *np, u64 *dma_addr,
18308c94 Grygorii Strashko         2014-04-24  59  				u64 *paddr, u64 *size);
92ea637e Santosh Shilimkar         2014-04-24  60  extern bool of_dma_is_coherent(struct device_node *np);
a850a755 Grant Likely              2012-02-14  61  #else /* CONFIG_OF_ADDRESS */
fcd71d9c Sudip Mukherjee           2015-12-08  62  static inline void __iomem *of_io_request_and_map(struct device_node *device,
fcd71d9c Sudip Mukherjee           2015-12-08  63  						  int index, const char *name)
fcd71d9c Sudip Mukherjee           2015-12-08  64  {
fcd71d9c Sudip Mukherjee           2015-12-08 @65  	return IOMEM_ERR_PTR(-EINVAL);
fcd71d9c Sudip Mukherjee           2015-12-08  66  }
b1d06b60 Guenter Roeck             2015-11-06  67  

:::::: The code at line 65 was first introduced by commit
:::::: fcd71d9cc6e301bdbd71829b79e80168473ca609 of: fix declaration of of_io_request_and_map

:::::: TO: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
:::::: CC: Rob Herring <robh@kernel.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Dmitry Torokhov Jan. 22, 2018, 5:49 p.m. UTC | #3
On Sun, Jan 21, 2018 at 10:15:08PM +0100, Ladislav Michl wrote:
> Moving managed io function declarations into device.h allows
> removing forward struct device and resource definitions from
> io(port).h

In the face of it, what is the issue with forward declarations of device
and resource structures? device.h is supposed to be about Linux device
model, not hardware. You would not want all devm_* functions to go into
device.h (clock, regulator, input, rtc, hwmon, etc, etc devm API),
right? Why would we want ioport there?

Thanks.
Ladislav Michl Jan. 22, 2018, 9:50 p.m. UTC | #4
On Mon, Jan 22, 2018 at 09:49:03AM -0800, Dmitry Torokhov wrote:
> On Sun, Jan 21, 2018 at 10:15:08PM +0100, Ladislav Michl wrote:
> > Moving managed io function declarations into device.h allows
> > removing forward struct device and resource definitions from
> > io(port).h
> 
> In the face of it, what is the issue with forward declarations of device
> and resource structures? device.h is supposed to be about Linux device
> model, not hardware. You would not want all devm_* functions to go into
> device.h (clock, regulator, input, rtc, hwmon, etc, etc devm API),
> right? Why would we want ioport there?

Allright, point taken. Then I would assume devm_ioremap_resource should
be moved from device.h into io.h, to get some consistency, right?
Any other comment (mainly to devm_ioremap_shared_resource) before v2?

Thank you,
	ladis
Dmitry Torokhov Jan. 22, 2018, 11:21 p.m. UTC | #5
On Mon, Jan 22, 2018 at 10:50:57PM +0100, Ladislav Michl wrote:
> On Mon, Jan 22, 2018 at 09:49:03AM -0800, Dmitry Torokhov wrote:
> > On Sun, Jan 21, 2018 at 10:15:08PM +0100, Ladislav Michl wrote:
> > > Moving managed io function declarations into device.h allows
> > > removing forward struct device and resource definitions from
> > > io(port).h
> > 
> > In the face of it, what is the issue with forward declarations of device
> > and resource structures? device.h is supposed to be about Linux device
> > model, not hardware. You would not want all devm_* functions to go into
> > device.h (clock, regulator, input, rtc, hwmon, etc, etc devm API),
> > right? Why would we want ioport there?
> 
> Allright, point taken. Then I would assume devm_ioremap_resource should
> be moved from device.h into io.h, to get some consistency, right?

Yes, I think that would be good.

> Any other comment (mainly to devm_ioremap_shared_resource) before v2?
> 
> Thank you,
> 	ladis

Thanks.
diff mbox

Patch

diff --git a/include/linux/device.h b/include/linux/device.h
index 4d88b6b9cda9..91f508edb266 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -683,8 +683,65 @@  extern unsigned long devm_get_free_pages(struct device *dev,
 					 gfp_t gfp_mask, unsigned int order);
 extern void devm_free_pages(struct device *dev, unsigned long addr);
 
+/* managed resource interface */
+extern int devm_request_resource(struct device *dev, struct resource *root,
+				 struct resource *new);
+extern void devm_release_resource(struct device *dev, struct resource *new);
+
+#define devm_request_region(dev,start,n,name) \
+	__devm_request_region(dev, &ioport_resource, (start), (n), (name))
+#define devm_request_mem_region(dev,start,n,name) \
+	__devm_request_region(dev, &iomem_resource, (start), (n), (name))
+
+extern struct resource * __devm_request_region(struct device *dev,
+				struct resource *parent, resource_size_t start,
+				resource_size_t n, const char *name);
+
+#define devm_release_region(dev, start, n) \
+	__devm_release_region(dev, &ioport_resource, (start), (n))
+#define devm_release_mem_region(dev, start, n) \
+	__devm_release_region(dev, &iomem_resource, (start), (n))
+
+extern void __devm_release_region(struct device *dev, struct resource *parent,
+				  resource_size_t start, resource_size_t n);
+
+/* managed iomap interface */
+#ifdef CONFIG_HAS_IOPORT_MAP
+void __iomem * devm_ioport_map(struct device *dev, unsigned long port,
+			       unsigned int nr);
+void devm_ioport_unmap(struct device *dev, void __iomem *addr);
+#else
+static inline void __iomem *devm_ioport_map(struct device *dev,
+					     unsigned long port,
+					     unsigned int nr)
+{
+	return NULL;
+}
+
+static inline void devm_ioport_unmap(struct device *dev, void __iomem *addr)
+{
+}
+#endif
+
+#define IOMEM_ERR_PTR(err) (__force void __iomem *)ERR_PTR(err)
+
+void __iomem *devm_ioremap(struct device *dev, resource_size_t offset,
+			   resource_size_t size);
+void __iomem *devm_ioremap_nocache(struct device *dev, resource_size_t offset,
+				   resource_size_t size);
+void __iomem *devm_ioremap_wc(struct device *dev, resource_size_t offset,
+				   resource_size_t size);
 void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res);
 
+void devm_iounmap(struct device *dev, void __iomem *addr);
+void devm_ioremap_release(struct device *dev, void *res);
+
+void *devm_memremap(struct device *dev, resource_size_t offset,
+		size_t size, unsigned long flags);
+void devm_memunmap(struct device *dev, void *addr);
+
+void *__devm_memremap_pages(struct device *dev, struct resource *res);
+
 /* allows to add/remove a custom action to devres stack */
 int devm_add_action(struct device *dev, void (*action)(void *), void *data);
 void devm_remove_action(struct device *dev, void (*action)(void *), void *data);
diff --git a/include/linux/io.h b/include/linux/io.h
index 32e30e8fb9db..58554147ccdb 100644
--- a/include/linux/io.h
+++ b/include/linux/io.h
@@ -25,9 +25,6 @@ 
 #include <asm/io.h>
 #include <asm/page.h>
 
-struct device;
-struct resource;
-
 __visible void __iowrite32_copy(void __iomem *to, const void *from, size_t count);
 void __ioread32_copy(void *to, const void __iomem *from, size_t count);
 void __iowrite64_copy(void __iomem *to, const void *from, size_t count);
@@ -51,44 +48,8 @@  int arch_ioremap_pmd_supported(void);
 static inline void ioremap_huge_init(void) { }
 #endif
 
-/*
- * Managed iomap interface
- */
-#ifdef CONFIG_HAS_IOPORT_MAP
-void __iomem * devm_ioport_map(struct device *dev, unsigned long port,
-			       unsigned int nr);
-void devm_ioport_unmap(struct device *dev, void __iomem *addr);
-#else
-static inline void __iomem *devm_ioport_map(struct device *dev,
-					     unsigned long port,
-					     unsigned int nr)
-{
-	return NULL;
-}
-
-static inline void devm_ioport_unmap(struct device *dev, void __iomem *addr)
-{
-}
-#endif
-
-#define IOMEM_ERR_PTR(err) (__force void __iomem *)ERR_PTR(err)
-
-void __iomem *devm_ioremap(struct device *dev, resource_size_t offset,
-			   resource_size_t size);
-void __iomem *devm_ioremap_nocache(struct device *dev, resource_size_t offset,
-				   resource_size_t size);
-void __iomem *devm_ioremap_wc(struct device *dev, resource_size_t offset,
-				   resource_size_t size);
-void devm_iounmap(struct device *dev, void __iomem *addr);
 int check_signature(const volatile void __iomem *io_addr,
 			const unsigned char *signature, int length);
-void devm_ioremap_release(struct device *dev, void *res);
-
-void *devm_memremap(struct device *dev, resource_size_t offset,
-		size_t size, unsigned long flags);
-void devm_memunmap(struct device *dev, void *addr);
-
-void *__devm_memremap_pages(struct device *dev, struct resource *res);
 
 #ifdef CONFIG_PCI
 /*
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index da0ebaec25f0..dc43f2f52416 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -241,29 +241,6 @@  extern int release_mem_region_adjustable(struct resource *, resource_size_t,
 				resource_size_t);
 #endif
 
-/* Wrappers for managed devices */
-struct device;
-
-extern int devm_request_resource(struct device *dev, struct resource *root,
-				 struct resource *new);
-extern void devm_release_resource(struct device *dev, struct resource *new);
-
-#define devm_request_region(dev,start,n,name) \
-	__devm_request_region(dev, &ioport_resource, (start), (n), (name))
-#define devm_request_mem_region(dev,start,n,name) \
-	__devm_request_region(dev, &iomem_resource, (start), (n), (name))
-
-extern struct resource * __devm_request_region(struct device *dev,
-				struct resource *parent, resource_size_t start,
-				resource_size_t n, const char *name);
-
-#define devm_release_region(dev, start, n) \
-	__devm_release_region(dev, &ioport_resource, (start), (n))
-#define devm_release_mem_region(dev, start, n) \
-	__devm_release_region(dev, &iomem_resource, (start), (n))
-
-extern void __devm_release_region(struct device *dev, struct resource *parent,
-				  resource_size_t start, resource_size_t n);
 extern int iomem_map_sanity_check(resource_size_t addr, unsigned long size);
 extern bool iomem_is_exclusive(u64 addr);