linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
To: Julia Lawall <julia.lawall-L2FTfq7BK8M@public.gmane.org>
Cc: nsekhar-l0cyMroinI0@public.gmane.org,
	khilman-l0cyMroinI0@public.gmane.org,
	ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org,
	grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org,
	davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/@public.gmane.org,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
Subject: Re: question about drivers/i2c/busses/i2c-davinci.c
Date: Thu, 24 Jan 2013 13:36:15 +0100	[thread overview]
Message-ID: <20130124123615.GG12933@pengutronix.de> (raw)
In-Reply-To: <alpine.DEB.2.02.1301062057260.2029-bi+AKbBUZKagILUCTcTcHdKyNwTtLsGr@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 1227 bytes --]

On Sun, Jan 06, 2013 at 09:00:59PM +0100, Julia Lawall wrote:
> The function davinci_i2c_remove in drivers/i2c/busses/i2c-davinci.c
> contains the following code:
> 
>         put_device(&pdev->dev);
> 
>         clk_disable_unprepare(dev->clk);
>         clk_put(dev->clk);
>         dev->clk = NULL;
> 
>         davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, 0);
> 	free_irq(dev->irq, dev);
> 
> Is there any danger in putting free_irq(dev->irq, dev); after
> put_device(&pdev->dev);, because the interrupt handler
> i2c_davinci_isr can eg refer to dev->dev.

Not having a clock doesn't sound exactly thrilling either when servicing
an interrupt. I've seen something like this in the remove path of
another driver today as well. I assume a lot of drivers might have such
issues. It is also one of the subtle issues with devm_request_irq. The
remove path can already render the ISR unusable/oopsable but devm will
free the interrupt only after remove has finished. Interrupts need to be
properly masked out before.

Regards,

   Wolfram

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

      parent reply	other threads:[~2013-01-24 12:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-06 20:00 question about drivers/i2c/busses/i2c-davinci.c Julia Lawall
     [not found] ` <alpine.DEB.2.02.1301062057260.2029-bi+AKbBUZKagILUCTcTcHdKyNwTtLsGr@public.gmane.org>
2013-01-24 12:36   ` Wolfram Sang [this message]

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=20130124123615.GG12933@pengutronix.de \
    --to=w.sang-bicnvbalz9megne8c9+irq@public.gmane.org \
    --cc=ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org \
    --cc=davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/@public.gmane.org \
    --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org \
    --cc=julia.lawall-L2FTfq7BK8M@public.gmane.org \
    --cc=khilman-l0cyMroinI0@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=nsekhar-l0cyMroinI0@public.gmane.org \
    --cc=rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.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;
as well as URLs for NNTP newsgroup(s).