* Linux-2.6.13 : __check_region is deprecated
@ 2005-08-29 23:14 Stephane Wirtel
2005-08-29 23:21 ` Randy.Dunlap
` (3 more replies)
0 siblings, 4 replies; 11+ messages in thread
From: Stephane Wirtel @ 2005-08-29 23:14 UTC (permalink / raw)
To: linux-kernel
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
--
Stephane Wirtel <stephane.wirtel@belgacom.net>
<stephane.wirtel@gmail.com>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Linux-2.6.13 : __check_region is deprecated
2005-08-29 23:14 Linux-2.6.13 : __check_region is deprecated Stephane Wirtel
@ 2005-08-29 23:21 ` Randy.Dunlap
2005-08-29 23:25 ` Jesper Juhl
` (2 subsequent siblings)
3 siblings, 0 replies; 11+ messages in thread
From: Randy.Dunlap @ 2005-08-29 23:21 UTC (permalink / raw)
To: Stephane Wirtel; +Cc: linux-kernel
On Tue, 30 Aug 2005, Stephane Wirtel wrote:
> 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 ?
Just restructure the code to use request_region().
> 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.
--
~Randy
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Linux-2.6.13 : __check_region is deprecated
2005-08-29 23:14 Linux-2.6.13 : __check_region is deprecated Stephane Wirtel
2005-08-29 23:21 ` Randy.Dunlap
@ 2005-08-29 23:25 ` Jesper Juhl
2005-08-29 23:28 ` Diego Calleja
2005-08-30 6:10 ` Stephane Wirtel
3 siblings, 0 replies; 11+ messages in thread
From: Jesper Juhl @ 2005-08-29 23:25 UTC (permalink / raw)
To: Stephane Wirtel; +Cc: linux-kernel
On 8/30/05, Stephane Wirtel <stephane.wirtel@belgacom.net> wrote:
> Hi,
>
> By compiling my kernel, I can see that the __check_region function (in
> kernel/resource.c) is deprecated.
>
[snip]
>
> Is there a function to replace this deprecated function ?
>
Yes, you just call request_region() and check its return value.
> 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.
--
Jesper Juhl <jesper.juhl@gmail.com>
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
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Linux-2.6.13 : __check_region is deprecated
2005-08-29 23:14 Linux-2.6.13 : __check_region is deprecated Stephane Wirtel
2005-08-29 23:21 ` Randy.Dunlap
2005-08-29 23:25 ` Jesper Juhl
@ 2005-08-29 23:28 ` Diego Calleja
2005-08-29 23:34 ` Jesper Juhl
2005-08-30 6:10 ` Stephane Wirtel
3 siblings, 1 reply; 11+ messages in thread
From: Diego Calleja @ 2005-08-29 23:28 UTC (permalink / raw)
To: Stephane Wirtel; +Cc: linux-kernel
El Tue, 30 Aug 2005 01:14:17 +0200,
Stephane Wirtel <stephane.wirtel@belgacom.net> escribió:
> Is there a function to replace this deprecated function ?
request_region
> 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...
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Linux-2.6.13 : __check_region is deprecated
2005-08-29 23:28 ` Diego Calleja
@ 2005-08-29 23:34 ` Jesper Juhl
2005-08-29 23:55 ` Diego Calleja
0 siblings, 1 reply; 11+ messages in thread
From: Jesper Juhl @ 2005-08-29 23:34 UTC (permalink / raw)
To: Diego Calleja; +Cc: Stephane Wirtel, linux-kernel
On 8/30/05, Diego Calleja <diegocg@gmail.com> wrote:
[snip]
>
> /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...
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.
--
Jesper Juhl <jesper.juhl@gmail.com>
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
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Linux-2.6.13 : __check_region is deprecated
2005-08-29 23:34 ` Jesper Juhl
@ 2005-08-29 23:55 ` Diego Calleja
2005-08-29 23:59 ` Jesper Juhl
2005-08-30 14:28 ` David Hollis
0 siblings, 2 replies; 11+ messages in thread
From: Diego Calleja @ 2005-08-29 23:55 UTC (permalink / raw)
To: Jesper Juhl; +Cc: stephane.wirtel, linux-kernel
El Tue, 30 Aug 2005 01:34:25 +0200,
Jesper Juhl <jesper.juhl@gmail.com> escribió:
> 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
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"
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Linux-2.6.13 : __check_region is deprecated
2005-08-29 23:55 ` Diego Calleja
@ 2005-08-29 23:59 ` Jesper Juhl
2005-08-30 14:28 ` David Hollis
1 sibling, 0 replies; 11+ messages in thread
From: Jesper Juhl @ 2005-08-29 23:59 UTC (permalink / raw)
To: Diego Calleja; +Cc: stephane.wirtel, linux-kernel
On 8/30/05, Diego Calleja <diegocg@gmail.com> wrote:
> El Tue, 30 Aug 2005 01:34:25 +0200,
> Jesper Juhl <jesper.juhl@gmail.com> escribió:
>
> > 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
>
> 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"
>
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.
--
Jesper Juhl <jesper.juhl@gmail.com>
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
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Linux-2.6.13 : __check_region is deprecated
2005-08-29 23:14 Linux-2.6.13 : __check_region is deprecated Stephane Wirtel
` (2 preceding siblings ...)
2005-08-29 23:28 ` Diego Calleja
@ 2005-08-30 6:10 ` Stephane Wirtel
3 siblings, 0 replies; 11+ messages in thread
From: Stephane Wirtel @ 2005-08-30 6:10 UTC (permalink / raw)
To: Stephane Wirtel; +Cc: linux-kernel
Le Tuesday 30 August 2005 a 01:08, Stephane Wirtel ecrivait:
> 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);
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
--
Stephane Wirtel <stephane.wirtel@belgacom.net>
<stephane.wirtel@gmail.com>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Linux-2.6.13 : __check_region is deprecated
2005-08-29 23:55 ` Diego Calleja
2005-08-29 23:59 ` Jesper Juhl
@ 2005-08-30 14:28 ` David Hollis
2005-08-30 14:50 ` Adrian Bunk
2005-08-30 15:09 ` Randy.Dunlap
1 sibling, 2 replies; 11+ messages in thread
From: David Hollis @ 2005-08-30 14:28 UTC (permalink / raw)
To: Diego Calleja; +Cc: Jesper Juhl, stephane.wirtel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 781 bytes --]
On Tue, 2005-08-30 at 01:55 +0200, Diego Calleja wrote:
> El Tue, 30 Aug 2005 01:34:25 +0200,
> Jesper Juhl <jesper.juhl@gmail.com> escribió:
>
> > 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
>
> 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"
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.
--
David Hollis <dhollis@davehollis.com>
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Linux-2.6.13 : __check_region is deprecated
2005-08-30 14:28 ` David Hollis
@ 2005-08-30 14:50 ` Adrian Bunk
2005-08-30 15:09 ` Randy.Dunlap
1 sibling, 0 replies; 11+ messages in thread
From: Adrian Bunk @ 2005-08-30 14:50 UTC (permalink / raw)
To: David Hollis; +Cc: Diego Calleja, Jesper Juhl, stephane.wirtel, linux-kernel
On Tue, Aug 30, 2005 at 10:28:37AM -0400, David Hollis wrote:
> On Tue, 2005-08-30 at 01:55 +0200, Diego Calleja wrote:
> > El Tue, 30 Aug 2005 01:34:25 +0200,
> > Jesper Juhl <jesper.juhl@gmail.com> escribió:
> >
> > > 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
> >
> > 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"
>
> 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.
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).
> David Hollis <dhollis@davehollis.com>
cu
Adrian
--
"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 Seed
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Linux-2.6.13 : __check_region is deprecated
2005-08-30 14:28 ` David Hollis
2005-08-30 14:50 ` Adrian Bunk
@ 2005-08-30 15:09 ` Randy.Dunlap
1 sibling, 0 replies; 11+ messages in thread
From: Randy.Dunlap @ 2005-08-30 15:09 UTC (permalink / raw)
To: David Hollis; +Cc: Diego Calleja, Jesper Juhl, stephane.wirtel, linux-kernel
On Tue, 30 Aug 2005, David Hollis wrote:
> On Tue, 2005-08-30 at 01:55 +0200, Diego Calleja wrote:
> > El Tue, 30 Aug 2005 01:34:25 +0200,
> > Jesper Juhl <jesper.juhl@gmail.com> escribió:
> >
> > > 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
> >
> > 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"
>
> 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.
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.
--
~Randy
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2005-08-30 15:09 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-29 23:14 Linux-2.6.13 : __check_region is deprecated Stephane Wirtel
2005-08-29 23:21 ` Randy.Dunlap
2005-08-29 23:25 ` Jesper Juhl
2005-08-29 23:28 ` Diego Calleja
2005-08-29 23:34 ` Jesper Juhl
2005-08-29 23:55 ` Diego Calleja
2005-08-29 23:59 ` Jesper Juhl
2005-08-30 14:28 ` David Hollis
2005-08-30 14:50 ` Adrian Bunk
2005-08-30 15:09 ` Randy.Dunlap
2005-08-30 6:10 ` Stephane Wirtel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox