* [PATCH 1/6] drivers/i2c: Update i2c_trace_msg static key to modern api
[not found] <20180326210929.5244-1-dave@stgolabs.net>
@ 2018-03-26 21:09 ` Davidlohr Bueso
2018-04-03 13:20 ` Wolfram Sang
2018-04-03 14:49 ` Wolfram Sang
0 siblings, 2 replies; 4+ messages in thread
From: Davidlohr Bueso @ 2018-03-26 21:09 UTC (permalink / raw)
To: peterz, mingo, akpm
Cc: linux-kernel, Davidlohr Bueso, Wolfram Sang, linux-i2c,
Davidlohr Bueso
No changes in refcount semantics -- key init is false; replace
static_key_slow_inc|dec with static_branch_inc|dec
static_key_false with static_branch_unlikely
Added a '_key' suffix to i2c_trace_msg, for better self
documentation.
Cc: Wolfram Sang <wsa@the-dreams.de>
Cc: linux-i2c@vger.kernel.org
Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
---
drivers/i2c/i2c-core-base.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
index 16a3b73375a6..bfcff2a6f0a3 100644
--- a/drivers/i2c/i2c-core-base.c
+++ b/drivers/i2c/i2c-core-base.c
@@ -69,18 +69,18 @@ static DEFINE_IDR(i2c_adapter_idr);
static int i2c_detect(struct i2c_adapter *adapter, struct i2c_driver *driver);
-static struct static_key i2c_trace_msg = STATIC_KEY_INIT_FALSE;
+static DEFINE_STATIC_KEY_FALSE(i2c_trace_msg_key);
static bool is_registered;
int i2c_transfer_trace_reg(void)
{
- static_key_slow_inc(&i2c_trace_msg);
+ static_branch_inc(&i2c_trace_msg_key);
return 0;
}
void i2c_transfer_trace_unreg(void)
{
- static_key_slow_dec(&i2c_trace_msg);
+ static_branch_dec(&i2c_trace_msg_key);
}
const struct i2c_device_id *i2c_match_id(const struct i2c_device_id *id,
@@ -1848,11 +1848,12 @@ int __i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
if (adap->quirks && i2c_check_for_quirks(adap, msgs, num))
return -EOPNOTSUPP;
- /* i2c_trace_msg gets enabled when tracepoint i2c_transfer gets
+ /*
+ * i2c_trace_msg_key gets enabled when tracepoint i2c_transfer gets
* enabled. This is an efficient way of keeping the for-loop from
* being executed when not needed.
*/
- if (static_key_false(&i2c_trace_msg)) {
+ if (static_branch_unlikely(&i2c_trace_msg_key)) {
int i;
for (i = 0; i < num; i++)
if (msgs[i].flags & I2C_M_RD)
@@ -1871,7 +1872,7 @@ int __i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
break;
}
- if (static_key_false(&i2c_trace_msg)) {
+ if (static_branch_unlikely(&i2c_trace_msg_key)) {
int i;
for (i = 0; i < ret; i++)
if (msgs[i].flags & I2C_M_RD)
--
2.13.6
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/6] drivers/i2c: Update i2c_trace_msg static key to modern api
2018-03-26 21:09 ` [PATCH 1/6] drivers/i2c: Update i2c_trace_msg static key to modern api Davidlohr Bueso
@ 2018-04-03 13:20 ` Wolfram Sang
2018-04-03 14:00 ` David Howells
2018-04-03 14:49 ` Wolfram Sang
1 sibling, 1 reply; 4+ messages in thread
From: Wolfram Sang @ 2018-04-03 13:20 UTC (permalink / raw)
To: Davidlohr Bueso, David Howells
Cc: peterz, mingo, akpm, linux-kernel, linux-i2c, Davidlohr Bueso
[-- Attachment #1: Type: text/plain, Size: 2479 bytes --]
On Mon, Mar 26, 2018 at 02:09:24PM -0700, Davidlohr Bueso wrote:
> No changes in refcount semantics -- key init is false; replace
>
> static_key_slow_inc|dec with static_branch_inc|dec
> static_key_false with static_branch_unlikely
>
> Added a '_key' suffix to i2c_trace_msg, for better self
> documentation.
>
CCing David who wrote the original code
> Cc: Wolfram Sang <wsa@the-dreams.de>
> Cc: linux-i2c@vger.kernel.org
> Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
> ---
> drivers/i2c/i2c-core-base.c | 13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
> index 16a3b73375a6..bfcff2a6f0a3 100644
> --- a/drivers/i2c/i2c-core-base.c
> +++ b/drivers/i2c/i2c-core-base.c
> @@ -69,18 +69,18 @@ static DEFINE_IDR(i2c_adapter_idr);
>
> static int i2c_detect(struct i2c_adapter *adapter, struct i2c_driver *driver);
>
> -static struct static_key i2c_trace_msg = STATIC_KEY_INIT_FALSE;
> +static DEFINE_STATIC_KEY_FALSE(i2c_trace_msg_key);
> static bool is_registered;
>
> int i2c_transfer_trace_reg(void)
> {
> - static_key_slow_inc(&i2c_trace_msg);
> + static_branch_inc(&i2c_trace_msg_key);
> return 0;
> }
>
> void i2c_transfer_trace_unreg(void)
> {
> - static_key_slow_dec(&i2c_trace_msg);
> + static_branch_dec(&i2c_trace_msg_key);
> }
>
> const struct i2c_device_id *i2c_match_id(const struct i2c_device_id *id,
> @@ -1848,11 +1848,12 @@ int __i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
> if (adap->quirks && i2c_check_for_quirks(adap, msgs, num))
> return -EOPNOTSUPP;
>
> - /* i2c_trace_msg gets enabled when tracepoint i2c_transfer gets
> + /*
> + * i2c_trace_msg_key gets enabled when tracepoint i2c_transfer gets
> * enabled. This is an efficient way of keeping the for-loop from
> * being executed when not needed.
> */
> - if (static_key_false(&i2c_trace_msg)) {
> + if (static_branch_unlikely(&i2c_trace_msg_key)) {
> int i;
> for (i = 0; i < num; i++)
> if (msgs[i].flags & I2C_M_RD)
> @@ -1871,7 +1872,7 @@ int __i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
> break;
> }
>
> - if (static_key_false(&i2c_trace_msg)) {
> + if (static_branch_unlikely(&i2c_trace_msg_key)) {
> int i;
> for (i = 0; i < ret; i++)
> if (msgs[i].flags & I2C_M_RD)
> --
> 2.13.6
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/6] drivers/i2c: Update i2c_trace_msg static key to modern api
2018-04-03 13:20 ` Wolfram Sang
@ 2018-04-03 14:00 ` David Howells
0 siblings, 0 replies; 4+ messages in thread
From: David Howells @ 2018-04-03 14:00 UTC (permalink / raw)
To: Wolfram Sang
Cc: dhowells, Davidlohr Bueso, peterz, mingo, akpm, linux-kernel,
linux-i2c, Davidlohr Bueso
Wolfram Sang <wsa@the-dreams.de> wrote:
> > No changes in refcount semantics -- key init is false; replace
> >
> > static_key_slow_inc|dec with static_branch_inc|dec
> > static_key_false with static_branch_unlikely
> >
> > Added a '_key' suffix to i2c_trace_msg, for better self
> > documentation.
> >
> > Cc: Wolfram Sang <wsa@the-dreams.de>
> > Cc: linux-i2c@vger.kernel.org
> > Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
Reviewed-by: David Howells <dhowells@redhat.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/6] drivers/i2c: Update i2c_trace_msg static key to modern api
2018-03-26 21:09 ` [PATCH 1/6] drivers/i2c: Update i2c_trace_msg static key to modern api Davidlohr Bueso
2018-04-03 13:20 ` Wolfram Sang
@ 2018-04-03 14:49 ` Wolfram Sang
1 sibling, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2018-04-03 14:49 UTC (permalink / raw)
To: Davidlohr Bueso
Cc: peterz, mingo, akpm, linux-kernel, linux-i2c, Davidlohr Bueso
[-- Attachment #1: Type: text/plain, Size: 496 bytes --]
On Mon, Mar 26, 2018 at 02:09:24PM -0700, Davidlohr Bueso wrote:
> No changes in refcount semantics -- key init is false; replace
>
> static_key_slow_inc|dec with static_branch_inc|dec
> static_key_false with static_branch_unlikely
>
> Added a '_key' suffix to i2c_trace_msg, for better self
> documentation.
>
> Cc: Wolfram Sang <wsa@the-dreams.de>
> Cc: linux-i2c@vger.kernel.org
> Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
Applied to for-next, thanks!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-04-03 14:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20180326210929.5244-1-dave@stgolabs.net>
2018-03-26 21:09 ` [PATCH 1/6] drivers/i2c: Update i2c_trace_msg static key to modern api Davidlohr Bueso
2018-04-03 13:20 ` Wolfram Sang
2018-04-03 14:00 ` David Howells
2018-04-03 14:49 ` Wolfram Sang
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).