* [PATCH 2/9] Use netdev_priv in YAM driver
@ 2005-01-30 21:26 Ralf Baechle DL5RB
2005-02-02 5:23 ` Jeff Garzik
0 siblings, 1 reply; 5+ messages in thread
From: Ralf Baechle DL5RB @ 2005-01-30 21:26 UTC (permalink / raw)
To: linux-hams; +Cc: Jeff Garzik
o Convert the YAM driver to use netdev_priv().
o If dev is valid there is no point in checking netdev_priv()'s return
value for being NULL.
o Fix build warning.
yam.c | 38 +++++++++++++++++++-------------------
1 files changed, 19 insertions(+), 19 deletions(-)
Index: bk-afu/drivers/net/hamradio/yam.c
===================================================================
--- bk-afu.orig/drivers/net/hamradio/yam.c
+++ bk-afu/drivers/net/hamradio/yam.c
@@ -442,7 +442,7 @@
static void yam_set_uart(struct net_device *dev)
{
- struct yam_port *yp = (struct yam_port *) dev->priv;
+ struct yam_port *yp = netdev_priv(dev);
int divisor = 115200 / yp->baudrate;
outb(0, IER(dev->base_addr));
@@ -565,7 +565,7 @@
static int yam_send_packet(struct sk_buff *skb, struct net_device *dev)
{
- struct yam_port *yp = dev->priv;
+ struct yam_port *yp = netdev_priv(dev);
skb_queue_tail(&yp->send_queue, skb);
dev->trans_start = jiffies;
@@ -592,12 +592,11 @@
static void yam_arbitrate(struct net_device *dev)
{
- struct yam_port *yp = dev->priv;
+ struct yam_port *yp = netdev_priv(dev);
- if (!yp || yp->magic != YAM_MAGIC
- || yp->tx_state != TX_OFF || skb_queue_empty(&yp->send_queue)) {
+ if (yp->magic != YAM_MAGIC || yp->tx_state != TX_OFF ||
+ skb_queue_empty(&yp->send_queue))
return;
- }
/* tx_state is TX_OFF and there is data to send */
if (yp->dupmode) {
@@ -725,7 +724,7 @@
for (i = 0; i < NR_PORTS; i++) {
dev = yam_devs[i];
- yp = dev->priv;
+ yp = netdev_priv(dev);
if (!netif_running(dev))
continue;
@@ -784,8 +783,8 @@
static int yam_seq_show(struct seq_file *seq, void *v)
{
- const struct net_device *dev = v;
- const struct yam_port *yp = dev->priv;
+ struct net_device *dev = v;
+ const struct yam_port *yp = netdev_priv(dev);
seq_printf(seq, "Device %s\n", dev->name);
seq_printf(seq, " Up %d\n", netif_running(dev));
@@ -838,10 +837,10 @@
{
struct yam_port *yp;
- if (!dev || !dev->priv)
+ if (!dev)
return NULL;
- yp = (struct yam_port *) dev->priv;
+ yp = netdev_priv(dev);
if (yp->magic != YAM_MAGIC)
return NULL;
@@ -856,14 +855,14 @@
static int yam_open(struct net_device *dev)
{
- struct yam_port *yp = (struct yam_port *) dev->priv;
+ struct yam_port *yp = netdev_priv(dev);
enum uart u;
int i;
int ret=0;
printk(KERN_INFO "Trying %s at iobase 0x%lx irq %u\n", dev->name, dev->base_addr, dev->irq);
- if (!dev || !yp || !yp->bitrate)
+ if (!dev || !yp->bitrate)
return -ENXIO;
if (!dev->base_addr || dev->base_addr > 0x1000 - YAM_EXTENT ||
dev->irq < 2 || dev->irq > 15) {
@@ -900,7 +899,7 @@
/* Reset overruns for all ports - FPGA programming makes overruns */
for (i = 0; i < NR_PORTS; i++) {
struct net_device *dev = yam_devs[i];
- struct yam_port *yp = dev->priv;
+ struct yam_port *yp = netdev_priv(dev);
inb(LSR(dev->base_addr));
yp->stats.rx_fifo_errors = 0;
}
@@ -919,10 +918,11 @@
static int yam_close(struct net_device *dev)
{
struct sk_buff *skb;
- struct yam_port *yp = (struct yam_port *) dev->priv;
+ struct yam_port *yp = netdev_priv(dev);
- if (!dev || !yp)
+ if (!dev)
return -EINVAL;
+
/*
* disable interrupts
*/
@@ -944,7 +944,7 @@
static int yam_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
{
- struct yam_port *yp = (struct yam_port *) dev->priv;
+ struct yam_port *yp = netdev_priv(dev);
struct yamdrv_ioctl_cfg yi;
struct yamdrv_ioctl_mcs *ym;
int ioctl_cmd;
@@ -952,7 +952,7 @@
if (copy_from_user(&ioctl_cmd, ifr->ifr_data, sizeof(int)))
return -EFAULT;
- if (yp == NULL || yp->magic != YAM_MAGIC)
+ if (yp->magic != YAM_MAGIC)
return -EINVAL;
if (!capable(CAP_NET_ADMIN))
@@ -1091,7 +1091,7 @@
static void yam_setup(struct net_device *dev)
{
- struct yam_port *yp = dev->priv;
+ struct yam_port *yp = netdev_priv(dev);
yp->magic = YAM_MAGIC;
yp->bitrate = DEFAULT_BITRATE;
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/9] Use netdev_priv in YAM driver
2005-01-30 21:26 [PATCH 2/9] Use netdev_priv in YAM driver Ralf Baechle DL5RB
@ 2005-02-02 5:23 ` Jeff Garzik
2005-02-05 18:58 ` Ralf Baechle DL5RB
0 siblings, 1 reply; 5+ messages in thread
From: Jeff Garzik @ 2005-02-02 5:23 UTC (permalink / raw)
To: Ralf Baechle DL5RB; +Cc: linux-hams
applied patches 2-9 to netdev-2.6 queue (thus -mm, etc.).
Not sure where patch #1 went, I don't see it (unless #1 is the reformat
patch)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/9] Use netdev_priv in YAM driver
2005-02-02 5:23 ` Jeff Garzik
@ 2005-02-05 18:58 ` Ralf Baechle DL5RB
2005-02-05 19:15 ` Jeff Garzik
0 siblings, 1 reply; 5+ messages in thread
From: Ralf Baechle DL5RB @ 2005-02-05 18:58 UTC (permalink / raw)
To: Jeff Garzik; +Cc: linux-hams
On Wed, Feb 02, 2005 at 12:23:10AM -0500, Jeff Garzik wrote:
> applied patches 2-9 to netdev-2.6 queue (thus -mm, etc.).
>
> Not sure where patch #1 went, I don't see it (unless #1 is the reformat
> patch)
#1 did touch only the encapsulation pseudo devices provided by the NETROM
and ROSE network protocols in net/netrom and net/rose so I did cc only to
netdev. Thought you'd not care. In case you do, it's attached below.
Ralf
netrom/nr_dev.c | 8 ++++----
rose/rose_dev.c | 6 +++---
2 files changed, 7 insertions(+), 7 deletions(-)
Index: bk-afu/net/netrom/nr_dev.c
===================================================================
--- bk-afu.orig/net/netrom/nr_dev.c 2005-02-04 23:40:49.102007960 +0000
+++ bk-afu/net/netrom/nr_dev.c 2005-02-04 23:40:53.618321376 +0000
@@ -46,7 +46,7 @@
int nr_rx_ip(struct sk_buff *skb, struct net_device *dev)
{
- struct net_device_stats *stats = (struct net_device_stats *)dev->priv;
+ struct net_device_stats *stats = netdev_priv(dev);
if (!netif_running(dev)) {
stats->rx_errors++;
@@ -73,7 +73,7 @@
static int nr_rebuild_header(struct sk_buff *skb)
{
struct net_device *dev = skb->dev;
- struct net_device_stats *stats = (struct net_device_stats *)dev->priv;
+ struct net_device_stats *stats = netdev_priv(dev);
struct sk_buff *skbn;
unsigned char *bp = skb->data;
int len;
@@ -186,7 +186,7 @@
static int nr_xmit(struct sk_buff *skb, struct net_device *dev)
{
- struct net_device_stats *stats = (struct net_device_stats *)dev->priv;
+ struct net_device_stats *stats = netdev_priv(dev);
dev_kfree_skb(skb);
stats->tx_errors++;
return 0;
@@ -194,7 +194,7 @@
static struct net_device_stats *nr_get_stats(struct net_device *dev)
{
- return (struct net_device_stats *)dev->priv;
+ return netdev_priv(dev);
}
void nr_setup(struct net_device *dev)
Index: bk-afu/net/rose/rose_dev.c
===================================================================
--- bk-afu.orig/net/rose/rose_dev.c 2005-02-04 23:40:49.101008112 +0000
+++ bk-afu/net/rose/rose_dev.c 2005-02-04 23:40:53.619321224 +0000
@@ -57,7 +57,7 @@
static int rose_rebuild_header(struct sk_buff *skb)
{
struct net_device *dev = skb->dev;
- struct net_device_stats *stats = (struct net_device_stats *)dev->priv;
+ struct net_device_stats *stats = netdev_priv(dev);
unsigned char *bp = (unsigned char *)skb->data;
struct sk_buff *skbn;
@@ -117,7 +117,7 @@
static int rose_xmit(struct sk_buff *skb, struct net_device *dev)
{
- struct net_device_stats *stats = (struct net_device_stats *)dev->priv;
+ struct net_device_stats *stats = netdev_priv(dev);
if (!netif_running(dev)) {
printk(KERN_ERR "ROSE: rose_xmit - called when iface is down\n");
@@ -130,7 +130,7 @@
static struct net_device_stats *rose_get_stats(struct net_device *dev)
{
- return (struct net_device_stats *)dev->priv;
+ return netdev_priv(dev);
}
void rose_setup(struct net_device *dev)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/9] Use netdev_priv in YAM driver
2005-02-05 19:15 ` Jeff Garzik
@ 2005-02-05 19:15 ` Ralf Baechle DL5RB
0 siblings, 0 replies; 5+ messages in thread
From: Ralf Baechle DL5RB @ 2005-02-05 19:15 UTC (permalink / raw)
To: Jeff Garzik; +Cc: linux-hams
On Sat, Feb 05, 2005 at 02:15:05PM -0500, Jeff Garzik wrote:
> >#1 did touch only the encapsulation pseudo devices provided by the NETROM
> >and ROSE network protocols in net/netrom and net/rose so I did cc only to
> >netdev. Thought you'd not care. In case you do, it's attached below.
>
> Nah, that's all DaveM. Thanks for letting me know.
Thought so.
Ralf
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/9] Use netdev_priv in YAM driver
2005-02-05 18:58 ` Ralf Baechle DL5RB
@ 2005-02-05 19:15 ` Jeff Garzik
2005-02-05 19:15 ` Ralf Baechle DL5RB
0 siblings, 1 reply; 5+ messages in thread
From: Jeff Garzik @ 2005-02-05 19:15 UTC (permalink / raw)
To: Ralf Baechle DL5RB; +Cc: linux-hams
Ralf Baechle DL5RB wrote:
> On Wed, Feb 02, 2005 at 12:23:10AM -0500, Jeff Garzik wrote:
>
>
>>applied patches 2-9 to netdev-2.6 queue (thus -mm, etc.).
>>
>>Not sure where patch #1 went, I don't see it (unless #1 is the reformat
>>patch)
>
>
> #1 did touch only the encapsulation pseudo devices provided by the NETROM
> and ROSE network protocols in net/netrom and net/rose so I did cc only to
> netdev. Thought you'd not care. In case you do, it's attached below.
Nah, that's all DaveM. Thanks for letting me know.
Jeff
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-02-05 19:15 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-30 21:26 [PATCH 2/9] Use netdev_priv in YAM driver Ralf Baechle DL5RB
2005-02-02 5:23 ` Jeff Garzik
2005-02-05 18:58 ` Ralf Baechle DL5RB
2005-02-05 19:15 ` Jeff Garzik
2005-02-05 19:15 ` Ralf Baechle DL5RB
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.