From 4e8e3c86d5b1c13f86f5c39c8401cf990fcf6194 Mon Sep 17 00:00:00 2001 From: Grazvydas Ignotas Date: Tue, 27 Jan 2009 15:08:28 +0200 Subject: [PATCH] Replace net_device.priv with netdev_priv() This allows driver to compile for 2.6.29 kernel. --- sta_dk_4_0_4_32/pform/linux/src/esta_drv.c | 10 +++++----- sta_dk_4_0_4_32/pform/linux/src/ioctl_list.c | 19 ++++++++++--------- sta_dk_4_0_4_32/pform/linux/src/osapi.c | 2 +- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/sta_dk_4_0_4_32/pform/linux/src/esta_drv.c b/sta_dk_4_0_4_32/pform/linux/src/esta_drv.c index 8358ebb..50250e6 100644 --- a/sta_dk_4_0_4_32/pform/linux/src/esta_drv.c +++ b/sta_dk_4_0_4_32/pform/linux/src/esta_drv.c @@ -492,7 +492,7 @@ static int tiwlan_calibration_write_proc(struct file *file, const char *buffer, static int tiwlan_drv_net_open(struct net_device * dev) { - tiwlan_net_dev_t *drv = (tiwlan_net_dev_t *)dev->priv; + tiwlan_net_dev_t *drv = *(tiwlan_net_dev_t **)netdev_priv(dev) ti_nodprintf(TIWLAN_LOG_INFO, "tiwlan_drv_net_open()\n"); @@ -586,7 +586,7 @@ static void tiwlan_xmit_handler( struct work_struct *work ) */ static int tiwlan_drv_net_xmit(struct sk_buff *skb, struct net_device *dev) { - tiwlan_net_dev_t *drv = (tiwlan_net_dev_t *)dev->priv; + tiwlan_net_dev_t *drv = *(tiwlan_net_dev_t **)netdev_priv(dev); int status; mem_MSDU_T *pMsdu; UINT32 packetHeaderLength; @@ -735,7 +735,7 @@ static int tiwlan_drv_net_xmit(struct sk_buff *skb, struct net_device *dev) struct net_device_stats * tiwlan_drv_net_get_stats(struct net_device * dev) { - tiwlan_net_dev_t *drv = (tiwlan_net_dev_t *)dev->priv; + tiwlan_net_dev_t *drv = *(tiwlan_net_dev_t **)netdev_priv(dev); ti_dprintf(TIWLAN_LOG_OTHER, "tiwlan_drv_net_get_stats()\n"); return &drv->stats; @@ -747,14 +747,14 @@ static int setup_netif(tiwlan_net_dev_t *drv) struct net_device *dev; int res; - dev = alloc_etherdev(0); + dev = alloc_etherdev(sizeof(tiwlan_net_dev_t *)); if (dev == NULL) { ti_dprintf(TIWLAN_LOG_ERROR, "alloc_etherdev() failed\n"); return -ENOMEM; } ether_setup(dev); - dev->priv = drv; + *(tiwlan_net_dev_t **)netdev_priv(dev) = drv; drv->netdev = dev; strcpy(dev->name, TIWLAN_DRV_IF_NAME); netif_carrier_off(dev); diff --git a/sta_dk_4_0_4_32/pform/linux/src/ioctl_list.c b/sta_dk_4_0_4_32/pform/linux/src/ioctl_list.c index 5c3fa32..2df6cf0 100644 --- a/sta_dk_4_0_4_32/pform/linux/src/ioctl_list.c +++ b/sta_dk_4_0_4_32/pform/linux/src/ioctl_list.c @@ -100,9 +100,9 @@ int ti1610_ioctl_priv_proc_tl(tiwlan_req_t *req_data) switch( req->cmd ) { case TIWLN_DRIVER_STATUS_SET: if(*data) - res = tiwlan_start_drv( (tiwlan_net_dev_t *)dev->priv ); + res = tiwlan_start_drv( *(tiwlan_net_dev_t **)netdev_priv(dev) ); else - res = tiwlan_stop_drv( (tiwlan_net_dev_t *)dev->priv ); + res = tiwlan_stop_drv( *(tiwlan_net_dev_t **)netdev_priv(dev) ); if( res == OK ) drv_started = !drv_started; @@ -138,6 +138,7 @@ int ti1610_ioctl_priv_proc_tl(tiwlan_req_t *req_data) int ti1610_do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { + tiwlan_net_dev_t *net_dev = *(tiwlan_net_dev_t **)netdev_priv(dev); tiioctl_req_t *req = (tiioctl_req_t *) &rq->ifr_ifru; char *extra, *kbuf = NULL; int res, aval_data_size = ((char *) req + sizeof(*req)) - (char *)&req->user_data_pointer; /* = ~4 bytes */ @@ -149,7 +150,7 @@ int ti1610_do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) req->user_data_pointer, req->length, aval_data_size ); /* driver is already initialized */ - if ((req->cmd == TIWLN_SET_INIT_INFO) && (((tiwlan_net_dev_t *)dev->priv)->adapter.CoreHalCtx)) + if ((req->cmd == TIWLN_SET_INIT_INFO) && net_dev->adapter.CoreHalCtx) { return 0; } @@ -188,13 +189,13 @@ int ti1610_do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) init_info?init_info->eeprom_image_length:0, init_info?init_info->init_file_length:0, init_info?init_info->firmware_image_length:0 ); - res = tiwlan_init_drv((tiwlan_net_dev_t *)dev->priv, init_info); + res = tiwlan_init_drv(net_dev, init_info); } #ifdef DRIVER_PROFILING else if (req->cmd == TIWLAN_PROFILING_REPORT) { - res = tiwlan_profile_report((tiwlan_net_dev_t *)dev->priv); + res = tiwlan_profile_report(net_dev); } else if (req->cmd == TIWLAN_PROFILING_CPU_ESTIMATOR_CMD) { /* get the command cpu estimator command parameter */ @@ -207,16 +208,16 @@ int ti1610_do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) switch (command_type) { case TIWLAN_PROFILING_CPU_ESTIMATOR_CMD_START: - res = tiwlan_profile_cpu_usage_estimator_start((tiwlan_net_dev_t *)dev->priv, + res = tiwlan_profile_cpu_usage_estimator_start(net_dev, /* the data in this case is the estimator resolution in milliseconds */ command_data * 1000); break; case TIWLAN_PROFILING_CPU_ESTIMATOR_CMD_STOP: - res = tiwlan_profile_cpu_usage_estimator_stop((tiwlan_net_dev_t *)dev->priv); + res = tiwlan_profile_cpu_usage_estimator_stop(net_dev); break; case TIWLAN_PROFILING_CPU_ESTIMATOR_CMD_RESET: - res =tiwlan_profile_cpu_usage_estimator_reset((tiwlan_net_dev_t *)dev->priv); + res =tiwlan_profile_cpu_usage_estimator_reset(net_dev); break; default: res = 0; @@ -228,7 +229,7 @@ int ti1610_do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) else { - res = tiwlan_send_wait_reply((tiwlan_net_dev_t *)dev->priv, ti1610_ioctl_priv_proc_tl, + res = tiwlan_send_wait_reply(net_dev, ti1610_ioctl_priv_proc_tl, (unsigned long)req, (unsigned long)extra, 0, 0); } diff --git a/sta_dk_4_0_4_32/pform/linux/src/osapi.c b/sta_dk_4_0_4_32/pform/linux/src/osapi.c index 86d3d2c..a5a798c 100644 --- a/sta_dk_4_0_4_32/pform/linux/src/osapi.c +++ b/sta_dk_4_0_4_32/pform/linux/src/osapi.c @@ -1326,7 +1326,7 @@ os_sendPacket( ) { struct net_device *dev = (struct net_device *)OsContext; - tiwlan_net_dev_t *drv = (tiwlan_net_dev_t *)dev->priv; + tiwlan_net_dev_t *drv = *(tiwlan_net_dev_t **)netdev_priv(dev); INT32 status; mem_MSDU_T* pMsdu; -- 2.39.5