From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: tq 2440
Date: Fri, 16 Jul 2010 10:07:19 +0100 [thread overview]
Message-ID: <20100716090719.GA16995@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <20100716085533.GB2419@suse.de>
On Fri, Jul 16, 2010 at 01:55:33AM -0700, Greg KH wrote:
> On Thu, Jul 15, 2010 at 10:09:36PM +0100, Russell King - ARM Linux wrote:
> > On Thu, Jul 15, 2010 at 01:51:53PM -0700, Greg KH wrote:
> > > On Thu, Jul 15, 2010 at 06:33:22PM +0100, Russell King - ARM Linux wrote:
> > > > Another way to avoid the other complaints is to remove
> > > > the unregistration in platform_register_devices().
> > >
> > > No, because you could have created a platform device with a call to
> > > platform_device_alloc() and then called platform_device_register() and
> > > then later, platform_device_unregister(), right?
> >
> > No. Sorry, platform_register_devices should've been platform_add_devices().
> > Please look at that function.
>
> Hm, it just calls platform_device_register(), so it's pretty hard to
> determine that it's a static device from that function.
>
> > It's used to register an array of static platform devices from architecture
> > code, as I've said in this thread once already.
>
> I can't think of an easy way to prevent these types of devices from
> being removed, other than the existing warnings we have. I'll mull it
> over some more and see if I can come up with something in the future.
platform_add_devices() purpose is to allow platforms to bulk-register
their statically declared platform devices. That's what I created it
for.
The easiest solution is to arrange for platform_add_devices() to avoid
unregistering them all if any one fails - eg, we don't particularly want
the platform device for the serial console being unregistered if a
subsequent device fails.
I'd also argue that it should be trying to register as many of the
platform devices as it possibly can, and only warning about devices
it can't register.
Of course, it is possible that it's been used for other purposes by now -
and yes it has:
drivers/mfd/ab3100-core.c: platform_add_devices(ab3100_platform_devs,
drivers/video/backlight/kb3886_bl.c: platform_add_devices(devices, ARRAY_SIZE(devices));
The first one is an oops waiting to happen - it's a modular driver which
has statically allocated platform devices which it registers, and on
removal it just unregisters its I2C driver. Two problems with that:
1. references hanging around after registration and the memory backing
the driver has been unmapped.
2. if two ab3100 devices are present, the same platform device structures
are attempted to be registered more than once.
kb3886_bl.c has the same problem (1) above.
These two drivers need to be converted to use the platform_device_alloc()
et.al. API, which'll then mean that platform_add_devices() goes back to
its original purpose - bulk registering statically allocated platform
devices from arch code.
next prev parent reply other threads:[~2010-07-16 9:07 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-01 2:31 tq 2440 CoffBeta
2010-07-15 15:16 ` Conke Hu
2010-07-15 16:35 ` Russell King - ARM Linux
2010-07-15 16:51 ` Greg KH
2010-07-15 17:10 ` Russell King - ARM Linux
2010-07-15 17:22 ` Greg KH
2010-07-15 17:33 ` Russell King - ARM Linux
2010-07-15 20:51 ` Greg KH
2010-07-15 21:09 ` Russell King - ARM Linux
2010-07-16 8:55 ` Greg KH
2010-07-16 9:07 ` Russell King - ARM Linux [this message]
2010-07-16 5:40 ` Conke Hu
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=20100716090719.GA16995@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=linux-arm-kernel@lists.infradead.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).