mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Jesper Juhl" <jesper.juhl@gmail.com>
To: Surya <surya.prabhakar@wipro.com>
Cc: emoenke@gwdg.de, linux-kernel@vger.kernel.org,
	alan@lxorguk.ukuu.org.uk,
	kernel-janitors <kernel-janitors@lists.osdl.org>,
	trivial <trivial@kernel.org>,
	hannu@opensound.com
Subject: Re: [PATCH]: complete cleanup of check_region
Date: Thu, 7 Jun 2007 12:08:14 +0200	[thread overview]
Message-ID: <9a8748490706070308m7c2212fq30fe712e26e2463b@mail.gmail.com> (raw)
In-Reply-To: <1181209169.2422.12.camel@bluegenie>

On 07/06/07, Surya <surya.prabhakar@wipro.com> wrote:
> Hi all,
>         This patch cleans up all the instances of check_region and
> __check_region and replaces them with request_region and
> __request_region. Applies and compiles clean on latest Linus tree.
>
> Files affected:
>         drivers/cdrom/sbpcd.c
>         drivers/pnp/resource.c
>         include/linux/ioport.h
>         kernel/resource.c
>         sound/oss/pss.c
>
>
> thanks.
>
>
> Signed-off-by: Surya Prabhakar <surya.prabhakar@wipro.com>
> ---
>
> diff --git a/drivers/cdrom/sbpcd.c b/drivers/cdrom/sbpcd.c
> index a1283b1..2c1355e 100644
> --- a/drivers/cdrom/sbpcd.c
> +++ b/drivers/cdrom/sbpcd.c
> @@ -358,6 +358,11 @@
>   * Add bio/kdev_t changes for 2.5.x required to make it work again.
>   * Still room for improvement in the request handling here if anyone
>   * actually cares.  Bring your own chainsaw.    Paul G.  02/2002
> + *
> + *
> + * Cleaned up the reference for deprecated check_region to
> + * request_region.
> + * Thu Jun  7 12:14:00 IST 2007 Surya <surya.prabhakar@wipro.com>
>   */
>
>
> @@ -5670,7 +5675,7 @@ int __init sbpcd_init(void)
>         {
>                 addr[1]=sbpcd[port_index];
>                 if (addr[1]==0) break;
> -               if (check_region(addr[1],4))
> +               if (request_region(addr[1],4, "sbpcd driver"))

No!  You can't just swap one for the other.

check_region() simply checks if the region is available, it doesn't
reserve it (well, it does, briefly, but it lets it go again).
request_region() reserves the region. That's different behaviour that
you need to take into account.

Then there's the matter of return values. check_region() returns 0 on
success while request_region returns != 0 on success. I don't see your
patch dealing with that.

And finally, now that you request (and thus reserve) these regions,
where is the code to release them again when they are no longer
needed. just as memory allocated with kmalloc() needs to be freed with
kfree() after use, so regions reserved with request_region() need to
be released again with release_region() when they are no longer
needed. I don't see anything in your patch that releases the requested
regions.

Same comments for the rest of the patch.

-- 
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

  reply	other threads:[~2007-06-07 10:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-07  9:39 Surya
2007-06-07 10:08 ` Jesper Juhl [this message]
     [not found]   ` <1181215018.3275.2.camel@bluegenie>
     [not found]     ` <9a8748490706070902i218e01bdq1c418c770e99ca4@mail.gmail.com>
2007-06-08  2:46       ` Surya
2007-06-11 11:18         ` Jesper Juhl
2007-06-12  4:15           ` [PATCH]: check_region cleanup in sbpcd.c Surya
2007-06-25 23:07             ` Jesper Juhl
2007-06-07 11:33 ` [PATCH]: complete cleanup of check_region Eberhard Moenkeberg
2007-06-07 13:07   ` Jesper Juhl
2007-06-07 14:11     ` Eberhard Moenkeberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9a8748490706070308m7c2212fq30fe712e26e2463b@mail.gmail.com \
    --to=jesper.juhl@gmail.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=emoenke@gwdg.de \
    --cc=hannu@opensound.com \
    --cc=kernel-janitors@lists.osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=surya.prabhakar@wipro.com \
    --cc=trivial@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®