Linux-2.6.13 : __check_region is deprecated
Hi,
By compiling my kernel, I can see that the __check_region function (in kernel/resource.c) is deprecated.
With a grep on the source code of the last release, I get this result.
drivers/pnp/resource.c:255: if (__check_region(&ioport_resource, *port, length(port,end)))
include/linux/ioport.h:117:#define check_mem_region(start,n) __check_region(&iomem_resource, (start), (n)) include/linux/ioport.h:120:extern int __check_region(struct resource *, unsigned long, unsigned long);include/linux/ioport.h:125: return __check_region(&ioport_resource, s, n);
kernel/resource.c:468:int __deprecated __check_region(struct resource *parent, unsigned long start, unsigned long n) kernel/resource.c:481:EXPORT_SYMBOL(__check_region);
Is there a function to replace this deprecated function ?
Why is it deprecated ?
Best Regards,
Stephane
Signature · 2 lines
Stephane Wirtel <[email protected]> <[email protected]>
Quoted 7 lines · Stephane Wirtel
Hi,
By compiling my kernel, I can see that the
__check_regionfunction (inkernel/resource.c) is deprecated.With a grep on the source code of the last release, I get this result.
Quoted 8 lines
drivers/pnp/resource.c:255: if (__check_region(&ioport_resource, *port, length(port,end)))
include/linux/ioport.h:117:#definecheck_mem_region(start,n)__check_region(&iomem_resource, (start), (n))include/linux/ioport.h:120:extern int__check_region(struct resource *, unsigned long, unsigned long);include/linux/ioport.h:125: return__check_region(&ioport_resource, s, n);
kernel/resource.c:468:int__deprecated__check_region(struct resource *parent, unsigned long start, unsigned long n)kernel/resource.c:481:EXPORT_SYMBOL(__check_region);Is there a function to replace this deprecated function ?
Just restructure the code to use request_region().
Quoted 1 line
Why is it deprecated ?
because it's racy. I.e., it's normally used as:
check_region(); if (ok) request_region();
but between the check_region() and request_region(), the region could have been allocated by something else.
Signature · 1 line
~Randy
Quoted 5 lines · Stephane Wirtel
Hi,
By compiling my kernel, I can see that the
__check_regionfunction (inkernel/resource.c) is deprecated.
[snip]
Quoted 3 lines
Is there a function to replace this deprecated function ?
Yes, you just call request_region() and check its return value.
Quoted 2 lines
Why is it deprecated ?
In the past you first called check_region() followed by request_region() if the region was available. That is not safe as you could get interrupted between the two calls and something else might have already grabbed the region you thought was free by the time you get to calling request_region(). So, request_region() was rewritten to do the checking internally and let the caller know via its return value if
acquiring the region failed or succeded.
So these days check_region should no longer be used. It's a historic relic. request_region() should be used directly instead. That's why it is deprecated.
Signature · 3 lines
Jesper Juhl <[email protected]> Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html Plain text mails only, please http://www.expita.com/nomime.html
Quoted 1 line · Stephane Wirtel
Is there a function to replace this deprecated function ?
request_region
Quoted 3 lines
Why is it deprecated ?
From http://lists.osdl.org/pipermail/kernel-janitors/2004-January/000346.html:
"The reason that check_region() is deprecated is that it is racy. It could report that a region is available and then another driver could immediately reserve that region, since check_region() doesn't have any reservation capability."
/me wonders why check_region has not been killed, it has been deprecated for years; killing it would force developers to fix it and would help to identify unmaintained drivers...
On 8/30/05, Diego Calleja <[email protected]> wrote:
[snip]
Quoted 4 lines
/me wonders why
check_regionhas not been killed, it has been deprecated for years; killing it would force developers to fix it and would help to identify unmaintained drivers...
I don't see why we should break a bunch of drivers by doing that. Much better, in my oppinion, to fix the few remaining drivers still using check_region and *then* kill it. Even unmaintained drivers may still be useful to a lot of people, no point in just breaking them for the hell of it.
Signature · 3 lines
Jesper Juhl <[email protected]> Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html Plain text mails only, please http://www.expita.com/nomime.html
Quoted 3 lines · Jesper Juhl
I don't see why we should break a bunch of drivers by doing that. Much better, in my oppinion, to fix the few remaining drivers still using
check_regionand *then* kill it. Even unmaintained drivers may
I'd usually agree with you, but check_region has been deprecated for so many time; I was just wondering myself if people will bother to fix the remaining drivers without some "incentive"
Quoted 11 lines · Diego Calleja
Quoted 3 lines · Jesper Juhl
I don't see why we should break a bunch of drivers by doing that. Much better, in my oppinion, to fix the few remaining drivers still using
check_regionand *then* kill it. Even unmaintained drivers mayI'd usually agree with you, but
check_regionhas been deprecated for so many time; I was just wondering myself if people will bother to fix the remaining drivers without some "incentive"
I fixed a few a while back, without any incentive other than "this just needs to be done".
I'm sure noone would object if you submitted a few patches yourself to fix some of the remaining ones.
Signature · 3 lines
Jesper Juhl <[email protected]> Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html Plain text mails only, please http://www.expita.com/nomime.html
Quoted 10 lines · Diego Calleja
Quoted 3 lines · Jesper Juhl
I don't see why we should break a bunch of drivers by doing that. Much better, in my oppinion, to fix the few remaining drivers still using
check_regionand *then* kill it. Even unmaintained drivers mayI'd usually agree with you, but
check_regionhas been deprecated for so many time; I was just wondering myself if people will bother to fix the remaining drivers without some "incentive"
Shouldn't it be (or have been) added to the Documentation/feature-removal-schedule.txt then so it could be deprecated and removed through the proper mechanisms.
Signature · 1 line
David Hollis <[email protected]>
Quoted 8 lines · David Hollis
Quoted 7 lines · Diego Calleja
Quoted 3 lines · Jesper Juhl
I don't see why we should break a bunch of drivers by doing that. Much better, in my oppinion, to fix the few remaining drivers still using
check_regionand *then* kill it. Even unmaintained drivers may
Quoted 7 lines
Quoted 3 lines
I'd usually agree with you, but
check_regionhas been deprecated for so many time; I was just wondering myself if people will bother to fix the remaining drivers without some "incentive"Shouldn't it be (or have been) added to the
Documentation/feature-removal-schedule.txtthen so it could be deprecated and removed through the proper mechanisms.
Why?
Although there is a possible (but not very likely) race condition the drivers usually work fine (they shouldn't work worse than at the time when they were added).
Quoted 1 line
David Hollis <[email protected]>
cu
Adrian
Signature · 4 lines
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon SeedQuoted 8 lines · David Hollis
Quoted 7 lines · Diego Calleja
El Tue, 30 Aug 2005 01:34:25 +0200,
Jesper Juhl <[email protected]> escribió:Quoted 3 lines
I don't see why we should break a bunch of drivers by doing that. Much better, in my oppinion, to fix the few remaining drivers still using
check_regionand *then* kill it. Even unmaintained drivers may
Quoted 7 lines
Quoted 3 lines
I'd usually agree with you, but
check_regionhas been deprecated for so many time; I was just wondering myself if people will bother to fix the remaining drivers without some "incentive"Shouldn't it be (or have been) added to the
Documentation/feature-removal-schedule.txtthen so it could be deprecated and removed through the proper mechanisms.
It should be (or have been) if there were a hard plan and deadline to remove it, but there isn't, and there needn't be, so it's not missing from there IMO.
Signature · 1 line
~Randy
Le Tuesday 30 August 2005 a 01:08, Stephane Wirtel ecrivait:
Quoted 5 lines
Hi,
By compiling my kernel, I can see that the
__check_regionfunction (inkernel/resource.c) is deprecated.
Quoted 8 lines
With a grep on the source code of the last release, I get this result.
drivers/pnp/resource.c:255: if (__check_region(&ioport_resource, *port, length(port,end)))
include/linux/ioport.h:117:#definecheck_mem_region(start,n)__check_region(&iomem_resource, (start), (n))include/linux/ioport.h:120:extern int__check_region(struct resource *, unsigned long, unsigned long);include/linux/ioport.h:125: return__check_region(&ioport_resource, s, n);
kernel/resource.c:468:int__deprecated__check_region(struct resource *parent, unsigned long start, unsigned long n)kernel/resource.c:481:EXPORT_SYMBOL(__check_region);
This morning, I worked on a patch to remove this deprecated function, there are three patchs,
patch for kernel/resource.c
patch for include/linux/ioport.h
patch for drivers/pnp/resource.c
I go to my job, but after, I will check my patches.
Best Regards,
Stephane
Signature · 2 lines
Stephane Wirtel <[email protected]> <[email protected]>