mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Jeff Garzik <jeff@garzik.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	rmk@arm.linux.org.uk
Subject: Re: [git patch] free_irq() fixes
Date: Tue, 22 Apr 2008 15:25:39 -0700 (PDT)	[thread overview]
Message-ID: <alpine.LFD.1.10.0804221518520.2779@woody.linux-foundation.org> (raw)
In-Reply-To: <20080422221733.GA16260@havoc.gtf.org>



On Tue, 22 Apr 2008, Jeff Garzik wrote:
>
> diff --git a/arch/arm/mach-integrator/time.c b/arch/arm/mach-integrator/time.c
> index 5235f64..28726ee 100644
> --- a/arch/arm/mach-integrator/time.c
> +++ b/arch/arm/mach-integrator/time.c
> @@ -137,7 +137,7 @@ static int rtc_probe(struct amba_device *dev, void *id)
>  	return 0;
>  
>   irq_out:
> -	free_irq(dev->irq[0], dev);
> +	free_irq(dev->irq[0], NULL);
>   map_out:
>  	iounmap(rtc_base);
>  	rtc_base = NULL;
> @@ -153,7 +153,7 @@ static int rtc_remove(struct amba_device *dev)
>  
>  	writel(0, rtc_base + RTC_CR);
>  
> -	free_irq(dev->irq[0], dev);
> +	free_irq(dev->irq[0], NULL);
>  	unregister_rtc(&rtc_ops);
>  
>  	iounmap(rtc_base);

Quite frankly, I'd actually prefer to just reinstate "dev" to the irq 
registration instead.

Why? Because that field is how we are able to track multiple interrupt 
registrations that share an IRQ. Now, the "request_irq()" logic has a 
special rule that actually tests that NULL is a valid cookie if the 
IRQF_SHARED bit isn't set, but isn't it a nice thing to double-check 
regardless?



> index 37fe80d..5681c01 100644
> --- a/drivers/char/mwave/tp3780i.c
> +++ b/drivers/char/mwave/tp3780i.c
> @@ -274,7 +274,8 @@ int tp3780I_ReleaseResources(THINKPAD_BD_DATA * pBDData)
>  	release_region(pSettings->usDspBaseIO & (~3), 16);
>  
>  	if (pSettings->bInterruptClaimed) {
> -		free_irq(pSettings->usDspIrq, NULL);
> +		free_irq(pSettings->usDspIrq,
> +			 (void *)(unsigned long) pSettings->usDspIrq);

This, in contrast, *really* sucks as a cookie. In fact, it's useless. If 
there are multiple tp3780i instances on the same irq, they will always 
have the same cookie.

That's why we pass in a "device" pointer or similar - exactly to make sure 
that the cookie is unique for that irq resource!

So it would be much nicer to fix the cookie to be a real device pointer 
(why not "pSettings" itself?) that is stable across the whole series of 
request_irq/free_irq. And that also would tend to get rid of the 
butt-ugly casts.

Willing to fix those up?

		Linus

  reply	other threads:[~2008-04-22 22:26 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-22 22:17 Jeff Garzik
2008-04-22 22:25 ` Linus Torvalds [this message]
2008-04-22 22:59   ` Jeff Garzik
2008-04-22 23:20     ` Linus Torvalds
2008-04-22 23:49       ` Jeff Garzik
2008-04-22 23:52         ` Linus Torvalds
2008-04-23  0:05           ` Adrian Bunk
2008-04-23  0:16             ` Linus Torvalds
2008-04-23 13:51               ` Rene Herman
2008-04-24  2:10                 ` Jeff Garzik
2008-04-24  2:19                   ` Linus Torvalds
2008-04-24  5:59                     ` Eric W. Biederman
2008-04-24 10:53                       ` Jeff Garzik
2008-04-24 15:16                         ` Linus Torvalds
2008-04-24 15:40                           ` Jeff Garzik
2008-04-24 15:55                             ` Linus Torvalds
2008-04-24 15:37                               ` Alan Cox
2008-04-24 16:20                                 ` Jeff Garzik
2008-04-24 16:16                               ` Jeff Garzik
2008-04-24 16:48                               ` Eric W. Biederman
2008-04-24 16:58                                 ` Linus Torvalds
2008-04-24 18:15                                   ` Eric W. Biederman
2008-04-24 17:30                                 ` Jeff Garzik
2008-04-25  2:53                                   ` Eric W. Biederman
2008-04-25  3:33                                     ` MSI, fun for the whole family (was Re: [git patch] free_irq() fixes) Jeff Garzik
2008-04-25  3:57                                       ` MSI, fun for the whole family Roland Dreier
2008-04-25  4:19                                         ` David Miller
2008-04-25  4:35                                         ` Jeff Garzik
2008-04-25  5:48                                           ` Eric W. Biederman
2008-04-25 22:44                                           ` Roland Dreier
2008-04-25  5:08                                       ` Eric W. Biederman

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=alpine.LFD.1.10.0804221518520.2779@woody.linux-foundation.org \
    --to=torvalds@linux-foundation.org \
    --cc=akpm@linux-foundation.org \
    --cc=jeff@garzik.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rmk@arm.linux.org.uk \
    /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®