netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Jay Cliburn <jacliburn@bellsouth.net>
Cc: jeff@garzik.org, shemminger@osdl.org, csnook@redhat.com,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	atl1-devel@lists.sourceforge.net
Subject: Re: [PATCH 3/4] atl1: Main C file for Attansic L1 driver
Date: Thu, 11 Jan 2007 09:33:16 +0000	[thread overview]
Message-ID: <20070111093316.GC3141@infradead.org> (raw)
In-Reply-To: <20070111004226.GD2624@osprey.hogchain.net>

> +#include <asm/page.h>

Why do you need this one?

> +#include <asm/system.h>

Shouldn't be needed aswell.

> +#include <asm/checksum.h>

<net/checksum.h>, please.

> +	spin_lock_init(&adapter->stats_lock);
> +	spin_lock_init(&adapter->tx_lock);
> +	spin_lock_init(&adapter->mb_lock);
> +	spin_lock_init(&adapter->vl_lock);
> +	spin_lock_init(&adapter->mii_lock);

Do you really need that many locks?

> +static inline void atl1_irq_enable(struct atl1_adapter *adapter)
> +{
> +	if (likely(0 == atomic_dec_and_test(&adapter->irq_sem)))
> +		atl1_write32(&adapter->hw, REG_IMR, IMR_NORMAL_MASK);
> +}

We normally prefer atomic_dec_and_test(&adapter->irq_sem) == 0 or
just !atomic_dec_and_test(&adapter->irq_sem).

Also all these little helpers should probably not be marked inline
so gcc can decide on it's own merit which static function to inline.

> +static int atl1_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
> +{
> +	switch (cmd) {
> +	case SIOCGMIIPHY:
> +	case SIOCGMIIREG:
> +	case SIOCSMIIREG:
> +		return atl1_mii_ioctl(netdev, ifr, cmd);
> +	case SIOCETHTOOL:
> +		atl1_set_ethtool_ops(netdev);

ethtool doesn't use the ioctl path anymore at all.

> +static int atl1_open(struct net_device *netdev)
> +{
> +	struct atl1_adapter *adapter = netdev_priv(netdev);
> +	int err;
> +
> +	/* allocate transmit descriptors */
> +	if ((err = atl1_setup_ring_resources(adapter)))
> +		return err;
> +	if ((err = atl1_up(adapter)))
> +		goto err_up;

Preffered style for this is:

	err = atl1_setup_ring_resources(adapter);
	if (err)
		return err;
	err = atl1_up(adapter);
	if (err)
		goto err_up;

(also applies in various other places)


  reply	other threads:[~2007-01-11  9:33 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-11  0:42 [PATCH 3/4] atl1: Main C file for Attansic L1 driver Jay Cliburn
2007-01-11  9:33 ` Christoph Hellwig [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-01-21 21:06 Jay Cliburn
2007-01-22  8:22 ` Arjan van de Ven
2007-01-22 16:48   ` Jay Cliburn
2006-11-19 20:30 Jay Cliburn
2006-11-19 21:46 ` Jan Engelhardt
2006-11-19 23:57 ` Arnd Bergmann
2006-11-20  6:12   ` Chris Snook
2006-11-20 12:21     ` Arnd Bergmann
2006-11-20 18:02       ` Stephen Hemminger
2006-11-20 19:35         ` Jeff Garzik
2006-11-20 20:15           ` Stephen Hemminger
2006-11-20 21:36             ` Jeff Garzik
2006-11-20 21:59               ` Stephen Hemminger
2006-11-20 22:04                 ` Jeff Garzik
2006-11-20 23:17                   ` Stephen Hemminger
2006-11-20 12:39 ` Chris Snook

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=20070111093316.GC3141@infradead.org \
    --to=hch@infradead.org \
    --cc=atl1-devel@lists.sourceforge.net \
    --cc=csnook@redhat.com \
    --cc=jacliburn@bellsouth.net \
    --cc=jeff@garzik.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@osdl.org \
    /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).