mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arjan van de Ven <arjan@infradead.org>
To: Zang Roy-r61911 <tie-fei.zang@freescale.com>
Cc: Andrew Morton <akpm@osdl.org>, jgarzik <jgarzik@pobox.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [patch 3/3] Add tsi108 On Chip Ethernet device driver support
Date: Tue, 12 Sep 2006 12:07:49 +0200	[thread overview]
Message-ID: <1158055669.3032.11.camel@laptopd505.fenrus.org> (raw)
In-Reply-To: <1158051351.14448.97.camel@localhost.localdomain>

On Tue, 2006-09-12 at 16:55 +0800, Zang Roy-r61911 wrote:
> The driver for tsi108/9 on chip Ethernet port

Hi,

I have some review comments about your driver; please consider them for
fixing....

> +
> +#undef DEBUG
> +#ifdef DEBUG
> +#define DBG(fmt...) do { printk(fmt); } while(0)
> +#else
> +#define DBG(fmt...) do { } while(0)
> +#endif

please don't do this, there is pr_debug and dev_dbg() for a reason
already. No reason to add a copy.

> +
> +typedef struct net_device net_device;
> +typedef struct sk_buff sk_buff;

Please don't do this...



> +	TSI108_ETH_WRITE_PHYREG(TSI108_MAC_MII_ADDR,
> +				(data->phy << TSI108_MAC_MII_ADDR_PHY) |
> +				(reg << TSI108_MAC_MII_ADDR_REG));
> +	mb();
> +	TSI108_ETH_WRITE_PHYREG(TSI108_MAC_MII_CMD, 0);
> +	mb();
> +	TSI108_ETH_WRITE_PHYREG(TSI108_MAC_MII_CMD, TSI108_MAC_MII_CMD_READ);
> +	mb();

what is this mb() for? do you want them to be an io memory barrier?

> +	while (TSI108_ETH_READ_REG(TSI108_MAC_MII_IND) &
> +	       TSI108_MAC_MII_IND_BUSY) ;

do you want this to be an infinate loop? At minimum the ";" needs to be
a cpu_relax() to avoid the cpu from burning up but it'd be a lot nicer
if this loop wasn't infinite




> +
> +static irqreturn_t tsi108_irq(int irq, void *dev_id, struct pt_regs *regs)
> +{
> +	if (irq == NO_IRQ)
> +		return IRQ_NONE;	/* Not our interrupt */
> +
> +	return tsi108_irq_one(dev_id);
> +}

hi this IRQ_NONE just looks odd, was this really needed?



> +	mb();
> +	while (tsi108_read_mii(data, PHY_CTRL, NULL) & PHY_CTRL_AUTONEG_START)
> +		;

another infinite loop that wants cpu_relax() for sure

> +		spin_unlock_irq(&phy_lock);
> +		msleep(10);
> +		spin_lock_irq(&phy_lock);
> +	}

hmm some places take phy_lock with disabling interrupts, while others
don't. I sort of fear "the others" may be buggy.... are you sure those
are ok?



Greetings,
   Arjan van de Ven


  reply	other threads:[~2006-09-12 10:08 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <A0CDBA58F226D911B202000BDBAD46730A1B1410@zch01exm23.fsl.freescale.net>
     [not found] ` <1157962200.10526.10.camel@localhost.localdomain>
2006-09-12  8:55   ` [patch 0/3] Add tsi108 On chip " Zang Roy-r61911
2006-09-21  4:04     ` [patch 0/3 v2] " Zang Roy-r61911
2006-09-12  8:55   ` [patch 1/3] Add tsi108 on Chip " Zang Roy-r61911
2006-09-21  4:04     ` [patch 1/3 v2] Add tsi108 On " Zang Roy-r61911
2006-09-12  8:55   ` [patch 3/3] " Zang Roy-r61911
2006-09-12 10:07     ` Arjan van de Ven [this message]
2006-09-19  7:39       ` Zang Roy-r61911
2006-09-20  8:45         ` Arjan van de Ven
2006-09-12 14:33     ` Roland Dreier
2006-09-12 14:43       ` Jeff Garzik
2006-09-14  2:51         ` Zang Roy-r61911
     [not found]         ` <1158749825.7973.9.camel@localhost.localdomain>
2006-09-21  4:26           ` Jeff Garzik
2006-09-21  5:46             ` Zang Roy-r61911
2006-09-21  6:30               ` Jeff Garzik
2006-09-21  4:46           ` Jeff Garzik
2006-09-29  7:36             ` Zang Roy-r61911
2006-09-29  7:47               ` Jeff Garzik
2006-10-17  7:18             ` Zang Roy-r61911
2006-10-30  5:19               ` Add tsi108/9 " Zang Roy-r61911
2006-10-31  2:26                 ` [PATCH] " Zang Roy-r61911
2006-10-23  2:09             ` [patch 3/3] Add tsi108 " Zang Roy-r61911
2006-10-26  2:50               ` Zang Roy-r61911
2006-09-21  4:05     ` [patch 3/3 v2] " Zang Roy-r61911

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=1158055669.3032.11.camel@laptopd505.fenrus.org \
    --to=arjan@infradead.org \
    --cc=akpm@osdl.org \
    --cc=jgarzik@pobox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=tie-fei.zang@freescale.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®