From: Hans Grobler (gszcu@kerailya.tunkki.fi)
Date: Wed Dec 13 2000 - 08:44:37 EET
bpqether.c-2.4.0-test12-patch-v1:
- fixed comment to match current version number (or should the
version simply be removed?)
- banner: made driver signon ejectable const string
- bpq_packet_type,bpq_dev_notifier: converted to labeled initializers
and set the packet type here instead of in bpq_init_driver
- bpq_devices: no explicit initialization as per linux2.4
- bpq_get_ether_dev,bpq_get_ax25_dev,dev_is_ethdev: converted inline
format to non header version
- bpq_ioctl: converted userspace access routines as per linux2.4
- bpq_init_driver,bpq_cleanup_driver: removed extra whitespace in proc
calls
diff -u3Nr -X dontdiff linux-2.4.0-test12.orig/drivers/net/hamradio/bpqether.c linux-2.4.0-test12/drivers/net/hamradio/bpqether.c
--- linux-2.4.0-test12.orig/drivers/net/hamradio/bpqether.c Thu Oct 12 23:05:34 2000
+++ linux-2.4.0-test12/drivers/net/hamradio/bpqether.c Tue Dec 12 22:04:57 2000
@@ -1,5 +1,5 @@
/*
- * G8BPQ compatible "AX.25 via ethernet" driver release 003
+ * G8BPQ compatible "AX.25 via ethernet" driver release 004
*
* This code REQUIRES 2.0.0 or higher/ NET3.029
*
@@ -65,6 +65,7 @@
#include <net/ax25.h>
#include <linux/inet.h>
#include <linux/netdevice.h>
+#include <linux/if_ether.h>
#include <linux/if_arp.h>
#include <linux/skbuff.h>
#include <net/sock.h>
@@ -86,6 +87,8 @@
#include <linux/bpqether.h>
+static const char banner[] __initdata = KERN_INFO "AX.25: bpqether driver version 004\n";
+
static unsigned char ax25_bcast[AX25_ADDR_LEN] =
{'Q' << 1, 'S' << 1, 'T' << 1, ' ' << 1, ' ' << 1, ' ' << 1, '0' << 1};
static unsigned char ax25_defaddr[AX25_ADDR_LEN] =
@@ -100,16 +103,12 @@
static char *bpq_print_ethaddr(unsigned char *);
static struct packet_type bpq_packet_type = {
- 0, /* ntohs(ETH_P_BPQ),*/
- 0, /* copy */
- bpq_rcv,
- NULL,
- NULL,
+ type: __constant_htons(ETH_P_BPQ),
+ func: bpq_rcv,
};
static struct notifier_block bpq_dev_notifier = {
- bpq_device_event,
- 0
+ notifier_call: bpq_device_event,
};
@@ -123,7 +122,7 @@
struct net_device_stats stats; /* some statistics */
char dest_addr[6]; /* ether destination address */
char acpt_addr[6]; /* accept ether frames from this address only */
-} *bpq_devices = NULL;
+} *bpq_devices;
/* ------------------------------------------------------------------------ */
@@ -132,7 +131,7 @@
/*
* Get the ethernet device for a BPQ device
*/
-static __inline__ struct net_device *bpq_get_ether_dev(struct net_device *dev)
+static inline struct net_device *bpq_get_ether_dev(struct net_device *dev)
{
struct bpqdev *bpq;
@@ -144,7 +143,7 @@
/*
* Get the BPQ device for the ethernet device
*/
-static __inline__ struct net_device *bpq_get_ax25_dev(struct net_device *dev)
+static inline struct net_device *bpq_get_ax25_dev(struct net_device *dev)
{
struct bpqdev *bpq;
@@ -155,7 +154,7 @@
return NULL;
}
-static __inline__ int dev_is_ethdev(struct net_device *dev)
+static inline int dev_is_ethdev(struct net_device *dev)
{
return (
dev->type == ARPHRD_ETHER
@@ -374,9 +373,8 @@
switch (cmd) {
case SIOCSBPQETHOPT:
- if ((err = verify_area(VERIFY_WRITE, ifr->ifr_data, sizeof(struct bpq_req))) != 0)
- return err;
- copy_from_user(&req, ifr->ifr_data, sizeof(struct bpq_req));
+ if (copy_from_user(&req, ifr->ifr_data, sizeof(struct bpq_req)))
+ return -EFAULT;
switch (req.cmd) {
case SIOCGBPQETHPARAM:
case SIOCSBPQETHPARAM:
@@ -387,10 +385,10 @@
break;
case SIOCSBPQETHADDR:
- if ((err = verify_area(VERIFY_READ, ethaddr, sizeof(struct bpq_ethaddr))) != 0)
- return err;
- copy_from_user(bpq->dest_addr, ethaddr->destination, ETH_ALEN);
- copy_from_user(bpq->acpt_addr, ethaddr->accept, ETH_ALEN);
+ if (copy_from_user(bpq->dest_addr, ethaddr->destination, ETH_ALEN))
+ return -EFAULT;
+ if (copy_from_user(bpq->acpt_addr, ethaddr->accept, ETH_ALEN))
+ return -EFAULT;
break;
default:
@@ -617,14 +615,13 @@
{
struct net_device *dev;
- bpq_packet_type.type = htons(ETH_P_BPQ);
dev_add_pack(&bpq_packet_type);
register_netdevice_notifier(&bpq_dev_notifier);
- printk(KERN_INFO "AX.25: bpqether driver version 0.01\n");
+ printk(banner);
- proc_net_create ("bpqether", 0, bpq_get_info);
+ proc_net_create("bpqether", 0, bpq_get_info);
read_lock_bh(&dev_base_lock);
for (dev = dev_base; dev != NULL; dev = dev->next) {
@@ -646,7 +643,7 @@
unregister_netdevice_notifier(&bpq_dev_notifier);
- proc_net_remove ("bpqether");
+ proc_net_remove("bpqether");
for (bpq = bpq_devices; bpq != NULL; bpq = bpq->next)
unregister_netdev(&bpq->axdev);
-
To unsubscribe from this list: send the line "unsubscribe linux-hams" in
the body of a message to jtnlvl@bwnet.com.br
This archive was generated by hypermail 2b30 : Wed Dec 13 2000 - 09:16:35 EET