From: Sam Ravnborg <sam@ravnborg.org>
To: Ossama Othman <ossama.othman@intel.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Moorestown RAR Handler driver, MRST 2.6.31-rc3
Date: Sat, 1 Aug 2009 09:30:53 +0200 [thread overview]
Message-ID: <20090801073053.GA30389@merkur.ravnborg.org> (raw)
In-Reply-To: <1249082419-27718-1-git-send-email-ossama.othman@intel.com>
>
> diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
> index b9e5010..3e36269 100644
> --- a/drivers/misc/Kconfig
> +++ b/drivers/misc/Kconfig
> @@ -150,6 +150,18 @@ config ATMEL_SSC
>
> If unsure, say N.
>
> +config MRST_RAR_HANDLER
> + tristate "RAR handler driver for Intel Moorestown platform"
> + depends on X86
> + select RAR_REGISTER
> + default n
n is default - so no need to spell it out.
> + ---help---
> + This driver provides a memory management interface to
> + restricted access regions available in the Intel Moorestown
> + platform.
> +
> + If unsure, say N.
> +
> config MRST_VIB
> tristate "vibrator driver for Intel Moorestown platform"
> help
> diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
> index 0238835..a69bc26 100644
> --- a/drivers/misc/Makefile
> +++ b/drivers/misc/Makefile
> @@ -14,6 +14,8 @@ obj-$(CONFIG_TIFM_7XX1) += tifm_7xx1.o
> obj-$(CONFIG_PHANTOM) += phantom.o
> obj-$(CONFIG_SGI_IOC4) += ioc4.o
> obj-$(CONFIG_MSTWN_POWER_MGMT) += moorestown/
> +obj-$(CONFIG_MRST_RAR_HANDLER) += memrar.o
> +memrar-objs := memrar_allocator.o memrar_handler.o
Please use:
+ memrar-y := memrar_allocator.o memrar_handler.o
The foo-objs syntax is deprecated.
> +
> +
> +#include "memrar_allocator.h"
> +#include <linux/slab.h>
> +#include <linux/bug.h>
<linux/...> comes _before_ you own includes.
And an empty line in between.
> +
> +
> +struct memrar_allocator *memrar_create_allocator(unsigned long base,
> + size_t capacity,
> + size_t block_size)
> +{
> + struct memrar_allocator *allocator = 0;
It is recommended to separate definition,
and assignment.
So this should look like this:
struct memrar_allocator *allocator;
allocator = 0;
> +
> + /* Validate parameters. */
> + if (/*
> + * Make sure we can allocate the entire memory allocator
> + * space.
> + */
> + ULONG_MAX - capacity >= base
> +
> + /* Zero capacity or block size are obviously invalid. */
> + && capacity != 0
> + && block_size != 0) {
Very ugly way to comment your if (..) IMHO
Put the comment abvoe the if.
> + /*
> + * There isn't much point in creating a memory
> + * allocator that is only capable of holding one block
> + * but we'll allow, and issue a diagnostic.
> + */
> + WARN(capacity < block_size * 2,
> + "Memory allocator is only large enough to "
> + "hold one block.\n");
Try to avoid breaking your printable line.
It is much easier to grep for the line when it is on a sinlge
line.
If you violate the 80 chars per line rule do to this then accept
that grepable lines is better than keeping them 80 or less wide.
This comment applies in several places.
> + INIT_LIST_HEAD(&allocator->free_list.list);
> +
> + first_node =
> + kmalloc(sizeof(*first_node), GFP_KERNEL);
No need to break up this line.
> + if (first_node != 0) {
> + /* Full range of blocks is available. */
> + first_node->begin = base;
> + first_node->end =
> + base + allocator->capacity;
> + list_add(&first_node->list,
> + &allocator->free_list.list);
> + } else {
> + kfree(allocator);
> + allocator = 0;
> + }
> + }
> + }
> +
> + return allocator;
> +}
I'm short on time - so this is the comments for today...
Sam
next prev parent reply other threads:[~2009-08-01 7:30 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-31 23:20 Ossama Othman
2009-08-01 7:30 ` Sam Ravnborg [this message]
2009-08-01 8:03 ` Joe Perches
2009-08-03 17:35 ` Othman, Ossama
2009-08-03 17:32 ` Othman, Ossama
2009-08-03 17:45 ` Joe Perches
2009-08-03 17:53 ` Othman, Ossama
2009-08-03 18:31 ` Alan Cox
2009-08-07 18:07 ` Pavel Machek
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=20090801073053.GA30389@merkur.ravnborg.org \
--to=sam@ravnborg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ossama.othman@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®