All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ralf Baechle <ralf@linux-mips.org>
To: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc: linux-mips@linux-mips.org, sshtylyov@ru.mvista.com, mlachwani@mvista.com
Subject: Re: [PATCH 3/4] rbtx4938: Fix secondary PCIC and glue internal NICs
Date: Mon, 25 Jun 2007 02:28:22 +0200	[thread overview]
Message-ID: <20070625002822.GD5814@linux-mips.org> (raw)
In-Reply-To: <20070622.232219.48807177.anemo@mba.ocn.ne.jp>

On Fri, Jun 22, 2007 at 11:22:19PM +0900, Atsushi Nemoto wrote:

> +static int rbtx4938_netdev_event(struct notifier_block *this,
> +				 unsigned long event,
> +				 void *ptr)
>  {
> -	struct pci_controller *channel = (struct pci_controller *)dev->bus->sysdata;
> -	int ch = 0;
> -
> -	if (channel != &tx4938_pci_controller[1])
> -		return -ENODEV;
> -	/* TX4938 PCIC1 */
> -	switch (PCI_SLOT(dev->devfn)) {
> -	case TX4938_PCIC_IDSEL_AD_TO_SLOT(31):
> -		ch = 0;
> -		break;
> -	case TX4938_PCIC_IDSEL_AD_TO_SLOT(30):
> -		ch = 1;
> -		break;
> -	default:
> -		return -ENODEV;
> +	struct net_device *dev = ptr;
> +	if (event == NETDEV_REGISTER) {
> +		int ch = -1;
> +		if (dev->irq == RBTX4938_IRQ_IRC + TX4938_IR_ETH0)
> +			ch = 0;
> +		else if (dev->irq == RBTX4938_IRQ_IRC + TX4938_IR_ETH1)
> +			ch = 1;
> +		if (ch >= 0)
> +			memcpy(dev->dev_addr,
> +			       &rbtx4938_ethaddr[4 + 6 * ch], 6);
>  	}
> -	memcpy(addr, &rbtx4938_ethaddr[4 + 6 * ch], 6);

<jgarzik> Ralf: probably not...  :)
<jgarzik> Ralf: dev->open() assumes dev->dev_addr[] is filled in, when interface goes up, and each NIC driver should use that and write the MAC address in dev->dev_addr[] to its RX filter / MAC address registers
<jgarzik> Ralf: the default value should be filled in before netdev is registers
<jgarzik> registered
<jgarzik> Ralf: well, ->open() is just the manifestation of interface-up operation, with all the notifications that that entails.  At that point, NIC driver should not be touching dev->dev_addr[], because it may have already been supplied by the user via ifconfig, when the interface was down.
<jgarzik> Ralf: dev->dev_addr[] should definitely be filled in before the call to register_netdev()

  Ralf

  reply	other threads:[~2007-06-25  0:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-22 14:22 [PATCH 3/4] rbtx4938: Fix secondary PCIC and glue internal NICs Atsushi Nemoto
2007-06-25  0:28 ` Ralf Baechle [this message]
2007-06-25 14:15   ` Atsushi Nemoto
2007-06-28 14:00     ` Atsushi Nemoto
2007-06-28 14:54       ` Jeff Garzik
2007-06-28 15:04         ` Atsushi Nemoto

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=20070625002822.GD5814@linux-mips.org \
    --to=ralf@linux-mips.org \
    --cc=anemo@mba.ocn.ne.jp \
    --cc=linux-mips@linux-mips.org \
    --cc=mlachwani@mvista.com \
    --cc=sshtylyov@ru.mvista.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.