[PATCH 02/13] IB/ehca: includes
Arnd Bergmann
arnd.bergmann at de.ibm.com
Wed Aug 30 19:43:34 EST 2006
On Wednesday 30 August 2006 11:13, Hoang-Nam Nguyen wrote:
> Further comments/suggestions are appreciated!
There are a few places in the driver where you declare
external variables (mostly ehca_module and ehca_debug_level)
from C files instead of a header. This sometimes leads
to bugs when a type changes and is therefore considered
bad style.
ehca_debug_level is already declared in a header so you
should not need any other declaration.
For ehca_module, the usage pattern is very uncommon.
Declaring the structure in a header helps a bit, but I
don't really see the need for this structure at all.
Each member of the struct seems to be used mostly in a
single file, so I would declare it statically in there.
E.g. in drivers/infiniband/hw/ehca/ehca_pd.c, you can do
static struct kmem_cache *ehca_pd_cache;
int ehca_init_pd_cache(void)
{
ehca_pd_cache = kmem_cache_init("ehca_cache_pd",
sizeof(struct ehca_pd), 0, SLAB_HWCACHE_ALIGN,
NULL, NULL);
if (!ehca_pd_cache)
return -ENOMEM;
return 0;
}
void ehca_cleanup_pd_cache(void)
{
if (ehca_pd_cache)
kmem_cache_destroy(ehca_pd_cache);
}
Moreover, for some of your more heavily used caches, you may
want to look into using constructor/destructor calls to
speed up allocation.
Arnd <><
More information about the Linuxppc-dev
mailing list