From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
To: Wolfram Sang <wsa@the-dreams.de>
Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org,
Sudip Mukherjee <sudipm.mukherjee@gmail.com>,
gregkh@linuxfoundation.org
Subject: [PATCH] i2c: i2c-core: do not use bus internal data
Date: Mon, 7 Mar 2016 17:19:17 +0530 [thread overview]
Message-ID: <1457351357-13457-1-git-send-email-sudipm.mukherjee@gmail.com> (raw)
The variable p is a data structure which is used by the driver core
internally and it is not expected that busses will be directly accessing
these driver core internal only data.
Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
---
Reference of Greg's comment about it at:
https://lkml.org/lkml/2016/3/5/171
drivers/i2c/i2c-core.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 2949ab3..2f31fb5 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -73,6 +73,7 @@ static struct device_type i2c_client_type;
static int i2c_detect(struct i2c_adapter *adapter, struct i2c_driver *driver);
static struct static_key i2c_trace_msg = STATIC_KEY_INIT_FALSE;
+static bool is_registered;
void i2c_transfer_trace_reg(void)
{
@@ -1529,7 +1530,7 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
int res = 0;
/* Can't register until after driver model init */
- if (unlikely(WARN_ON(!i2c_bus_type.p))) {
+ if (unlikely(WARN_ON(!is_registered))) {
res = -EAGAIN;
goto out_list;
}
@@ -1926,7 +1927,7 @@ int i2c_register_driver(struct module *owner, struct i2c_driver *driver)
int res;
/* Can't register until after driver model init */
- if (unlikely(WARN_ON(!i2c_bus_type.p)))
+ if (unlikely(WARN_ON(!is_registered)))
return -EAGAIN;
/* add the driver to the list of i2c drivers in the driver core */
@@ -2118,6 +2119,7 @@ static int __init i2c_init(void)
if (IS_ENABLED(CONFIG_OF_DYNAMIC))
WARN_ON(of_reconfig_notifier_register(&i2c_of_notifier));
+ is_registered = true;
return 0;
class_err:
--
1.9.1
next reply other threads:[~2016-03-07 11:49 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-07 11:49 Sudip Mukherjee [this message]
2016-03-07 16:57 ` [PATCH] i2c: i2c-core: do not use bus internal data Greg KH
2016-03-07 17:17 ` Sudip Mukherjee
2016-03-12 15:14 ` Wolfram Sang
2016-03-14 9:18 ` Thierry Reding
2016-03-14 9:27 ` Thierry Reding
2016-03-14 12:15 ` Sudeep Holla
2016-03-14 9:28 ` Wolfram Sang
2016-03-14 9:39 ` Thierry Reding
2016-03-14 14:25 ` Sudip Mukherjee
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=1457351357-13457-1-git-send-email-sudipm.mukherjee@gmail.com \
--to=sudipm.mukherjee@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=wsa@the-dreams.de \
/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).