From: Russell King - ARM Linux <linux@armlinux.org.uk>
To: Lee Jones <lee.jones@linaro.org>
Cc: Tony Lindgren <tony@atomide.com>,
Nicolae Rosia <nicolae.rosia.oss@gmail.com>,
linux-omap@vger.kernel.org,
Nicolae Rosia <Nicolae_Rosia@mentor.com>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] mfd: twl-core: export twl_get_regmap
Date: Mon, 21 Nov 2016 09:31:45 +0000 [thread overview]
Message-ID: <20161121093144.GE23750@n2100.armlinux.org.uk> (raw)
In-Reply-To: <20161121092339.GA32509@dell>
On Mon, Nov 21, 2016 at 09:23:39AM +0000, Lee Jones wrote:
> It's common place to pass shared resources such as 'regmap' though
> device data. You can find many examples of *__set_drvdata throughout
> the kernel.
Passing data between drivers using *_set_drvdata() is a layering
violation:
1. Driver data is supposed to be driver private data associated with
the currently bound driver.
2. The driver data pointer is NULL'd when the driver unbinds from the
device. See __device_release_driver() and the
dev_set_drvdata(dev, NULL).
3. It will break with CONFIG_DEBUG_TEST_DRIVER_REMOVE enabled for a
similar reason to (2).
So, do not pass data between drivers using *_set_drvdata() - any
examples in the kernel already are founded on bad practice, are
fragile, and are already broken for some kernel configurations.
--
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
WARNING: multiple messages have this Message-ID (diff)
From: linux@armlinux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] mfd: twl-core: export twl_get_regmap
Date: Mon, 21 Nov 2016 09:31:45 +0000 [thread overview]
Message-ID: <20161121093144.GE23750@n2100.armlinux.org.uk> (raw)
In-Reply-To: <20161121092339.GA32509@dell>
On Mon, Nov 21, 2016 at 09:23:39AM +0000, Lee Jones wrote:
> It's common place to pass shared resources such as 'regmap' though
> device data. You can find many examples of *__set_drvdata throughout
> the kernel.
Passing data between drivers using *_set_drvdata() is a layering
violation:
1. Driver data is supposed to be driver private data associated with
the currently bound driver.
2. The driver data pointer is NULL'd when the driver unbinds from the
device. See __device_release_driver() and the
dev_set_drvdata(dev, NULL).
3. It will break with CONFIG_DEBUG_TEST_DRIVER_REMOVE enabled for a
similar reason to (2).
So, do not pass data between drivers using *_set_drvdata() - any
examples in the kernel already are founded on bad practice, are
fragile, and are already broken for some kernel configurations.
--
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
next prev parent reply other threads:[~2016-11-21 9:31 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-12 11:38 [PATCH] mfd: twl-core: export twl_get_regmap Nicolae Rosia
2016-11-12 11:38 ` Nicolae Rosia
2016-11-18 18:55 ` Lee Jones
2016-11-18 18:55 ` Lee Jones
2016-11-20 12:54 ` Nicolae Rosia
2016-11-20 12:54 ` Nicolae Rosia
2016-11-21 9:23 ` Lee Jones
2016-11-21 9:23 ` Lee Jones
2016-11-21 9:31 ` Russell King - ARM Linux [this message]
2016-11-21 9:31 ` Russell King - ARM Linux
2016-11-21 10:03 ` Nicolae Rosia
2016-11-21 10:03 ` Nicolae Rosia
2016-11-21 13:37 ` Russell King - ARM Linux
2016-11-21 13:37 ` Russell King - ARM Linux
2016-11-23 11:12 ` Russell King - ARM Linux
2016-11-23 11:12 ` Russell King - ARM Linux
2016-11-23 11:22 ` Rosia, Nicolae
2016-11-23 11:22 ` Rosia, Nicolae
2016-11-26 18:23 ` Nicolae Rosia
2016-11-26 18:23 ` Nicolae Rosia
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=20161121093144.GE23750@n2100.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=Nicolae_Rosia@mentor.com \
--cc=lee.jones@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-omap@vger.kernel.org \
--cc=nicolae.rosia.oss@gmail.com \
--cc=tony@atomide.com \
/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.