[PATCH 3/3] driver: replace dev_request_mem_region with dev_request_mem_resource

Sascha Hauer s.hauer at pengutronix.de
Sun Feb 28 22:41:49 PST 2016


On Fri, Feb 26, 2016 at 09:37:10AM +0100, Teresa Remmet wrote:
> Hello Sascha,
> 
> Am Donnerstag, den 18.02.2016, 11:50 +0100 schrieb Sascha Hauer:
> > dev_request_mem_region doesn't work properly one some SoCs on which
> > PTR_ERR() values clash with valid return values from dev_request_mem_region.
> > Replace them with dev_request_mem_resource where possible.
> > 
> > This patch has been generated with the following semantic patch.
> > 
> > expression d;
> > expression n;
> > expression io;
> > identifier func;
> > @@
> > func(...) {
> > +struct resource *iores;
> > <+...
> > -io = dev_request_mem_region(d, n);
> > -if (IS_ERR(io)) {
> > +iores = dev_request_mem_resource(d, n);
> > +if (IS_ERR(iores)) {
> > ...
> > -	return PTR_ERR(io);
> > -}
> > +	return PTR_ERR(iores);
> > +}
> > +io = IOMEM(iores->start);
> > ...+>
> > }
> > 
> > @@
> > expression d;
> > expression n;
> > expression io;
> > identifier func;
> > @@
> > func(...) {
> > +struct resource *iores;
> > <+...
> > -io = dev_request_mem_region(d, n);
> > -if (IS_ERR(io)) {
> > +iores = dev_request_mem_resource(d, n);
> > +if (IS_ERR(iores))
> > -	return PTR_ERR(io);
> > -}
> > +	return PTR_ERR(iores);
> > +io = IOMEM(iores->start);
> > ...+>
> > }
> > 
> > @@
> > expression d;
> > expression n;
> > expression io;
> > identifier func;
> > @@
> > func(...) {
> > +struct resource *iores;
> > <+...
> > -io = dev_request_mem_region(d, n);
> > -if (IS_ERR(io)) {
> > -	ret = PTR_ERR(io);
> > +iores = dev_request_mem_resource(d, n);
> > +if (IS_ERR(iores)) {
> > +	ret = PTR_ERR(iores);
> 
> here you seem to miss:
> 
> io = IOMEM(iores->start);

Oh, indeed. Thanks for noting. Fixed this up

Sascha



-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list