All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Buesch <mb@bu3sch.de>
To: michael trimarchi <trimarchi@gandalf.sssup.it>
Cc: jgarzi@pobox.com, netdev@vger.kernel.org
Subject: Re: dm9000: add set_mac_address() v2
Date: Mon, 13 Aug 2007 00:26:07 +0200	[thread overview]
Message-ID: <200708130026.07221.mb@bu3sch.de> (raw)
In-Reply-To: <20070812212009.GD27490@gandalf.sssup.it>

On Sunday 12 August 2007 23:20:09 michael trimarchi wrote:
> Implement set_mac_address() for the dm9000 driver.  This allows changing
> the mac address of the interface. Fix BigEndian problem.
>  
> Signed-off-by: Michael Trimarchi <trimarchi@gandalf.sssup.it>
> ---
> 
> --- linux-2.6.22/drivers/net/dm9000.c.orig	2007-07-09 01:32:17.000000000 +0200
> +++ linux-2.6.22/drivers/net/dm9000.c	2007-08-13 00:15:38.000000000 +0200
> @@ -161,6 +161,8 @@ static irqreturn_t dm9000_interrupt(int,
>  static int dm9000_phy_read(struct net_device *dev, int phyaddr_unsused, int reg);
>  static void dm9000_phy_write(struct net_device *dev, int phyaddr_unused, int reg,
>  			   int value);
> +static int dm9000_eth_set_mac_address(struct net_device *dev, void *p);
> +
>  static u16 read_srom_word(board_info_t *, int);
>  static void dm9000_rx(struct net_device *);
>  static void dm9000_hash_table(struct net_device *);
> @@ -546,6 +548,7 @@ dm9000_probe(struct platform_device *pde
>  	ndev->stop		 = &dm9000_stop;
>  	ndev->get_stats		 = &dm9000_get_stats;
>  	ndev->set_multicast_list = &dm9000_hash_table;
> +	ndev->set_mac_address	 = &dm9000_eth_set_mac_address;
>  #ifdef CONFIG_NET_POLL_CONTROLLER
>  	ndev->poll_controller	 = &dm9000_poll_controller;
>  #endif
> @@ -986,7 +989,6 @@ read_srom_word(board_info_t * db, int of
>  	return (ior(db, DM9000_EPDRL) + (ior(db, DM9000_EPDRH) << 8));
>  }
>  
> -#ifdef DM9000_PROGRAM_EEPROM
>  /*
>   * Write a word data to SROM
>   */
> @@ -1002,6 +1004,35 @@ write_srom_word(board_info_t * db, int o
>  }
>  
>  /*
> + * dm9000_eth_set_mac_address
> + *
> + * Change the interface's mac address.
> + *
> + */
> +static int 
> +dm9000_eth_set_mac_address(struct net_device *dev, void *p)
> +{
> +	board_info_t *db = (board_info_t *) dev->priv;
> +	struct sockaddr *addr = p;
> +	int i;
> +
> +	if (!is_valid_ether_addr(addr->sa_data))
> +		return -EADDRNOTAVAIL;
> +
> +	if (netif_running(dev))
> +		return -EBUSY;
> +
> +	memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
> +
> +	for (i = 0; i < 3; i++)
> +		write_srom_word(db, i,
> +				cpu_to_le16(((u16 *) (addr->sa_data))[i]));

Nope.

write_srom_word(db, i, le16_to_cpu(((__le16 *) (addr->sa_data))[i]));

-- 
Greetings Michael.

  reply	other threads:[~2007-08-12 22:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-12 19:27 dm9000: add set_mac_address() Michael Trimarchi
2007-08-12 21:38 ` Michael Buesch
2007-08-12 21:20   ` dm9000: add set_mac_address() v2 michael trimarchi
2007-08-12 22:26     ` Michael Buesch [this message]
2007-08-12 22:45       ` Michael Trimarchi
2007-08-12 22:58         ` Michael Buesch
2007-08-12 21:45   ` dm9000: add set_mac_address() Michael Buesch
2007-08-12 20:54     ` michael trimarchi
2007-08-12 23:08 ` Jeff Garzik
2007-08-13  7:24   ` Michael Trimarchi
2007-08-14 10:10   ` Ben Dooks

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=200708130026.07221.mb@bu3sch.de \
    --to=mb@bu3sch.de \
    --cc=jgarzi@pobox.com \
    --cc=netdev@vger.kernel.org \
    --cc=trimarchi@gandalf.sssup.it \
    /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.