mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* question about drivers/i2c/busses/i2c-davinci.c
@ 2013-01-06 20:00 Julia Lawall
  2013-01-24 12:36 ` Wolfram Sang
  0 siblings, 1 reply; 2+ messages in thread
From: Julia Lawall @ 2013-01-06 20:00 UTC (permalink / raw)
  To: nsekhar, khilman, w.sang, ben-linux, grant.likely, rob.herring,
	davinci-linux-open-source, linux-i2c, linux-kernel,
	devicetree-discuss

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.

thanks,
julia

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: question about drivers/i2c/busses/i2c-davinci.c
  2013-01-06 20:00 question about drivers/i2c/busses/i2c-davinci.c Julia Lawall
@ 2013-01-24 12:36 ` Wolfram Sang
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfram Sang @ 2013-01-24 12:36 UTC (permalink / raw)
  To: Julia Lawall
  Cc: nsekhar, khilman, ben-linux, grant.likely, rob.herring,
	davinci-linux-open-source, linux-i2c, linux-kernel,
	devicetree-discuss

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-01-24 12:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-06 20:00 question about drivers/i2c/busses/i2c-davinci.c Julia Lawall
2013-01-24 12:36 ` Wolfram Sang

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®