netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pekka Enberg <penberg@gmail.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Christoph Lameter <christoph@graphe.net>,
	linux-kernel@vger.kernel.org, mark@chelsio.com,
	netdev@oss.sgi.com, Jeff Garzik <jgarzik@pobox.com>,
	penberg@cs.helsinki.fi
Subject: Re: A new 10GB Ethernet Driver by Chelsio Communications
Date: Mon, 14 Mar 2005 13:10:46 +0200	[thread overview]
Message-ID: <84144f0205031403105351abf5@mail.gmail.com> (raw)
In-Reply-To: <20050311112132.6a3a3b49.akpm@osdl.org>

Some of my usual coding style comments...

On Fri, 11 Mar 2005 11:21:32 -0800, Andrew Morton <akpm@osdl.org> wrote:
> diff -puN /dev/null drivers/net/chelsio/osdep.h
> --- /dev/null	2003-09-15 06:40:47.000000000 -0700
> +++ 25-akpm/drivers/net/chelsio/osdep.h	2005-03-11 11:13:06.000000000 -0800
> +static inline void *t1_malloc(size_t len)
> +{
> +	void *m = kmalloc(len, GFP_KERNEL);
> +	if (m)
> +		memset(m, 0, len);
> +	return m;
> +}
> +
> +static inline void t1_free(void *v, size_t len)
> +{
> +	kfree(v);
> +}

Please do not introduce subsystem specific wrappers to kmalloc and kfree.

> +/*
> + * Allocates basic RX resources, consisting of memory mapped freelist Qs and a
> + * response Q.
> + */
> +static int alloc_rx_resources(struct sge *sge, struct sge_params *p)
> +{
> +	struct pci_dev *pdev = sge->adapter->pdev;
> +	unsigned int size, i;
> +
> +	for (i = 0; i < SGE_FREELQ_N; i++) {
> +		struct freelQ *Q = &sge->freelQ[i];
> +
> +		Q->genbit = 1;
> +		Q->entries_n = p->freelQ_size[i];
> +		Q->dma_offset = SGE_RX_OFFSET - sge->rx_pkt_pad;
> +		size = sizeof(struct freelQ_e) * Q->entries_n;
> +		Q->entries = (struct freelQ_e *)
> +			      pci_alloc_consistent(pdev, size, &Q->dma_addr);
> +		if (!Q->entries)
> +			goto err_no_mem;
> +		memset(Q->entries, 0, size);
> +		size = sizeof(struct freelQ_ce) * Q->entries_n;
> +		Q->centries = (struct freelQ_ce *) kmalloc(size, GFP_KERNEL);
> +		if (!Q->centries)
> +			goto err_no_mem;
> +		memset(Q->centries, 0, size);

Please drop the redundant casts and use kcalloc() here and in various
other places as
well.

Also, the patch has some whitespace damage (spaces instead of tabs).

				Pekka

  parent reply	other threads:[~2005-03-14 11:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <Pine.LNX.4.58.0503110356340.14213@server.graphe.net>
2005-03-11 19:21 ` A new 10GB Ethernet Driver by Chelsio Communications Andrew Morton
2005-03-11 19:51   ` Christoph Lameter
2005-03-11 22:24   ` Adrian Bunk
2005-03-11 22:35   ` Stephen Hemminger
2005-03-11 22:58   ` Adrian Bunk
2005-03-12  4:49   ` Jeff Garzik
2005-03-14 11:10   ` Pekka Enberg [this message]
2005-03-14 11:40     ` Pekka Enberg
     [not found] ` <20050311131143.30412d5a.akpm@osdl.org>
     [not found]   ` <Pine.LNX.4.58.0503111620050.29845@server.graphe.net>
     [not found]     ` <20050311170055.5b26147d.akpm@osdl.org>
     [not found]       ` <Pine.LNX.4.58.0503231456190.6109@server.graphe.net>
     [not found]         ` <42438F49.80002@pobox.com>
     [not found]           ` <20050324201826.154a2a50.akpm@osdl.org>
2005-03-25  5:55             ` Jeff Garzik

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=84144f0205031403105351abf5@mail.gmail.com \
    --to=penberg@gmail.com \
    --cc=akpm@osdl.org \
    --cc=christoph@graphe.net \
    --cc=jgarzik@pobox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark@chelsio.com \
    --cc=netdev@oss.sgi.com \
    --cc=penberg@cs.helsinki.fi \
    /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;
as well as URLs for NNTP newsgroup(s).