From: Daniel Ritz <daniel.ritz@gmx.ch>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: "linux-net" <linux-net@vger.kernel.org>,
"linux-kernel" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2.5 2/3] alloc_etherdev for netwave_cs.c
Date: Sat, 28 Jun 2003 01:18:39 +0200 [thread overview]
Message-ID: <200306280118.40348.daniel.ritz@gmx.ch> (raw)
erm...i didn't actually compile it...
sorry. corrected patch below.
-daniel
On Fri June 27 2003 00:45, Daniel Ritz wrote:
> cleans up netwave_cs.c to use alloc_etherdev instead of allocating the
> device out of the private data structure. compile tested only.
> against 2.5.73-bk
--- 1.18/drivers/net/wireless/netwave_cs.c Wed May 28 17:01:08 2003
+++ edited/wireless/netwave_cs.c Sat Jun 28 01:15:32 2003
@@ -321,7 +321,6 @@
typedef struct netwave_private {
dev_link_t link;
- struct net_device dev;
spinlock_t spinlock; /* Serialize access to the hardware (SMP) */
dev_node_t node;
u_char *ramBase;
@@ -449,11 +448,13 @@
netwave_flush_stale_links();
/* Initialize the dev_link_t structure */
- priv = kmalloc(sizeof(*priv), GFP_KERNEL);
- if (!priv) return NULL;
- memset(priv, 0, sizeof(*priv));
- link = &priv->link; dev = &priv->dev;
- link->priv = dev->priv = priv;
+ dev = alloc_etherdev(sizeof(netwave_private));
+ if (!dev)
+ return NULL;
+ priv = dev->priv;
+ link = &priv->link;
+ link->priv = dev;
+
init_timer(&link->release);
link->release.function = &netwave_release;
link->release.data = (u_long)link;
@@ -504,7 +505,6 @@
dev->tx_timeout = &netwave_watchdog;
dev->watchdog_timeo = TX_TIMEOUT;
- ether_setup(dev);
dev->open = &netwave_open;
dev->stop = &netwave_close;
link->irq.Instance = dev;
@@ -541,7 +541,7 @@
*/
static void netwave_detach(dev_link_t *link)
{
- netwave_private *priv = link->priv;
+ struct net_device *dev = link->priv;
dev_link_t **linkp;
DEBUG(0, "netwave_detach(0x%p)\n", link);
@@ -580,8 +580,8 @@
/* Unlink device structure, free pieces */
*linkp = link->next;
if (link->dev)
- unregister_netdev(&priv->dev);
- kfree(priv);
+ unregister_netdev(dev);
+ kfree(dev);
} /* netwave_detach */
@@ -1038,8 +1038,8 @@
static void netwave_pcmcia_config(dev_link_t *link) {
client_handle_t handle = link->handle;
- netwave_private *priv = link->priv;
- struct net_device *dev = &priv->dev;
+ struct net_device *dev = link->priv;
+ netwave_private *priv = dev->priv;
tuple_t tuple;
cisparse_t parse;
int i, j, last_ret, last_fn;
@@ -1099,7 +1099,7 @@
* Allocate a 32K memory window. Note that the dev_link_t
* structure provides space for one window handle -- if your
* device needs several windows, you'll need to keep track of
- * the handles in your private data structure, link->priv.
+ * the handles in your private data structure, dev->priv.
*/
DEBUG(1, "Setting mem speed of %d\n", mem_speed);
@@ -1161,7 +1161,8 @@
*/
static void netwave_release(u_long arg) {
dev_link_t *link = (dev_link_t *)arg;
- netwave_private *priv = link->priv;
+ struct net_device *dev = link->priv;
+ netwave_private *priv = dev->priv;
DEBUG(0, "netwave_release(0x%p)\n", link);
@@ -1206,8 +1207,7 @@
static int netwave_event(event_t event, int priority,
event_callback_args_t *args) {
dev_link_t *link = args->client_data;
- netwave_private *priv = link->priv;
- struct net_device *dev = &priv->dev;
+ struct net_device *dev = link->priv;
DEBUG(1, "netwave_event(0x%06x)\n", event);
next reply other threads:[~2003-06-27 23:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-06-27 23:18 Daniel Ritz [this message]
-- strict thread matches above, loose matches on Subject: below --
2003-06-26 22:45 [PATCH 2.5 2/3] alloc_etherdev for netwave_cs.c Daniel Ritz
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=200306280118.40348.daniel.ritz@gmx.ch \
--to=daniel.ritz@gmx.ch \
--cc=jgarzik@pobox.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-net@vger.kernel.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 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.