linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC] drop owner assignment from platform_drivers
Date: Fri, 10 Oct 2014 09:36:27 +0100	[thread overview]
Message-ID: <20141010083627.GL5182@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <20141010072439.GA1741@katana>

On Fri, Oct 10, 2014 at 09:24:39AM +0200, Wolfram Sang wrote:
> people found out that for platform_driver, we don't need to set the
> .owner field because this is done by the platform driver core. So far,
> so good. However, now I got patches removing the .owner field for this
> single i2c driver or for that one. To prevent getting thousands of
> patches fixing single drivers, I used coccinelle to remove all instances
> from the kernel. The SmPL looks like this, it doesn't blindly remove all
> THIS_MODULE, but checks if the platform_driver struct was really used by
> a call actually setting the .owner field:

Is this correct?

#define platform_driver_register(drv) \
        __platform_driver_register(drv, THIS_MODULE)
extern int __platform_driver_register(struct platform_driver *,
                                        struct module *);

Fine for those which use platform_driver_register(), but:

/* non-hotpluggable platform devices may use this so that probe() and
 * its support may live in __init sections, conserving runtime memory.
 */
extern int platform_driver_probe(struct platform_driver *driver,
                int (*probe)(struct platform_device *));

platform_driver_probe() doesn't seem to know which module called it.
This is also true of platform_create_bundle:

extern struct platform_device *platform_create_bundle(
        struct platform_driver *driver, int (*probe)(struct platform_device *),
        struct resource *res, unsigned int n_res,
        const void *data, size_t size);

So, it's not as trivial as just "all platform driver's should not have a
.owner field" - the real answer is far more complex than that.

-- 
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up
according to speedtest.net.

  parent reply	other threads:[~2014-10-10  8:36 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-10  7:24 [RFC] drop owner assignment from platform_drivers Wolfram Sang
2014-10-10  7:54 ` [Cocci] " Julia Lawall
2014-10-10 18:04   ` Wolfram Sang
2014-10-10  8:30 ` Arnd Bergmann
2014-10-10 18:12   ` Wolfram Sang
2014-10-10 19:39     ` Arnd Bergmann
2014-10-10  8:36 ` Russell King - ARM Linux [this message]
2014-10-10 18:26   ` Wolfram Sang
2014-10-10 19:42     ` Arnd Bergmann
2014-10-11 16:56       ` Wolfram Sang
2014-10-11 17:15         ` Russell King - ARM Linux
2014-10-11 20:55         ` Greg KH
2014-10-12  5:51           ` Wolfram Sang
2014-10-12 14:24             ` Greg KH
2014-10-12 17:01               ` Wolfram Sang
2014-10-10 21:34     ` Russell King - ARM Linux

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=20141010083627.GL5182@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).