netdevice: safe convert to netdev_priv() #part-1
We have some reasons to kill netdev->priv: 1. netdev->priv is equal to netdev_priv(). 2. netdev_priv() wraps the calculation of netdev->priv's offset, obviously netdev_priv() is more flexible than netdev->priv. But we cann't kill netdev->priv, because so many drivers reference to it directly. This patch is a safe convert for netdev->priv to netdev_priv(netdev). Since all of the netdev->priv is only for read. But it is too big to be sent in one mail. I split it to 4 parts and make every part smaller than 100,000 bytes, which is max size allowed by vger. Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
7a12122c7a
commit
454d7c9b14
@ -181,7 +181,7 @@ EXPORT_SYMBOL(arcnet_dump_skb);
|
||||
static void arcnet_dump_packet(struct net_device *dev, int bufnum,
|
||||
char *desc, int take_arcnet_lock)
|
||||
{
|
||||
struct arcnet_local *lp = dev->priv;
|
||||
struct arcnet_local *lp = netdev_priv(dev);
|
||||
int i, length;
|
||||
unsigned long flags = 0;
|
||||
static uint8_t buf[512];
|
||||
@ -247,7 +247,7 @@ void arcnet_unregister_proto(struct ArcProto *proto)
|
||||
*/
|
||||
static void release_arcbuf(struct net_device *dev, int bufnum)
|
||||
{
|
||||
struct arcnet_local *lp = dev->priv;
|
||||
struct arcnet_local *lp = netdev_priv(dev);
|
||||
int i;
|
||||
|
||||
lp->buf_queue[lp->first_free_buf++] = bufnum;
|
||||
@ -269,7 +269,7 @@ static void release_arcbuf(struct net_device *dev, int bufnum)
|
||||
*/
|
||||
static int get_arcbuf(struct net_device *dev)
|
||||
{
|
||||
struct arcnet_local *lp = dev->priv;
|
||||
struct arcnet_local *lp = netdev_priv(dev);
|
||||
int buf = -1, i;
|
||||
|
||||
if (!atomic_dec_and_test(&lp->buf_lock)) {
|
||||
@ -357,7 +357,7 @@ struct net_device *alloc_arcdev(char *name)
|
||||
dev = alloc_netdev(sizeof(struct arcnet_local),
|
||||
name && *name ? name : "arc%d", arcdev_setup);
|
||||
if(dev) {
|
||||
struct arcnet_local *lp = (struct arcnet_local *) dev->priv;
|
||||
struct arcnet_local *lp = netdev_priv(dev);
|
||||
spin_lock_init(&lp->lock);
|
||||
}
|
||||
|
||||
@ -374,7 +374,7 @@ struct net_device *alloc_arcdev(char *name)
|
||||
*/
|
||||
static int arcnet_open(struct net_device *dev)
|
||||
{
|
||||
struct arcnet_local *lp = dev->priv;
|
||||
struct arcnet_local *lp = netdev_priv(dev);
|
||||
int count, newmtu, error;
|
||||
|
||||
BUGMSG(D_INIT,"opened.");
|
||||
@ -474,7 +474,7 @@ static int arcnet_open(struct net_device *dev)
|
||||
/* The inverse routine to arcnet_open - shuts down the card. */
|
||||
static int arcnet_close(struct net_device *dev)
|
||||
{
|
||||
struct arcnet_local *lp = dev->priv;
|
||||
struct arcnet_local *lp = netdev_priv(dev);
|
||||
|
||||
netif_stop_queue(dev);
|
||||
|
||||
@ -556,7 +556,7 @@ static int arcnet_header(struct sk_buff *skb, struct net_device *dev,
|
||||
static int arcnet_rebuild_header(struct sk_buff *skb)
|
||||
{
|
||||
struct net_device *dev = skb->dev;
|
||||
struct arcnet_local *lp = dev->priv;
|
||||
struct arcnet_local *lp = netdev_priv(dev);
|
||||
int status = 0; /* default is failure */
|
||||
unsigned short type;
|
||||
uint8_t daddr=0;
|
||||
@ -603,7 +603,7 @@ static int arcnet_rebuild_header(struct sk_buff *skb)
|
||||
/* Called by the kernel in order to transmit a packet. */
|
||||
static int arcnet_send_packet(struct sk_buff *skb, struct net_device *dev)
|
||||
{
|
||||
struct arcnet_local *lp = dev->priv;
|
||||
struct arcnet_local *lp = netdev_priv(dev);
|
||||
struct archdr *pkt;
|
||||
struct arc_rfc1201 *soft;
|
||||
struct ArcProto *proto;
|
||||
@ -693,7 +693,7 @@ static int arcnet_send_packet(struct sk_buff *skb, struct net_device *dev)
|
||||
*/
|
||||
static int go_tx(struct net_device *dev)
|
||||
{
|
||||
struct arcnet_local *lp = dev->priv;
|
||||
struct arcnet_local *lp = netdev_priv(dev);
|
||||
|
||||
BUGMSG(D_DURING, "go_tx: status=%Xh, intmask=%Xh, next_tx=%d, cur_tx=%d\n",
|
||||
ASTATUS(), lp->intmask, lp->next_tx, lp->cur_tx);
|
||||
@ -723,7 +723,7 @@ static int go_tx(struct net_device *dev)
|
||||
static void arcnet_timeout(struct net_device *dev)
|
||||
{
|
||||
unsigned long flags;
|
||||
struct arcnet_local *lp = dev->priv;
|
||||
struct arcnet_local *lp = netdev_priv(dev);
|
||||
int status = ASTATUS();
|
||||
char *msg;
|
||||
|
||||
@ -771,8 +771,8 @@ irqreturn_t arcnet_interrupt(int irq, void *dev_id)
|
||||
BUGMSG(D_DURING, "\n");
|
||||
|
||||
BUGMSG(D_DURING, "in arcnet_interrupt\n");
|
||||
|
||||
lp = dev->priv;
|
||||
|
||||
lp = netdev_priv(dev);
|
||||
BUG_ON(!lp);
|
||||
|
||||
spin_lock(&lp->lock);
|
||||
@ -1010,7 +1010,7 @@ irqreturn_t arcnet_interrupt(int irq, void *dev_id)
|
||||
*/
|
||||
static void arcnet_rx(struct net_device *dev, int bufnum)
|
||||
{
|
||||
struct arcnet_local *lp = dev->priv;
|
||||
struct arcnet_local *lp = netdev_priv(dev);
|
||||
struct archdr pkt;
|
||||
struct arc_rfc1201 *soft;
|
||||
int length, ofs;
|
||||
@ -1074,7 +1074,7 @@ static void arcnet_rx(struct net_device *dev, int bufnum)
|
||||
*/
|
||||
static struct net_device_stats *arcnet_get_stats(struct net_device *dev)
|
||||
{
|
||||
struct arcnet_local *lp = dev->priv;
|
||||
struct arcnet_local *lp = netdev_priv(dev);
|
||||
return &lp->stats;
|
||||
}
|
||||
|
||||
@ -1091,7 +1091,7 @@ static void null_rx(struct net_device *dev, int bufnum,
|
||||
static int null_build_header(struct sk_buff *skb, struct net_device *dev,
|
||||
unsigned short type, uint8_t daddr)
|
||||
{
|
||||
struct arcnet_local *lp = dev->priv;
|
||||
struct arcnet_local *lp = netdev_priv(dev);
|
||||
|
||||
BUGMSG(D_PROTO,
|
||||
"tx: can't build header for encap %02Xh; load a protocol driver.\n",
|
||||
@ -1106,7 +1106,7 @@ static int null_build_header(struct sk_buff *skb, struct net_device *dev,
|
||||
static int null_prepare_tx(struct net_device *dev, struct archdr *pkt,
|
||||
int length, int bufnum)
|
||||
{
|
||||
struct arcnet_local *lp = dev->priv;
|
||||
struct arcnet_local *lp = netdev_priv(dev);
|
||||
struct arc_hardware newpkt;
|
||||
|
||||
BUGMSG(D_PROTO, "tx: no encap for this host; load a protocol driver.\n");
|
||||
|
Reference in New Issue
Block a user