From: Cyrill Gorcunov <gorcunov@gmail.com>
To: Ingo Molnar <mingo@elte.hu>, "H. Peter Anvin" <hpa@zytor.com>,
Markus Metzger <markus.t.metzger@intel.com>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] x86: DS cleanup - dont treat 0 as NULL
Date: Mon, 28 Apr 2008 23:15:04 +0400 [thread overview]
Message-ID: <20080428191504.GA6842@cvg> (raw)
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
Actually I wonder why in original code Atom processors was
_that_ aligned? Was it made with a special purpose? yes,
it's a mobile platform, but can't see any reason for such
alignment.
arch/x86/kernel/ds.c | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/arch/x86/kernel/ds.c b/arch/x86/kernel/ds.c
index 5b32b6d..24a323c 100644
--- a/arch/x86/kernel/ds.c
+++ b/arch/x86/kernel/ds.c
@@ -238,12 +238,12 @@ static inline struct ds_context *ds_alloc_context(struct task_struct *task)
context = kzalloc(sizeof(*context), GFP_KERNEL);
if (!context)
- return 0;
+ return NULL;
context->ds = kzalloc(ds_cfg.sizeof_ds, GFP_KERNEL);
if (!context->ds) {
kfree(context);
- return 0;
+ return NULL;
}
*p_context = context;
@@ -279,7 +279,7 @@ static inline void ds_put_context(struct ds_context *context)
if (--context->count)
goto out;
- *(context->this) = 0;
+ *(context->this) = NULL;
if (context->task)
clear_tsk_thread_flag(context->task, TIF_DS_AREA_MSR);
@@ -341,16 +341,16 @@ static inline void *ds_allocate_buffer(size_t size, unsigned int *pages)
rlim = current->signal->rlim[RLIMIT_AS].rlim_cur >> PAGE_SHIFT;
vm = current->mm->total_vm + pgsz;
if (rlim < vm)
- return 0;
+ return NULL;
rlim = current->signal->rlim[RLIMIT_MEMLOCK].rlim_cur >> PAGE_SHIFT;
vm = current->mm->locked_vm + pgsz;
if (rlim < vm)
- return 0;
+ return NULL;
buffer = kzalloc(size, GFP_KERNEL);
if (!buffer)
- return 0;
+ return NULL;
current->mm->total_vm += pgsz;
current->mm->locked_vm += pgsz;
@@ -395,7 +395,7 @@ static int ds_request(struct task_struct *task, void *base, size_t size,
if (context->owner[qual] == current)
goto out_unlock;
error = -EPERM;
- if (context->owner[qual] != 0)
+ if (context->owner[qual] != NULL)
goto out_unlock;
context->owner[qual] = current;
@@ -445,7 +445,7 @@ static int ds_request(struct task_struct *task, void *base, size_t size,
return error;
out_release:
- context->owner[qual] = 0;
+ context->owner[qual] = NULL;
ds_put_context(context);
return error;
@@ -825,7 +825,7 @@ void __cpuinit ds_init_intel(struct cpuinfo_x86 *c)
ds_configure(&ds_cfg_var);
break;
case 0xF: /* Core2 */
- case 0x1C: /* Atom */
+ case 0x1C: /* Atom */
ds_configure(&ds_cfg_64);
break;
default:
next reply other threads:[~2008-04-28 19:16 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-28 19:15 Cyrill Gorcunov [this message]
2008-04-28 19:45 ` [PATCH] x86: DS cleanup - dont treat 0 as NULL H. Peter Anvin
2008-04-28 19:46 ` H. Peter Anvin
2008-04-28 20:00 ` Cyrill Gorcunov
2008-04-28 20:02 ` Ingo Molnar
2008-04-29 6:23 ` David Newall
2008-04-29 6:38 ` H. Peter Anvin
2008-04-29 17:30 ` David Newall
2008-04-29 7:50 ` Cyrill Gorcunov
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=20080428191504.GA6842@cvg \
--to=gorcunov@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=markus.t.metzger@intel.com \
--cc=mingo@elte.hu \
/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