From: Greg KH <greg@kroah.com>
To: Zwane Mwaikambo <zwane@linuxpower.ca>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH][2.6][CFT] rmmod floppy kills box fixes + default_device_remove
Date: Mon, 8 Sep 2003 16:08:52 -0700 [thread overview]
Message-ID: <20030908230852.GA3320@kroah.com> (raw)
In-Reply-To: <Pine.LNX.4.53.0309081722270.14426@montezuma.fsmlabs.com>
On Mon, Sep 08, 2003 at 05:27:10PM -0400, Zwane Mwaikambo wrote:
> > What happens if someone grabs the struct device reference by opening a
> > sysfs file and then you unload the module? Yeah, not nice. Please do
>
> Doesn't this all get taken care of by the platform_device_unregister?
No it doesn't, sorry.
> > _not_ create "empty" release() functions, unless you _really_ know what
> > you are doing (and providing a "default" one like this is just ripe for
> > abuse, that warning message in the kernel is there for a reason.)
>
> I know it's begging for abuse, but i don't want to sprinkle empty
> release() functions everywhere, e.g. looking at the floppy driver, i'm
> not quite sure what i'm supposed to do with a release() function there,
> the struct platform_device_struct is statically allocated.
You need to sleep until your release function gets called. Take a look
at the cpufreq code for an example of this (also the i2c core does
this.)
> Basically i'd like a pointer as to what to do with these release()
> functions..
release() is called when the last reference to this device is dropped.
When it is called it is then safe to do the following:
- free the memory of the device
- unload the module of the device
So an empty release() function is the wrong thing to do in 99.99% of the
situations in the kernel (the one exception seems to be the mca release
function that recently got added for use when the bus is doing probing
logic.)
Does this help out?
thanks,
greg k-h
next prev parent reply other threads:[~2003-09-08 23:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-09-08 2:53 [PATCH][2.6][CFT] rmmod floppy kills box fixes + default_device_remove Zwane Mwaikambo
2003-09-08 15:50 ` Greg KH
2003-09-08 21:27 ` Zwane Mwaikambo
2003-09-08 23:08 ` Greg KH [this message]
2003-09-09 11:50 ` Zwane Mwaikambo
2003-09-09 16:38 ` Zwane Mwaikambo
2003-09-09 17:13 ` Greg KH
2003-09-09 19:18 ` Zwane Mwaikambo
2003-09-09 19:45 ` John Levon
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=20030908230852.GA3320@kroah.com \
--to=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=zwane@linuxpower.ca \
/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