aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/netwave_cs.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2006-03-31 10:21:06 -0500
committerDominik Brodowski <linux@dominikbrodowski.net>2006-03-31 10:21:06 -0500
commitfba395eee7d3f342ca739c20f5b3ee635d0420a0 (patch)
tree5a73f68d3514aa795b0d8c500e4d72170651d762 /drivers/net/wireless/netwave_cs.c
parentfd238232cd0ff4840ae6946bb338502154096d88 (diff)
[PATCH] pcmcia: remove dev_link_t and client_handle_t indirection
dev_link_t * and client_handle_t both mean struct pcmcai_device * by now. Therefore, remove all such indirections. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/net/wireless/netwave_cs.c')
-rw-r--r--drivers/net/wireless/netwave_cs.c61
1 files changed, 28 insertions, 33 deletions
diff --git a/drivers/net/wireless/netwave_cs.c b/drivers/net/wireless/netwave_cs.c
index 68dfe68ffecf..2a688865f777 100644
--- a/drivers/net/wireless/netwave_cs.c
+++ b/drivers/net/wireless/netwave_cs.c
@@ -190,8 +190,8 @@ module_param(mem_speed, int, 0);
190/*====================================================================*/ 190/*====================================================================*/
191 191
192/* PCMCIA (Card Services) related functions */ 192/* PCMCIA (Card Services) related functions */
193static void netwave_release(dev_link_t *link); /* Card removal */ 193static void netwave_release(struct pcmcia_device *link); /* Card removal */
194static void netwave_pcmcia_config(dev_link_t *arg); /* Runs after card 194static void netwave_pcmcia_config(struct pcmcia_device *arg); /* Runs after card
195 insertion */ 195 insertion */
196static void netwave_detach(struct pcmcia_device *p_dev); /* Destroy instance */ 196static void netwave_detach(struct pcmcia_device *p_dev); /* Destroy instance */
197 197
@@ -221,10 +221,10 @@ static struct iw_statistics* netwave_get_wireless_stats(struct net_device *dev);
221static void set_multicast_list(struct net_device *dev); 221static void set_multicast_list(struct net_device *dev);
222 222
223/* 223/*
224 A dev_link_t structure has fields for most things that are needed 224 A struct pcmcia_device structure has fields for most things that are needed
225 to keep track of a socket, but there will usually be some device 225 to keep track of a socket, but there will usually be some device
226 specific information that also needs to be kept track of. The 226 specific information that also needs to be kept track of. The
227 'priv' pointer in a dev_link_t structure can be used to point to 227 'priv' pointer in a struct pcmcia_device structure can be used to point to
228 a device-specific private data structure, like this. 228 a device-specific private data structure, like this.
229 229
230 A driver needs to provide a dev_node_t structure for each device 230 A driver needs to provide a dev_node_t structure for each device
@@ -232,7 +232,7 @@ static void set_multicast_list(struct net_device *dev);
232 example, ethernet cards, modems). In other cases, there may be 232 example, ethernet cards, modems). In other cases, there may be
233 many actual or logical devices (SCSI adapters, memory cards with 233 many actual or logical devices (SCSI adapters, memory cards with
234 multiple partitions). The dev_node_t structures need to be kept 234 multiple partitions). The dev_node_t structures need to be kept
235 in a linked list starting at the 'dev' field of a dev_link_t 235 in a linked list starting at the 'dev' field of a struct pcmcia_device
236 structure. We allocate them in the card's private data structure, 236 structure. We allocate them in the card's private data structure,
237 because they generally can't be allocated dynamically. 237 because they generally can't be allocated dynamically.
238*/ 238*/
@@ -376,20 +376,19 @@ static struct iw_statistics *netwave_get_wireless_stats(struct net_device *dev)
376 * configure the card at this point -- we wait until we receive a 376 * configure the card at this point -- we wait until we receive a
377 * card insertion event. 377 * card insertion event.
378 */ 378 */
379static int netwave_attach(struct pcmcia_device *p_dev) 379static int netwave_attach(struct pcmcia_device *link)
380{ 380{
381 struct net_device *dev; 381 struct net_device *dev;
382 netwave_private *priv; 382 netwave_private *priv;
383 dev_link_t *link = dev_to_instance(p_dev);
384 383
385 DEBUG(0, "netwave_attach()\n"); 384 DEBUG(0, "netwave_attach()\n");
386 385
387 /* Initialize the dev_link_t structure */ 386 /* Initialize the struct pcmcia_device structure */
388 dev = alloc_etherdev(sizeof(netwave_private)); 387 dev = alloc_etherdev(sizeof(netwave_private));
389 if (!dev) 388 if (!dev)
390 return -ENOMEM; 389 return -ENOMEM;
391 priv = netdev_priv(dev); 390 priv = netdev_priv(dev);
392 priv->p_dev = p_dev; 391 priv->p_dev = link;
393 link->priv = dev; 392 link->priv = dev;
394 393
395 /* The io structure describes IO port mapping */ 394 /* The io structure describes IO port mapping */
@@ -443,9 +442,8 @@ static int netwave_attach(struct pcmcia_device *p_dev)
443 * structures are freed. Otherwise, the structures will be freed 442 * structures are freed. Otherwise, the structures will be freed
444 * when the device is released. 443 * when the device is released.
445 */ 444 */
446static void netwave_detach(struct pcmcia_device *p_dev) 445static void netwave_detach(struct pcmcia_device *link)
447{ 446{
448 dev_link_t *link = dev_to_instance(p_dev);
449 struct net_device *dev = link->priv; 447 struct net_device *dev = link->priv;
450 448
451 DEBUG(0, "netwave_detach(0x%p)\n", link); 449 DEBUG(0, "netwave_detach(0x%p)\n", link);
@@ -739,8 +737,7 @@ static const struct iw_handler_def netwave_handler_def =
739#define CS_CHECK(fn, ret) \ 737#define CS_CHECK(fn, ret) \
740do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) 738do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
741 739
742static void netwave_pcmcia_config(dev_link_t *link) { 740static void netwave_pcmcia_config(struct pcmcia_device *link) {
743 client_handle_t handle = link->handle;
744 struct net_device *dev = link->priv; 741 struct net_device *dev = link->priv;
745 netwave_private *priv = netdev_priv(dev); 742 netwave_private *priv = netdev_priv(dev);
746 tuple_t tuple; 743 tuple_t tuple;
@@ -762,9 +759,9 @@ static void netwave_pcmcia_config(dev_link_t *link) {
762 tuple.TupleDataMax = 64; 759 tuple.TupleDataMax = 64;
763 tuple.TupleOffset = 0; 760 tuple.TupleOffset = 0;
764 tuple.DesiredTuple = CISTPL_CONFIG; 761 tuple.DesiredTuple = CISTPL_CONFIG;
765 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); 762 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
766 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); 763 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
767 CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); 764 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
768 link->conf.ConfigBase = parse.config.base; 765 link->conf.ConfigBase = parse.config.base;
769 link->conf.Present = parse.config.rmask[0]; 766 link->conf.Present = parse.config.rmask[0];
770 767
@@ -778,11 +775,11 @@ static void netwave_pcmcia_config(dev_link_t *link) {
778 */ 775 */
779 for (i = j = 0x0; j < 0x400; j += 0x20) { 776 for (i = j = 0x0; j < 0x400; j += 0x20) {
780 link->io.BasePort1 = j ^ 0x300; 777 link->io.BasePort1 = j ^ 0x300;
781 i = pcmcia_request_io(link->handle, &link->io); 778 i = pcmcia_request_io(link, &link->io);
782 if (i == CS_SUCCESS) break; 779 if (i == CS_SUCCESS) break;
783 } 780 }
784 if (i != CS_SUCCESS) { 781 if (i != CS_SUCCESS) {
785 cs_error(link->handle, RequestIO, i); 782 cs_error(link, RequestIO, i);
786 goto failed; 783 goto failed;
787 } 784 }
788 785
@@ -790,16 +787,16 @@ static void netwave_pcmcia_config(dev_link_t *link) {
790 * Now allocate an interrupt line. Note that this does not 787 * Now allocate an interrupt line. Note that this does not
791 * actually assign a handler to the interrupt. 788 * actually assign a handler to the interrupt.
792 */ 789 */
793 CS_CHECK(RequestIRQ, pcmcia_request_irq(handle, &link->irq)); 790 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
794 791
795 /* 792 /*
796 * This actually configures the PCMCIA socket -- setting up 793 * This actually configures the PCMCIA socket -- setting up
797 * the I/O windows and the interrupt mapping. 794 * the I/O windows and the interrupt mapping.
798 */ 795 */
799 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(handle, &link->conf)); 796 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
800 797
801 /* 798 /*
802 * Allocate a 32K memory window. Note that the dev_link_t 799 * Allocate a 32K memory window. Note that the struct pcmcia_device
803 * structure provides space for one window handle -- if your 800 * structure provides space for one window handle -- if your
804 * device needs several windows, you'll need to keep track of 801 * device needs several windows, you'll need to keep track of
805 * the handles in your private data structure, dev->priv. 802 * the handles in your private data structure, dev->priv.
@@ -809,7 +806,7 @@ static void netwave_pcmcia_config(dev_link_t *link) {
809 req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_CM|WIN_ENABLE; 806 req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_CM|WIN_ENABLE;
810 req.Base = 0; req.Size = 0x8000; 807 req.Base = 0; req.Size = 0x8000;
811 req.AccessSpeed = mem_speed; 808 req.AccessSpeed = mem_speed;
812 CS_CHECK(RequestWindow, pcmcia_request_window(&link->handle, &req, &link->win)); 809 CS_CHECK(RequestWindow, pcmcia_request_window(&link, &req, &link->win));
813 mem.CardOffset = 0x20000; mem.Page = 0; 810 mem.CardOffset = 0x20000; mem.Page = 0;
814 CS_CHECK(MapMemPage, pcmcia_map_mem_page(link->win, &mem)); 811 CS_CHECK(MapMemPage, pcmcia_map_mem_page(link->win, &mem));
815 812
@@ -819,7 +816,7 @@ static void netwave_pcmcia_config(dev_link_t *link) {
819 816
820 dev->irq = link->irq.AssignedIRQ; 817 dev->irq = link->irq.AssignedIRQ;
821 dev->base_addr = link->io.BasePort1; 818 dev->base_addr = link->io.BasePort1;
822 SET_NETDEV_DEV(dev, &handle_to_dev(handle)); 819 SET_NETDEV_DEV(dev, &handle_to_dev(link));
823 820
824 if (register_netdev(dev) != 0) { 821 if (register_netdev(dev) != 0) {
825 printk(KERN_DEBUG "netwave_cs: register_netdev() failed\n"); 822 printk(KERN_DEBUG "netwave_cs: register_netdev() failed\n");
@@ -851,7 +848,7 @@ static void netwave_pcmcia_config(dev_link_t *link) {
851 return; 848 return;
852 849
853cs_failed: 850cs_failed:
854 cs_error(link->handle, last_fn, last_ret); 851 cs_error(link, last_fn, last_ret);
855failed: 852failed:
856 netwave_release(link); 853 netwave_release(link);
857} /* netwave_pcmcia_config */ 854} /* netwave_pcmcia_config */
@@ -863,21 +860,20 @@ failed:
863 * device, and release the PCMCIA configuration. If the device is 860 * device, and release the PCMCIA configuration. If the device is
864 * still open, this will be postponed until it is closed. 861 * still open, this will be postponed until it is closed.
865 */ 862 */
866static void netwave_release(dev_link_t *link) 863static void netwave_release(struct pcmcia_device *link)
867{ 864{
868 struct net_device *dev = link->priv; 865 struct net_device *dev = link->priv;
869 netwave_private *priv = netdev_priv(dev); 866 netwave_private *priv = netdev_priv(dev);
870 867
871 DEBUG(0, "netwave_release(0x%p)\n", link); 868 DEBUG(0, "netwave_release(0x%p)\n", link);
872 869
873 pcmcia_disable_device(link->handle); 870 pcmcia_disable_device(link);
874 if (link->win) 871 if (link->win)
875 iounmap(priv->ramBase); 872 iounmap(priv->ramBase);
876} 873}
877 874
878static int netwave_suspend(struct pcmcia_device *p_dev) 875static int netwave_suspend(struct pcmcia_device *link)
879{ 876{
880 dev_link_t *link = dev_to_instance(p_dev);
881 struct net_device *dev = link->priv; 877 struct net_device *dev = link->priv;
882 878
883 if ((link->state & DEV_CONFIG) && (link->open)) 879 if ((link->state & DEV_CONFIG) && (link->open))
@@ -886,9 +882,8 @@ static int netwave_suspend(struct pcmcia_device *p_dev)
886 return 0; 882 return 0;
887} 883}
888 884
889static int netwave_resume(struct pcmcia_device *p_dev) 885static int netwave_resume(struct pcmcia_device *link)
890{ 886{
891 dev_link_t *link = dev_to_instance(p_dev);
892 struct net_device *dev = link->priv; 887 struct net_device *dev = link->priv;
893 888
894 if ((link->state & DEV_CONFIG) && (link->open)) { 889 if ((link->state & DEV_CONFIG) && (link->open)) {
@@ -1100,7 +1095,7 @@ static irqreturn_t netwave_interrupt(int irq, void* dev_id, struct pt_regs *regs
1100 u_char __iomem *ramBase; 1095 u_char __iomem *ramBase;
1101 struct net_device *dev = (struct net_device *)dev_id; 1096 struct net_device *dev = (struct net_device *)dev_id;
1102 struct netwave_private *priv = netdev_priv(dev); 1097 struct netwave_private *priv = netdev_priv(dev);
1103 dev_link_t *link = priv->p_dev; 1098 struct pcmcia_device *link = priv->p_dev;
1104 int i; 1099 int i;
1105 1100
1106 if (!netif_device_present(dev)) 1101 if (!netif_device_present(dev))
@@ -1354,7 +1349,7 @@ static int netwave_rx(struct net_device *dev)
1354 1349
1355static int netwave_open(struct net_device *dev) { 1350static int netwave_open(struct net_device *dev) {
1356 netwave_private *priv = netdev_priv(dev); 1351 netwave_private *priv = netdev_priv(dev);
1357 dev_link_t *link = priv->p_dev; 1352 struct pcmcia_device *link = priv->p_dev;
1358 1353
1359 DEBUG(1, "netwave_open: starting.\n"); 1354 DEBUG(1, "netwave_open: starting.\n");
1360 1355
@@ -1371,7 +1366,7 @@ static int netwave_open(struct net_device *dev) {
1371 1366
1372static int netwave_close(struct net_device *dev) { 1367static int netwave_close(struct net_device *dev) {
1373 netwave_private *priv = netdev_priv(dev); 1368 netwave_private *priv = netdev_priv(dev);
1374 dev_link_t *link = priv->p_dev; 1369 struct pcmcia_device *link = priv->p_dev;
1375 1370
1376 DEBUG(1, "netwave_close: finishing.\n"); 1371 DEBUG(1, "netwave_close: finishing.\n");
1377 1372