netdevice: safe convert to netdev_priv() #part-2
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
454d7c9b14
commit
4cf1653aa9
@@ -298,7 +298,7 @@ static int sa1100_irda_suspend(struct platform_device *pdev, pm_message_t state)
|
||||
if (!dev)
|
||||
return 0;
|
||||
|
||||
si = dev->priv;
|
||||
si = netdev_priv(dev);
|
||||
if (si->open) {
|
||||
/*
|
||||
* Stop the transmit queue
|
||||
@@ -323,7 +323,7 @@ static int sa1100_irda_resume(struct platform_device *pdev)
|
||||
if (!dev)
|
||||
return 0;
|
||||
|
||||
si = dev->priv;
|
||||
si = netdev_priv(dev);
|
||||
if (si->open) {
|
||||
/*
|
||||
* If we missed a speed change, initialise at the new speed
|
||||
@@ -359,7 +359,7 @@ static int sa1100_irda_resume(struct platform_device *pdev)
|
||||
*/
|
||||
static void sa1100_irda_hpsir_irq(struct net_device *dev)
|
||||
{
|
||||
struct sa1100_irda *si = dev->priv;
|
||||
struct sa1100_irda *si = netdev_priv(dev);
|
||||
int status;
|
||||
|
||||
status = Ser2UTSR0;
|
||||
@@ -532,7 +532,7 @@ static void sa1100_irda_fir_error(struct sa1100_irda *si, struct net_device *dev
|
||||
*/
|
||||
static void sa1100_irda_fir_irq(struct net_device *dev)
|
||||
{
|
||||
struct sa1100_irda *si = dev->priv;
|
||||
struct sa1100_irda *si = netdev_priv(dev);
|
||||
|
||||
/*
|
||||
* Stop RX DMA
|
||||
@@ -580,7 +580,7 @@ static void sa1100_irda_fir_irq(struct net_device *dev)
|
||||
static irqreturn_t sa1100_irda_irq(int irq, void *dev_id)
|
||||
{
|
||||
struct net_device *dev = dev_id;
|
||||
if (IS_FIR(((struct sa1100_irda *)dev->priv)))
|
||||
if (IS_FIR(((struct sa1100_irda *)netdev_priv(dev))))
|
||||
sa1100_irda_fir_irq(dev);
|
||||
else
|
||||
sa1100_irda_hpsir_irq(dev);
|
||||
@@ -593,7 +593,7 @@ static irqreturn_t sa1100_irda_irq(int irq, void *dev_id)
|
||||
static void sa1100_irda_txdma_irq(void *id)
|
||||
{
|
||||
struct net_device *dev = id;
|
||||
struct sa1100_irda *si = dev->priv;
|
||||
struct sa1100_irda *si = netdev_priv(dev);
|
||||
struct sk_buff *skb = si->txskb;
|
||||
|
||||
si->txskb = NULL;
|
||||
@@ -647,7 +647,7 @@ static void sa1100_irda_txdma_irq(void *id)
|
||||
|
||||
static int sa1100_irda_hard_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
{
|
||||
struct sa1100_irda *si = dev->priv;
|
||||
struct sa1100_irda *si = netdev_priv(dev);
|
||||
int speed = irda_get_next_speed(skb);
|
||||
|
||||
/*
|
||||
@@ -722,7 +722,7 @@ static int
|
||||
sa1100_irda_ioctl(struct net_device *dev, struct ifreq *ifreq, int cmd)
|
||||
{
|
||||
struct if_irda_req *rq = (struct if_irda_req *)ifreq;
|
||||
struct sa1100_irda *si = dev->priv;
|
||||
struct sa1100_irda *si = netdev_priv(dev);
|
||||
int ret = -EOPNOTSUPP;
|
||||
|
||||
switch (cmd) {
|
||||
@@ -764,13 +764,13 @@ sa1100_irda_ioctl(struct net_device *dev, struct ifreq *ifreq, int cmd)
|
||||
|
||||
static struct net_device_stats *sa1100_irda_stats(struct net_device *dev)
|
||||
{
|
||||
struct sa1100_irda *si = dev->priv;
|
||||
struct sa1100_irda *si = netdev_priv(dev);
|
||||
return &si->stats;
|
||||
}
|
||||
|
||||
static int sa1100_irda_start(struct net_device *dev)
|
||||
{
|
||||
struct sa1100_irda *si = dev->priv;
|
||||
struct sa1100_irda *si = netdev_priv(dev);
|
||||
int err;
|
||||
|
||||
si->speed = 9600;
|
||||
@@ -833,7 +833,7 @@ err_irq:
|
||||
|
||||
static int sa1100_irda_stop(struct net_device *dev)
|
||||
{
|
||||
struct sa1100_irda *si = dev->priv;
|
||||
struct sa1100_irda *si = netdev_priv(dev);
|
||||
|
||||
disable_irq(dev->irq);
|
||||
sa1100_irda_shutdown(si);
|
||||
@@ -906,7 +906,7 @@ static int sa1100_irda_probe(struct platform_device *pdev)
|
||||
if (!dev)
|
||||
goto err_mem_4;
|
||||
|
||||
si = dev->priv;
|
||||
si = netdev_priv(dev);
|
||||
si->dev = &pdev->dev;
|
||||
si->pdata = pdev->dev.platform_data;
|
||||
|
||||
@@ -985,7 +985,7 @@ static int sa1100_irda_remove(struct platform_device *pdev)
|
||||
struct net_device *dev = platform_get_drvdata(pdev);
|
||||
|
||||
if (dev) {
|
||||
struct sa1100_irda *si = dev->priv;
|
||||
struct sa1100_irda *si = netdev_priv(dev);
|
||||
unregister_netdev(dev);
|
||||
kfree(si->tx_buff.head);
|
||||
kfree(si->rx_buff.head);
|
||||
|
Reference in New Issue
Block a user