From: Pierre Ossman <drzeus-list@drzeus.cx>
To: Russell King <rmk+lkml@arm.linux.org.uk>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] MMC host class
Date: Fri, 15 Jul 2005 14:26:57 +0200 [thread overview]
Message-ID: <42D7AB91.7040508@drzeus.cx> (raw)
In-Reply-To: <20050715093114.B25428@flint.arm.linux.org.uk>
Russell King wrote:
>No no no no no. Repeat after me ten times. Empty or non-existant release
>functions are bad and cause oopsen. I will not create code which does
>this.
>
>
Sorry. I thought it was a generic cleanup function and since nothing was
allocated in the register function I didn't think it needed to do
anything. I tried to find some documentation about how classes were
handled but eventually had to resort to looking at other code. Perhaps I
should look at the documentation about kernel objects instead?
>What this means is that mmc_host itself becomes a refcounted sysfs
>object which needs to follow the lifetime rules associated therewith.
>
>Luckily, I thought about this earlier on, so there's a core mmc function
>to allocate the beast, register it, unregister it, and finally free it.
>
>The allocation function should initialise class_dev as much as possible.
>
>
The name field cannot be initialised since it isn't generated until
registration. And I avoided filling in the other stuff at allocation so
that I could keep knowledge of mmc_host_class in mmc_sysfs.c.
>The registration function should add the class device with the class
>model. The unregistration should remove the class device from the class
>model, but _not_ free it. The free function should drop the last
>reference to the class device, which results in the remove function
>(eventually) being called. Finally, the remove function can free the
>mmc_host.
>
>
With the remove function you mean the .release in the class struct?
>Also note that since we have a class_dev, the mmc_host 'dev' field can
>be removed. However, we'll probably have to update the host drivers
>to do this, so it should be a separate patch.
>
>
>
I'll read up on kernel objects and sysfs and put together a new patch then.
Rgds
Pierre
next prev parent reply other threads:[~2005-07-15 12:26 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-13 15:52 [PATCH] MMC host class Pierre Ossman
2005-07-15 8:31 ` Russell King
2005-07-15 12:26 ` Pierre Ossman [this message]
2005-07-15 20:21 ` Pierre Ossman
2005-07-18 17:45 ` Russell King
2005-07-18 18:22 ` Pierre Ossman
2005-08-08 11:38 ` Pierre Ossman
2005-08-18 23:09 ` Russell King
2005-08-19 6:14 ` Pierre Ossman
2005-08-19 7:49 ` Russell King
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=42D7AB91.7040508@drzeus.cx \
--to=drzeus-list@drzeus.cx \
--cc=linux-kernel@vger.kernel.org \
--cc=rmk+lkml@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.