aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ray_cs.c
diff options
context:
space:
mode:
authorYoann Padioleau <padator@wanadoo.fr>2007-08-03 13:37:16 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:49:37 -0400
commit6dbc9c89fb242873bd3e83890e59da3d6e462025 (patch)
tree9e70567b27c3245b3bcd641cb63a29f8f648719a /drivers/net/wireless/ray_cs.c
parent8951554dba0c7962ae72faece66e8f5085a777d6 (diff)
[PATCH] dev->priv to netdev_priv(dev), for drivers/net/wireless
Replacing accesses to dev->priv to netdev_priv(dev). The replacment is safe when netdev_priv is used to access a private structure that is right next to the net_device structure in memory. Cf http://groups.google.com/group/comp.os.linux.development.system/browse_thread/thread/de19321bcd94dbb8/0d74a4adcd6177bd This is the case when the net_device structure was allocated with a call to alloc_netdev or one of its derivative. Signed-off-by: Yoann Padioleau <padator@wanadoo.fr> Cc: mcgrof@gmail.com Cc: linux-wireless@vger.kernel.org Cc: akpm@linux-foundation.org Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ray_cs.c')
-rw-r--r--drivers/net/wireless/ray_cs.c66
1 files changed, 33 insertions, 33 deletions
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c
index 3be624295a1f..1d9dbf830015 100644
--- a/drivers/net/wireless/ray_cs.c
+++ b/drivers/net/wireless/ray_cs.c
@@ -314,7 +314,7 @@ static int ray_probe(struct pcmcia_device *p_dev)
314 if (!dev) 314 if (!dev)
315 goto fail_alloc_dev; 315 goto fail_alloc_dev;
316 316
317 local = dev->priv; 317 local = netdev_priv(dev);
318 local->finder = p_dev; 318 local->finder = p_dev;
319 319
320 /* The io structure describes IO port mapping. None used here */ 320 /* The io structure describes IO port mapping. None used here */
@@ -388,7 +388,7 @@ static void ray_detach(struct pcmcia_device *link)
388 388
389 ray_release(link); 389 ray_release(link);
390 390
391 local = (ray_dev_t *)dev->priv; 391 local = netdev_priv(dev);
392 del_timer(&local->timer); 392 del_timer(&local->timer);
393 393
394 if (link->priv) { 394 if (link->priv) {
@@ -412,7 +412,7 @@ static int ray_config(struct pcmcia_device *link)
412 win_req_t req; 412 win_req_t req;
413 memreq_t mem; 413 memreq_t mem;
414 struct net_device *dev = (struct net_device *)link->priv; 414 struct net_device *dev = (struct net_device *)link->priv;
415 ray_dev_t *local = (ray_dev_t *)dev->priv; 415 ray_dev_t *local = netdev_priv(dev);
416 416
417 DEBUG(1, "ray_config(0x%p)\n", link); 417 DEBUG(1, "ray_config(0x%p)\n", link);
418 418
@@ -520,7 +520,7 @@ static int ray_init(struct net_device *dev)
520 int i; 520 int i;
521 UCHAR *p; 521 UCHAR *p;
522 struct ccs __iomem *pccs; 522 struct ccs __iomem *pccs;
523 ray_dev_t *local = (ray_dev_t *)dev->priv; 523 ray_dev_t *local = netdev_priv(dev);
524 struct pcmcia_device *link = local->finder; 524 struct pcmcia_device *link = local->finder;
525 DEBUG(1, "ray_init(0x%p)\n", dev); 525 DEBUG(1, "ray_init(0x%p)\n", dev);
526 if (!(pcmcia_dev_present(link))) { 526 if (!(pcmcia_dev_present(link))) {
@@ -581,7 +581,7 @@ static int ray_init(struct net_device *dev)
581static int dl_startup_params(struct net_device *dev) 581static int dl_startup_params(struct net_device *dev)
582{ 582{
583 int ccsindex; 583 int ccsindex;
584 ray_dev_t *local = (ray_dev_t *)dev->priv; 584 ray_dev_t *local = netdev_priv(dev);
585 struct ccs __iomem *pccs; 585 struct ccs __iomem *pccs;
586 struct pcmcia_device *link = local->finder; 586 struct pcmcia_device *link = local->finder;
587 587
@@ -786,7 +786,7 @@ static void join_net(u_long data)
786static void ray_release(struct pcmcia_device *link) 786static void ray_release(struct pcmcia_device *link)
787{ 787{
788 struct net_device *dev = link->priv; 788 struct net_device *dev = link->priv;
789 ray_dev_t *local = dev->priv; 789 ray_dev_t *local = netdev_priv(dev);
790 int i; 790 int i;
791 791
792 DEBUG(1, "ray_release(0x%p)\n", link); 792 DEBUG(1, "ray_release(0x%p)\n", link);
@@ -834,7 +834,7 @@ int ray_dev_init(struct net_device *dev)
834#ifdef RAY_IMMEDIATE_INIT 834#ifdef RAY_IMMEDIATE_INIT
835 int i; 835 int i;
836#endif /* RAY_IMMEDIATE_INIT */ 836#endif /* RAY_IMMEDIATE_INIT */
837 ray_dev_t *local = dev->priv; 837 ray_dev_t *local = netdev_priv(dev);
838 struct pcmcia_device *link = local->finder; 838 struct pcmcia_device *link = local->finder;
839 839
840 DEBUG(1,"ray_dev_init(dev=%p)\n",dev); 840 DEBUG(1,"ray_dev_init(dev=%p)\n",dev);
@@ -868,7 +868,7 @@ int ray_dev_init(struct net_device *dev)
868/*===========================================================================*/ 868/*===========================================================================*/
869static int ray_dev_config(struct net_device *dev, struct ifmap *map) 869static int ray_dev_config(struct net_device *dev, struct ifmap *map)
870{ 870{
871 ray_dev_t *local = dev->priv; 871 ray_dev_t *local = netdev_priv(dev);
872 struct pcmcia_device *link = local->finder; 872 struct pcmcia_device *link = local->finder;
873 /* Dummy routine to satisfy device structure */ 873 /* Dummy routine to satisfy device structure */
874 DEBUG(1,"ray_dev_config(dev=%p,ifmap=%p)\n",dev,map); 874 DEBUG(1,"ray_dev_config(dev=%p,ifmap=%p)\n",dev,map);
@@ -882,7 +882,7 @@ static int ray_dev_config(struct net_device *dev, struct ifmap *map)
882/*===========================================================================*/ 882/*===========================================================================*/
883static int ray_dev_start_xmit(struct sk_buff *skb, struct net_device *dev) 883static int ray_dev_start_xmit(struct sk_buff *skb, struct net_device *dev)
884{ 884{
885 ray_dev_t *local = dev->priv; 885 ray_dev_t *local = netdev_priv(dev);
886 struct pcmcia_device *link = local->finder; 886 struct pcmcia_device *link = local->finder;
887 short length = skb->len; 887 short length = skb->len;
888 888
@@ -925,7 +925,7 @@ static int ray_dev_start_xmit(struct sk_buff *skb, struct net_device *dev)
925static int ray_hw_xmit(unsigned char* data, int len, struct net_device* dev, 925static int ray_hw_xmit(unsigned char* data, int len, struct net_device* dev,
926 UCHAR msg_type) 926 UCHAR msg_type)
927{ 927{
928 ray_dev_t *local = (ray_dev_t *)dev->priv; 928 ray_dev_t *local = netdev_priv(dev);
929 struct ccs __iomem *pccs; 929 struct ccs __iomem *pccs;
930 int ccsindex; 930 int ccsindex;
931 int offset; 931 int offset;
@@ -1099,7 +1099,7 @@ static int ray_set_freq(struct net_device *dev,
1099 struct iw_freq *fwrq, 1099 struct iw_freq *fwrq,
1100 char *extra) 1100 char *extra)
1101{ 1101{
1102 ray_dev_t *local = (ray_dev_t *)dev->priv; 1102 ray_dev_t *local = netdev_priv(dev);
1103 int err = -EINPROGRESS; /* Call commit handler */ 1103 int err = -EINPROGRESS; /* Call commit handler */
1104 1104
1105 /* Reject if card is already initialised */ 1105 /* Reject if card is already initialised */
@@ -1124,7 +1124,7 @@ static int ray_get_freq(struct net_device *dev,
1124 struct iw_freq *fwrq, 1124 struct iw_freq *fwrq,
1125 char *extra) 1125 char *extra)
1126{ 1126{
1127 ray_dev_t *local = (ray_dev_t *)dev->priv; 1127 ray_dev_t *local = netdev_priv(dev);
1128 1128
1129 fwrq->m = local->sparm.b5.a_hop_pattern; 1129 fwrq->m = local->sparm.b5.a_hop_pattern;
1130 fwrq->e = 0; 1130 fwrq->e = 0;
@@ -1140,7 +1140,7 @@ static int ray_set_essid(struct net_device *dev,
1140 struct iw_point *dwrq, 1140 struct iw_point *dwrq,
1141 char *extra) 1141 char *extra)
1142{ 1142{
1143 ray_dev_t *local = (ray_dev_t *)dev->priv; 1143 ray_dev_t *local = netdev_priv(dev);
1144 1144
1145 /* Reject if card is already initialised */ 1145 /* Reject if card is already initialised */
1146 if(local->card_status != CARD_AWAITING_PARAM) 1146 if(local->card_status != CARD_AWAITING_PARAM)
@@ -1173,7 +1173,7 @@ static int ray_get_essid(struct net_device *dev,
1173 struct iw_point *dwrq, 1173 struct iw_point *dwrq,
1174 char *extra) 1174 char *extra)
1175{ 1175{
1176 ray_dev_t *local = (ray_dev_t *)dev->priv; 1176 ray_dev_t *local = netdev_priv(dev);
1177 1177
1178 /* Get the essid that was set */ 1178 /* Get the essid that was set */
1179 memcpy(extra, local->sparm.b5.a_current_ess_id, IW_ESSID_MAX_SIZE); 1179 memcpy(extra, local->sparm.b5.a_current_ess_id, IW_ESSID_MAX_SIZE);
@@ -1194,7 +1194,7 @@ static int ray_get_wap(struct net_device *dev,
1194 struct sockaddr *awrq, 1194 struct sockaddr *awrq,
1195 char *extra) 1195 char *extra)
1196{ 1196{
1197 ray_dev_t *local = (ray_dev_t *)dev->priv; 1197 ray_dev_t *local = netdev_priv(dev);
1198 1198
1199 memcpy(awrq->sa_data, local->bss_id, ETH_ALEN); 1199 memcpy(awrq->sa_data, local->bss_id, ETH_ALEN);
1200 awrq->sa_family = ARPHRD_ETHER; 1200 awrq->sa_family = ARPHRD_ETHER;
@@ -1211,7 +1211,7 @@ static int ray_set_rate(struct net_device *dev,
1211 struct iw_param *vwrq, 1211 struct iw_param *vwrq,
1212 char *extra) 1212 char *extra)
1213{ 1213{
1214 ray_dev_t *local = (ray_dev_t *)dev->priv; 1214 ray_dev_t *local = netdev_priv(dev);
1215 1215
1216 /* Reject if card is already initialised */ 1216 /* Reject if card is already initialised */
1217 if(local->card_status != CARD_AWAITING_PARAM) 1217 if(local->card_status != CARD_AWAITING_PARAM)
@@ -1240,7 +1240,7 @@ static int ray_get_rate(struct net_device *dev,
1240 struct iw_param *vwrq, 1240 struct iw_param *vwrq,
1241 char *extra) 1241 char *extra)
1242{ 1242{
1243 ray_dev_t *local = (ray_dev_t *)dev->priv; 1243 ray_dev_t *local = netdev_priv(dev);
1244 1244
1245 if(local->net_default_tx_rate == 3) 1245 if(local->net_default_tx_rate == 3)
1246 vwrq->value = 2000000; /* Hum... */ 1246 vwrq->value = 2000000; /* Hum... */
@@ -1260,7 +1260,7 @@ static int ray_set_rts(struct net_device *dev,
1260 struct iw_param *vwrq, 1260 struct iw_param *vwrq,
1261 char *extra) 1261 char *extra)
1262{ 1262{
1263 ray_dev_t *local = (ray_dev_t *)dev->priv; 1263 ray_dev_t *local = netdev_priv(dev);
1264 int rthr = vwrq->value; 1264 int rthr = vwrq->value;
1265 1265
1266 /* Reject if card is already initialised */ 1266 /* Reject if card is already initialised */
@@ -1290,7 +1290,7 @@ static int ray_get_rts(struct net_device *dev,
1290 struct iw_param *vwrq, 1290 struct iw_param *vwrq,
1291 char *extra) 1291 char *extra)
1292{ 1292{
1293 ray_dev_t *local = (ray_dev_t *)dev->priv; 1293 ray_dev_t *local = netdev_priv(dev);
1294 1294
1295 vwrq->value = (local->sparm.b5.a_rts_threshold[0] << 8) 1295 vwrq->value = (local->sparm.b5.a_rts_threshold[0] << 8)
1296 + local->sparm.b5.a_rts_threshold[1]; 1296 + local->sparm.b5.a_rts_threshold[1];
@@ -1309,7 +1309,7 @@ static int ray_set_frag(struct net_device *dev,
1309 struct iw_param *vwrq, 1309 struct iw_param *vwrq,
1310 char *extra) 1310 char *extra)
1311{ 1311{
1312 ray_dev_t *local = (ray_dev_t *)dev->priv; 1312 ray_dev_t *local = netdev_priv(dev);
1313 int fthr = vwrq->value; 1313 int fthr = vwrq->value;
1314 1314
1315 /* Reject if card is already initialised */ 1315 /* Reject if card is already initialised */
@@ -1338,7 +1338,7 @@ static int ray_get_frag(struct net_device *dev,
1338 struct iw_param *vwrq, 1338 struct iw_param *vwrq,
1339 char *extra) 1339 char *extra)
1340{ 1340{
1341 ray_dev_t *local = (ray_dev_t *)dev->priv; 1341 ray_dev_t *local = netdev_priv(dev);
1342 1342
1343 vwrq->value = (local->sparm.b5.a_frag_threshold[0] << 8) 1343 vwrq->value = (local->sparm.b5.a_frag_threshold[0] << 8)
1344 + local->sparm.b5.a_frag_threshold[1]; 1344 + local->sparm.b5.a_frag_threshold[1];
@@ -1357,7 +1357,7 @@ static int ray_set_mode(struct net_device *dev,
1357 __u32 *uwrq, 1357 __u32 *uwrq,
1358 char *extra) 1358 char *extra)
1359{ 1359{
1360 ray_dev_t *local = (ray_dev_t *)dev->priv; 1360 ray_dev_t *local = netdev_priv(dev);
1361 int err = -EINPROGRESS; /* Call commit handler */ 1361 int err = -EINPROGRESS; /* Call commit handler */
1362 char card_mode = 1; 1362 char card_mode = 1;
1363 1363
@@ -1389,7 +1389,7 @@ static int ray_get_mode(struct net_device *dev,
1389 __u32 *uwrq, 1389 __u32 *uwrq,
1390 char *extra) 1390 char *extra)
1391{ 1391{
1392 ray_dev_t *local = (ray_dev_t *)dev->priv; 1392 ray_dev_t *local = netdev_priv(dev);
1393 1393
1394 if(local->sparm.b5.a_network_type) 1394 if(local->sparm.b5.a_network_type)
1395 *uwrq = IW_MODE_INFRA; 1395 *uwrq = IW_MODE_INFRA;
@@ -1492,7 +1492,7 @@ static int ray_commit(struct net_device *dev,
1492 */ 1492 */
1493static iw_stats * ray_get_wireless_stats(struct net_device * dev) 1493static iw_stats * ray_get_wireless_stats(struct net_device * dev)
1494{ 1494{
1495 ray_dev_t * local = (ray_dev_t *) dev->priv; 1495 ray_dev_t * local = netdev_priv(dev);
1496 struct pcmcia_device *link = local->finder; 1496 struct pcmcia_device *link = local->finder;
1497 struct status __iomem *p = local->sram + STATUS_BASE; 1497 struct status __iomem *p = local->sram + STATUS_BASE;
1498 1498
@@ -1580,7 +1580,7 @@ static const struct iw_handler_def ray_handler_def =
1580/*===========================================================================*/ 1580/*===========================================================================*/
1581static int ray_open(struct net_device *dev) 1581static int ray_open(struct net_device *dev)
1582{ 1582{
1583 ray_dev_t *local = (ray_dev_t *)dev->priv; 1583 ray_dev_t *local = netdev_priv(dev);
1584 struct pcmcia_device *link; 1584 struct pcmcia_device *link;
1585 link = local->finder; 1585 link = local->finder;
1586 1586
@@ -1614,7 +1614,7 @@ static int ray_open(struct net_device *dev)
1614/*===========================================================================*/ 1614/*===========================================================================*/
1615static int ray_dev_close(struct net_device *dev) 1615static int ray_dev_close(struct net_device *dev)
1616{ 1616{
1617 ray_dev_t *local = (ray_dev_t *)dev->priv; 1617 ray_dev_t *local = netdev_priv(dev);
1618 struct pcmcia_device *link; 1618 struct pcmcia_device *link;
1619 link = local->finder; 1619 link = local->finder;
1620 1620
@@ -1773,7 +1773,7 @@ static int parse_addr(char *in_str, UCHAR *out)
1773/*===========================================================================*/ 1773/*===========================================================================*/
1774static struct net_device_stats *ray_get_stats(struct net_device *dev) 1774static struct net_device_stats *ray_get_stats(struct net_device *dev)
1775{ 1775{
1776 ray_dev_t *local = (ray_dev_t *)dev->priv; 1776 ray_dev_t *local = netdev_priv(dev);
1777 struct pcmcia_device *link = local->finder; 1777 struct pcmcia_device *link = local->finder;
1778 struct status __iomem *p = local->sram + STATUS_BASE; 1778 struct status __iomem *p = local->sram + STATUS_BASE;
1779 if (!(pcmcia_dev_present(link))) { 1779 if (!(pcmcia_dev_present(link))) {
@@ -1803,7 +1803,7 @@ static struct net_device_stats *ray_get_stats(struct net_device *dev)
1803/*===========================================================================*/ 1803/*===========================================================================*/
1804static void ray_update_parm(struct net_device *dev, UCHAR objid, UCHAR *value, int len) 1804static void ray_update_parm(struct net_device *dev, UCHAR objid, UCHAR *value, int len)
1805{ 1805{
1806 ray_dev_t *local = (ray_dev_t *)dev->priv; 1806 ray_dev_t *local = netdev_priv(dev);
1807 struct pcmcia_device *link = local->finder; 1807 struct pcmcia_device *link = local->finder;
1808 int ccsindex; 1808 int ccsindex;
1809 int i; 1809 int i;
@@ -1840,7 +1840,7 @@ static void ray_update_multi_list(struct net_device *dev, int all)
1840 int ccsindex; 1840 int ccsindex;
1841 struct ccs __iomem *pccs; 1841 struct ccs __iomem *pccs;
1842 int i = 0; 1842 int i = 0;
1843 ray_dev_t *local = (ray_dev_t *)dev->priv; 1843 ray_dev_t *local = netdev_priv(dev);
1844 struct pcmcia_device *link = local->finder; 1844 struct pcmcia_device *link = local->finder;
1845 void __iomem *p = local->sram + HOST_TO_ECF_BASE; 1845 void __iomem *p = local->sram + HOST_TO_ECF_BASE;
1846 1846
@@ -1884,7 +1884,7 @@ static void ray_update_multi_list(struct net_device *dev, int all)
1884/*===========================================================================*/ 1884/*===========================================================================*/
1885static void set_multicast_list(struct net_device *dev) 1885static void set_multicast_list(struct net_device *dev)
1886{ 1886{
1887 ray_dev_t *local = (ray_dev_t *)dev->priv; 1887 ray_dev_t *local = netdev_priv(dev);
1888 UCHAR promisc; 1888 UCHAR promisc;
1889 1889
1890 DEBUG(2,"ray_cs set_multicast_list(%p)\n",dev); 1890 DEBUG(2,"ray_cs set_multicast_list(%p)\n",dev);
@@ -1935,7 +1935,7 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id)
1935 1935
1936 DEBUG(4,"ray_cs: interrupt for *dev=%p\n",dev); 1936 DEBUG(4,"ray_cs: interrupt for *dev=%p\n",dev);
1937 1937
1938 local = (ray_dev_t *)dev->priv; 1938 local = netdev_priv(dev);
1939 link = (struct pcmcia_device *)local->finder; 1939 link = (struct pcmcia_device *)local->finder;
1940 if (!pcmcia_dev_present(link)) { 1940 if (!pcmcia_dev_present(link)) {
1941 DEBUG(2,"ray_cs interrupt from device not present or suspended.\n"); 1941 DEBUG(2,"ray_cs interrupt from device not present or suspended.\n");
@@ -2165,7 +2165,7 @@ static void rx_data(struct net_device *dev, struct rcs __iomem *prcs, unsigned i
2165{ 2165{
2166 struct sk_buff *skb = NULL; 2166 struct sk_buff *skb = NULL;
2167 struct rcs __iomem *prcslink = prcs; 2167 struct rcs __iomem *prcslink = prcs;
2168 ray_dev_t *local = dev->priv; 2168 ray_dev_t *local = netdev_priv(dev);
2169 UCHAR *rx_ptr; 2169 UCHAR *rx_ptr;
2170 int total_len; 2170 int total_len;
2171 int tmp; 2171 int tmp;
@@ -2618,7 +2618,7 @@ static int ray_cs_proc_read(char *buf, char **start, off_t offset, int len)
2618 dev = (struct net_device *)link->priv; 2618 dev = (struct net_device *)link->priv;
2619 if (!dev) 2619 if (!dev)
2620 return 0; 2620 return 0;
2621 local = (ray_dev_t *)dev->priv; 2621 local = netdev_priv(dev);
2622 if (!local) 2622 if (!local)
2623 return 0; 2623 return 0;
2624 2624