aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorWang Chen <wangchen@cn.fujitsu.com>2008-09-04 23:28:47 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-11-10 15:10:15 -0500
commit4ceb7b6ae2cf5b6e32c403a11bb54081bf8f8b83 (patch)
treef4e7142915e2a458e010b6f8599de4e9e96d0ad1 /drivers
parentf400923735ecbb67cbe4a3606c9479f694754f51 (diff)
netdevice libertas: Fix directly reference of netdev->priv
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. OK, becasue Dave S. Miller said, "every direct netdev->priv usage is a bug", and I want to kill netdev->priv later, I decided to convert all the direct reference of netdev->priv first. Different to readonly reference of netdev->priv, in this driver, netdev->priv was changed. I use netdev->ml_priv to replace netdev->priv. Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/libertas/main.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index e9d23f68174..7a1e8b62abf 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -223,7 +223,7 @@ u8 lbs_data_rate_to_fw_index(u32 rate)
223static ssize_t lbs_anycast_get(struct device *dev, 223static ssize_t lbs_anycast_get(struct device *dev,
224 struct device_attribute *attr, char * buf) 224 struct device_attribute *attr, char * buf)
225{ 225{
226 struct lbs_private *priv = to_net_dev(dev)->priv; 226 struct lbs_private *priv = netdev_priv(to_net_dev(dev));
227 struct cmd_ds_mesh_access mesh_access; 227 struct cmd_ds_mesh_access mesh_access;
228 int ret; 228 int ret;
229 229
@@ -242,7 +242,7 @@ static ssize_t lbs_anycast_get(struct device *dev,
242static ssize_t lbs_anycast_set(struct device *dev, 242static ssize_t lbs_anycast_set(struct device *dev,
243 struct device_attribute *attr, const char * buf, size_t count) 243 struct device_attribute *attr, const char * buf, size_t count)
244{ 244{
245 struct lbs_private *priv = to_net_dev(dev)->priv; 245 struct lbs_private *priv = netdev_priv(to_net_dev(dev));
246 struct cmd_ds_mesh_access mesh_access; 246 struct cmd_ds_mesh_access mesh_access;
247 uint32_t datum; 247 uint32_t datum;
248 int ret; 248 int ret;
@@ -270,7 +270,7 @@ static void lbs_remove_mesh(struct lbs_private *priv);
270static ssize_t lbs_rtap_get(struct device *dev, 270static ssize_t lbs_rtap_get(struct device *dev,
271 struct device_attribute *attr, char * buf) 271 struct device_attribute *attr, char * buf)
272{ 272{
273 struct lbs_private *priv = to_net_dev(dev)->priv; 273 struct lbs_private *priv = netdev_priv(to_net_dev(dev));
274 return snprintf(buf, 5, "0x%X\n", priv->monitormode); 274 return snprintf(buf, 5, "0x%X\n", priv->monitormode);
275} 275}
276 276
@@ -281,7 +281,7 @@ static ssize_t lbs_rtap_set(struct device *dev,
281 struct device_attribute *attr, const char * buf, size_t count) 281 struct device_attribute *attr, const char * buf, size_t count)
282{ 282{
283 int monitor_mode; 283 int monitor_mode;
284 struct lbs_private *priv = to_net_dev(dev)->priv; 284 struct lbs_private *priv = netdev_priv(to_net_dev(dev));
285 285
286 sscanf(buf, "%x", &monitor_mode); 286 sscanf(buf, "%x", &monitor_mode);
287 if (monitor_mode) { 287 if (monitor_mode) {
@@ -332,7 +332,7 @@ static DEVICE_ATTR(lbs_rtap, 0644, lbs_rtap_get, lbs_rtap_set );
332static ssize_t lbs_mesh_get(struct device *dev, 332static ssize_t lbs_mesh_get(struct device *dev,
333 struct device_attribute *attr, char * buf) 333 struct device_attribute *attr, char * buf)
334{ 334{
335 struct lbs_private *priv = to_net_dev(dev)->priv; 335 struct lbs_private *priv = netdev_priv(to_net_dev(dev));
336 return snprintf(buf, 5, "0x%X\n", !!priv->mesh_dev); 336 return snprintf(buf, 5, "0x%X\n", !!priv->mesh_dev);
337} 337}
338 338
@@ -342,7 +342,7 @@ static ssize_t lbs_mesh_get(struct device *dev,
342static ssize_t lbs_mesh_set(struct device *dev, 342static ssize_t lbs_mesh_set(struct device *dev,
343 struct device_attribute *attr, const char * buf, size_t count) 343 struct device_attribute *attr, const char * buf, size_t count)
344{ 344{
345 struct lbs_private *priv = to_net_dev(dev)->priv; 345 struct lbs_private *priv = netdev_priv(to_net_dev(dev));
346 int enable; 346 int enable;
347 int ret, action = CMD_ACT_MESH_CONFIG_STOP; 347 int ret, action = CMD_ACT_MESH_CONFIG_STOP;
348 348
@@ -393,7 +393,7 @@ static struct attribute_group lbs_mesh_attr_group = {
393 */ 393 */
394static int lbs_dev_open(struct net_device *dev) 394static int lbs_dev_open(struct net_device *dev)
395{ 395{
396 struct lbs_private *priv = (struct lbs_private *) dev->priv ; 396 struct lbs_private *priv = netdev_priv(dev) ;
397 int ret = 0; 397 int ret = 0;
398 398
399 lbs_deb_enter(LBS_DEB_NET); 399 lbs_deb_enter(LBS_DEB_NET);
@@ -435,7 +435,7 @@ static int lbs_dev_open(struct net_device *dev)
435 */ 435 */
436static int lbs_mesh_stop(struct net_device *dev) 436static int lbs_mesh_stop(struct net_device *dev)
437{ 437{
438 struct lbs_private *priv = (struct lbs_private *) (dev->priv); 438 struct lbs_private *priv = dev->ml_priv;
439 439
440 lbs_deb_enter(LBS_DEB_MESH); 440 lbs_deb_enter(LBS_DEB_MESH);
441 spin_lock_irq(&priv->driver_lock); 441 spin_lock_irq(&priv->driver_lock);
@@ -462,7 +462,7 @@ static int lbs_mesh_stop(struct net_device *dev)
462 */ 462 */
463static int lbs_eth_stop(struct net_device *dev) 463static int lbs_eth_stop(struct net_device *dev)
464{ 464{
465 struct lbs_private *priv = (struct lbs_private *) dev->priv; 465 struct lbs_private *priv = netdev_priv(dev);
466 466
467 lbs_deb_enter(LBS_DEB_NET); 467 lbs_deb_enter(LBS_DEB_NET);
468 468
@@ -479,7 +479,7 @@ static int lbs_eth_stop(struct net_device *dev)
479 479
480static void lbs_tx_timeout(struct net_device *dev) 480static void lbs_tx_timeout(struct net_device *dev)
481{ 481{
482 struct lbs_private *priv = (struct lbs_private *) dev->priv; 482 struct lbs_private *priv = netdev_priv(dev);
483 483
484 lbs_deb_enter(LBS_DEB_TX); 484 lbs_deb_enter(LBS_DEB_TX);
485 485
@@ -531,7 +531,7 @@ EXPORT_SYMBOL_GPL(lbs_host_to_card_done);
531 */ 531 */
532static struct net_device_stats *lbs_get_stats(struct net_device *dev) 532static struct net_device_stats *lbs_get_stats(struct net_device *dev)
533{ 533{
534 struct lbs_private *priv = (struct lbs_private *) dev->priv; 534 struct lbs_private *priv = netdev_priv(dev);
535 535
536 lbs_deb_enter(LBS_DEB_NET); 536 lbs_deb_enter(LBS_DEB_NET);
537 return &priv->stats; 537 return &priv->stats;
@@ -540,7 +540,7 @@ static struct net_device_stats *lbs_get_stats(struct net_device *dev)
540static int lbs_set_mac_address(struct net_device *dev, void *addr) 540static int lbs_set_mac_address(struct net_device *dev, void *addr)
541{ 541{
542 int ret = 0; 542 int ret = 0;
543 struct lbs_private *priv = (struct lbs_private *) dev->priv; 543 struct lbs_private *priv = netdev_priv(dev);
544 struct sockaddr *phwaddr = addr; 544 struct sockaddr *phwaddr = addr;
545 struct cmd_ds_802_11_mac_address cmd; 545 struct cmd_ds_802_11_mac_address cmd;
546 546
@@ -673,7 +673,7 @@ static void lbs_set_mcast_worker(struct work_struct *work)
673 673
674static void lbs_set_multicast_list(struct net_device *dev) 674static void lbs_set_multicast_list(struct net_device *dev)
675{ 675{
676 struct lbs_private *priv = dev->priv; 676 struct lbs_private *priv = netdev_priv(dev);
677 677
678 schedule_work(&priv->mcast_work); 678 schedule_work(&priv->mcast_work);
679} 679}
@@ -689,7 +689,7 @@ static void lbs_set_multicast_list(struct net_device *dev)
689static int lbs_thread(void *data) 689static int lbs_thread(void *data)
690{ 690{
691 struct net_device *dev = data; 691 struct net_device *dev = data;
692 struct lbs_private *priv = dev->priv; 692 struct lbs_private *priv = netdev_priv(dev);
693 wait_queue_t wait; 693 wait_queue_t wait;
694 694
695 lbs_deb_enter(LBS_DEB_THREAD); 695 lbs_deb_enter(LBS_DEB_THREAD);
@@ -1124,7 +1124,7 @@ struct lbs_private *lbs_add_card(void *card, struct device *dmdev)
1124 lbs_pr_err("init ethX device failed\n"); 1124 lbs_pr_err("init ethX device failed\n");
1125 goto done; 1125 goto done;
1126 } 1126 }
1127 priv = dev->priv; 1127 priv = netdev_priv(dev);
1128 1128
1129 if (lbs_init_adapter(priv)) { 1129 if (lbs_init_adapter(priv)) {
1130 lbs_pr_err("failed to initialize adapter structure.\n"); 1130 lbs_pr_err("failed to initialize adapter structure.\n");
@@ -1377,7 +1377,7 @@ static int lbs_add_mesh(struct lbs_private *priv)
1377 ret = -ENOMEM; 1377 ret = -ENOMEM;
1378 goto done; 1378 goto done;
1379 } 1379 }
1380 mesh_dev->priv = priv; 1380 mesh_dev->ml_priv = priv;
1381 priv->mesh_dev = mesh_dev; 1381 priv->mesh_dev = mesh_dev;
1382 1382
1383 mesh_dev->open = lbs_dev_open; 1383 mesh_dev->open = lbs_dev_open;
@@ -1590,7 +1590,7 @@ static int lbs_rtap_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
1590 1590
1591static struct net_device_stats *lbs_rtap_get_stats(struct net_device *dev) 1591static struct net_device_stats *lbs_rtap_get_stats(struct net_device *dev)
1592{ 1592{
1593 struct lbs_private *priv = dev->priv; 1593 struct lbs_private *priv = dev->ml_priv;
1594 lbs_deb_enter(LBS_DEB_NET); 1594 lbs_deb_enter(LBS_DEB_NET);
1595 return &priv->stats; 1595 return &priv->stats;
1596} 1596}
@@ -1631,7 +1631,7 @@ static int lbs_add_rtap(struct lbs_private *priv)
1631 rtap_dev->stop = lbs_rtap_stop; 1631 rtap_dev->stop = lbs_rtap_stop;
1632 rtap_dev->get_stats = lbs_rtap_get_stats; 1632 rtap_dev->get_stats = lbs_rtap_get_stats;
1633 rtap_dev->hard_start_xmit = lbs_rtap_hard_start_xmit; 1633 rtap_dev->hard_start_xmit = lbs_rtap_hard_start_xmit;
1634 rtap_dev->priv = priv; 1634 rtap_dev->ml_priv = priv;
1635 SET_NETDEV_DEV(rtap_dev, priv->dev->dev.parent); 1635 SET_NETDEV_DEV(rtap_dev, priv->dev->dev.parent);
1636 1636
1637 ret = register_netdev(rtap_dev); 1637 ret = register_netdev(rtap_dev);