* [PATCH] semaphore: Resolve some shadow warnings
@ 2014-08-28 12:19 Jeff Kirsher
2014-09-01 12:02 ` Peter Zijlstra
0 siblings, 1 reply; 5+ messages in thread
From: Jeff Kirsher @ 2014-08-28 12:19 UTC (permalink / raw)
To: peterz, mingo; +Cc: Mark Rustad, linux-kernel, Jeff Kirsher
From: Mark Rustad <mark.d.rustad@intel.com>
Resolve some shadow warnings resulting from using the name
jiffies, which is a well-known global. This is not a problem
of course, but it could be a trap for someone copying and
pasting code, and it just makes W=2 a little cleaner.
Signed-off-by: Mark Rustad <mark.d.rustad@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
kernel/locking/semaphore.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/kernel/locking/semaphore.c b/kernel/locking/semaphore.c
index 6815171..7782dbc 100644
--- a/kernel/locking/semaphore.c
+++ b/kernel/locking/semaphore.c
@@ -36,7 +36,7 @@
static noinline void __down(struct semaphore *sem);
static noinline int __down_interruptible(struct semaphore *sem);
static noinline int __down_killable(struct semaphore *sem);
-static noinline int __down_timeout(struct semaphore *sem, long jiffies);
+static noinline int __down_timeout(struct semaphore *sem, long njiffies);
static noinline void __up(struct semaphore *sem);
/**
@@ -145,14 +145,14 @@ EXPORT_SYMBOL(down_trylock);
/**
* down_timeout - acquire the semaphore within a specified time
* @sem: the semaphore to be acquired
- * @jiffies: how long to wait before failing
+ * @njiffies: how long to wait before failing
*
* Attempts to acquire the semaphore. If no more tasks are allowed to
* acquire the semaphore, calling this function will put the task to sleep.
* If the semaphore is not released within the specified number of jiffies,
* this function returns -ETIME. It returns 0 if the semaphore was acquired.
*/
-int down_timeout(struct semaphore *sem, long jiffies)
+int down_timeout(struct semaphore *sem, long njiffies)
{
unsigned long flags;
int result = 0;
@@ -161,7 +161,7 @@ int down_timeout(struct semaphore *sem, long jiffies)
if (likely(sem->count > 0))
sem->count--;
else
- result = __down_timeout(sem, jiffies);
+ result = __down_timeout(sem, njiffies);
raw_spin_unlock_irqrestore(&sem->lock, flags);
return result;
@@ -248,9 +248,9 @@ static noinline int __sched __down_killable(struct semaphore *sem)
return __down_common(sem, TASK_KILLABLE, MAX_SCHEDULE_TIMEOUT);
}
-static noinline int __sched __down_timeout(struct semaphore *sem, long jiffies)
+static noinline int __sched __down_timeout(struct semaphore *sem, long njiffies)
{
- return __down_common(sem, TASK_UNINTERRUPTIBLE, jiffies);
+ return __down_common(sem, TASK_UNINTERRUPTIBLE, njiffies);
}
static noinline void __sched __up(struct semaphore *sem)
--
1.9.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] semaphore: Resolve some shadow warnings
2014-08-28 12:19 [PATCH] semaphore: Resolve some shadow warnings Jeff Kirsher
@ 2014-09-01 12:02 ` Peter Zijlstra
2014-09-01 23:41 ` Jeff Kirsher
0 siblings, 1 reply; 5+ messages in thread
From: Peter Zijlstra @ 2014-09-01 12:02 UTC (permalink / raw)
To: Jeff Kirsher; +Cc: mingo, Mark Rustad, linux-kernel
On Thu, Aug 28, 2014 at 05:19:26AM -0700, Jeff Kirsher wrote:
> From: Mark Rustad <mark.d.rustad@intel.com>
>
> Resolve some shadow warnings resulting from using the name
> jiffies, which is a well-known global. This is not a problem
> of course, but it could be a trap for someone copying and
> pasting code, and it just makes W=2 a little cleaner.
>
> Signed-off-by: Mark Rustad <mark.d.rustad@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Why isn't Mark sending this email?
> ---
> kernel/locking/semaphore.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/kernel/locking/semaphore.c b/kernel/locking/semaphore.c
> index 6815171..7782dbc 100644
> --- a/kernel/locking/semaphore.c
> +++ b/kernel/locking/semaphore.c
> @@ -36,7 +36,7 @@
> static noinline void __down(struct semaphore *sem);
> static noinline int __down_interruptible(struct semaphore *sem);
> static noinline int __down_killable(struct semaphore *sem);
> -static noinline int __down_timeout(struct semaphore *sem, long jiffies);
> +static noinline int __down_timeout(struct semaphore *sem, long njiffies);
> static noinline void __up(struct semaphore *sem);
So what's wrong with calling it "timeout" instead? That's what most
other sites do.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] semaphore: Resolve some shadow warnings
2014-09-01 12:02 ` Peter Zijlstra
@ 2014-09-01 23:41 ` Jeff Kirsher
2014-09-02 21:16 ` Rustad, Mark D
0 siblings, 1 reply; 5+ messages in thread
From: Jeff Kirsher @ 2014-09-01 23:41 UTC (permalink / raw)
To: Peter Zijlstra; +Cc: mingo, Mark Rustad, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1671 bytes --]
On Mon, 2014-09-01 at 14:02 +0200, Peter Zijlstra wrote:
> On Thu, Aug 28, 2014 at 05:19:26AM -0700, Jeff Kirsher wrote:
> > From: Mark Rustad <mark.d.rustad@intel.com>
> >
> > Resolve some shadow warnings resulting from using the name
> > jiffies, which is a well-known global. This is not a problem
> > of course, but it could be a trap for someone copying and
> > pasting code, and it just makes W=2 a little cleaner.
> >
> > Signed-off-by: Mark Rustad <mark.d.rustad@intel.com>
> > Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
>
> Why isn't Mark sending this email?
Mark sent me several patches like this, for me to push upstream. So, I
am making sure the appropriate owner is the receives the patch versus
blindly sending to LKML.
>
> > ---
> > kernel/locking/semaphore.c | 12 ++++++------
> > 1 file changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/kernel/locking/semaphore.c b/kernel/locking/semaphore.c
> > index 6815171..7782dbc 100644
> > --- a/kernel/locking/semaphore.c
> > +++ b/kernel/locking/semaphore.c
> > @@ -36,7 +36,7 @@
> > static noinline void __down(struct semaphore *sem);
> > static noinline int __down_interruptible(struct semaphore *sem);
> > static noinline int __down_killable(struct semaphore *sem);
> > -static noinline int __down_timeout(struct semaphore *sem, long jiffies);
> > +static noinline int __down_timeout(struct semaphore *sem, long njiffies);
> > static noinline void __up(struct semaphore *sem);
>
> So what's wrong with calling it "timeout" instead? That's what most
> other sites do.
Timeout would work as well to resolve the shadow warnings.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] semaphore: Resolve some shadow warnings
2014-09-01 23:41 ` Jeff Kirsher
@ 2014-09-02 21:16 ` Rustad, Mark D
2014-09-03 9:39 ` Peter Zijlstra
0 siblings, 1 reply; 5+ messages in thread
From: Rustad, Mark D @ 2014-09-02 21:16 UTC (permalink / raw)
To: Kirsher, Jeffrey T; +Cc: Peter Zijlstra, mingo, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 2147 bytes --]
On Sep 1, 2014, at 4:41 PM, Jeff Kirsher <jeffrey.t.kirsher@intel.com> wrote:
> On Mon, 2014-09-01 at 14:02 +0200, Peter Zijlstra wrote:
>> On Thu, Aug 28, 2014 at 05:19:26AM -0700, Jeff Kirsher wrote:
>>> From: Mark Rustad <mark.d.rustad@intel.com>
>>>
>>> Resolve some shadow warnings resulting from using the name
>>> jiffies, which is a well-known global. This is not a problem
>>> of course, but it could be a trap for someone copying and
>>> pasting code, and it just makes W=2 a little cleaner.
>>>
>>> Signed-off-by: Mark Rustad <mark.d.rustad@intel.com>
>>> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
>>
>> Why isn't Mark sending this email?
>
> Mark sent me several patches like this, for me to push upstream. So, I
> am making sure the appropriate owner is the receives the patch versus
> blindly sending to LKML.
>
>>
>>> ---
>>> kernel/locking/semaphore.c | 12 ++++++------
>>> 1 file changed, 6 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/kernel/locking/semaphore.c b/kernel/locking/semaphore.c
>>> index 6815171..7782dbc 100644
>>> --- a/kernel/locking/semaphore.c
>>> +++ b/kernel/locking/semaphore.c
>>> @@ -36,7 +36,7 @@
>>> static noinline void __down(struct semaphore *sem);
>>> static noinline int __down_interruptible(struct semaphore *sem);
>>> static noinline int __down_killable(struct semaphore *sem);
>>> -static noinline int __down_timeout(struct semaphore *sem, long jiffies);
>>> +static noinline int __down_timeout(struct semaphore *sem, long njiffies);
>>> static noinline void __up(struct semaphore *sem);
>>
>> So what's wrong with calling it "timeout" instead? That's what most
>> other sites do.
>
> Timeout would work as well to resolve the shadow warnings.
It would, but then it would be unclear as to what units the timeout was in. I have no other objection to timeout, I was just trying to preserve the meaning in the existing overloaded name. The "n" to me suggests a number and, if anything, number of jiffies conveys a more precise meaning than simply jiffies did.
--
Mark Rustad, Networking Division, Intel Corporation
[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 841 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] semaphore: Resolve some shadow warnings
2014-09-02 21:16 ` Rustad, Mark D
@ 2014-09-03 9:39 ` Peter Zijlstra
0 siblings, 0 replies; 5+ messages in thread
From: Peter Zijlstra @ 2014-09-03 9:39 UTC (permalink / raw)
To: Rustad, Mark D; +Cc: Kirsher, Jeffrey T, mingo, linux-kernel
On Tue, Sep 02, 2014 at 09:16:23PM +0000, Rustad, Mark D wrote:
>
> It would, but then it would be unclear as to what units the timeout
> was in. I have no other objection to timeout, I was just trying to
> preserve the meaning in the existing overloaded name. The "n" to me
> suggests a number and, if anything, number of jiffies conveys a more
> precise meaning than simply jiffies did.
Use a comment for the unit. If you look you'll find tons of 'timeout'
variables that measure in jiffies (and others of course).
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-09-03 9:39 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-28 12:19 [PATCH] semaphore: Resolve some shadow warnings Jeff Kirsher
2014-09-01 12:02 ` Peter Zijlstra
2014-09-01 23:41 ` Jeff Kirsher
2014-09-02 21:16 ` Rustad, Mark D
2014-09-03 9:39 ` Peter Zijlstra
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).