diff options
author | Michael Buesch <mb@bu3sch.de> | 2007-11-06 10:36:41 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-11-10 04:25:12 -0500 |
commit | ce2d90591fe69ba19076c5d187dfc88ba3318623 (patch) | |
tree | a74263b9aaf392e562a4015608e01b1bc5d9eafd /drivers/net/wireless | |
parent | a2a1c3eb4029aa7f17533fe7e9a917a7b3349644 (diff) |
b43: pcmcia-host initialization bugfixes
Fix the initialization for PCMCIA devices.
Signed-off-by: Michael Buesch <mb@bu3sch.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/b43/pcmcia.c | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/drivers/net/wireless/b43/pcmcia.c b/drivers/net/wireless/b43/pcmcia.c index b242a9a90dd2..4b6648f0efcd 100644 --- a/drivers/net/wireless/b43/pcmcia.c +++ b/drivers/net/wireless/b43/pcmcia.c | |||
@@ -65,12 +65,12 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev) | |||
65 | tuple_t tuple; | 65 | tuple_t tuple; |
66 | cisparse_t parse; | 66 | cisparse_t parse; |
67 | int err = -ENOMEM; | 67 | int err = -ENOMEM; |
68 | int res; | 68 | int res = 0; |
69 | unsigned char buf[64]; | 69 | unsigned char buf[64]; |
70 | 70 | ||
71 | ssb = kzalloc(sizeof(*ssb), GFP_KERNEL); | 71 | ssb = kzalloc(sizeof(*ssb), GFP_KERNEL); |
72 | if (!ssb) | 72 | if (!ssb) |
73 | goto out; | 73 | goto out_error; |
74 | 74 | ||
75 | err = -ENODEV; | 75 | err = -ENODEV; |
76 | tuple.DesiredTuple = CISTPL_CONFIG; | 76 | tuple.DesiredTuple = CISTPL_CONFIG; |
@@ -96,10 +96,12 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev) | |||
96 | dev->io.NumPorts2 = 0; | 96 | dev->io.NumPorts2 = 0; |
97 | dev->io.Attributes2 = 0; | 97 | dev->io.Attributes2 = 0; |
98 | 98 | ||
99 | win.Attributes = WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT; | 99 | win.Attributes = WIN_ADDR_SPACE_MEM | WIN_MEMORY_TYPE_CM | |
100 | WIN_ENABLE | WIN_DATA_WIDTH_16 | | ||
101 | WIN_USE_WAIT; | ||
100 | win.Base = 0; | 102 | win.Base = 0; |
101 | win.Size = SSB_CORE_SIZE; | 103 | win.Size = SSB_CORE_SIZE; |
102 | win.AccessSpeed = 1000; | 104 | win.AccessSpeed = 250; |
103 | res = pcmcia_request_window(&dev, &win, &dev->win); | 105 | res = pcmcia_request_window(&dev, &win, &dev->win); |
104 | if (res != CS_SUCCESS) | 106 | if (res != CS_SUCCESS) |
105 | goto err_kfree_ssb; | 107 | goto err_kfree_ssb; |
@@ -108,21 +110,26 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev) | |||
108 | mem.Page = 0; | 110 | mem.Page = 0; |
109 | res = pcmcia_map_mem_page(dev->win, &mem); | 111 | res = pcmcia_map_mem_page(dev->win, &mem); |
110 | if (res != CS_SUCCESS) | 112 | if (res != CS_SUCCESS) |
111 | goto err_kfree_ssb; | 113 | goto err_disable; |
112 | 114 | ||
113 | res = pcmcia_request_configuration(dev, &dev->conf); | 115 | res = pcmcia_request_configuration(dev, &dev->conf); |
114 | if (res != CS_SUCCESS) | 116 | if (res != CS_SUCCESS) |
115 | goto err_disable; | 117 | goto err_disable; |
116 | 118 | ||
117 | err = ssb_bus_pcmciabus_register(ssb, dev, win.Base); | 119 | err = ssb_bus_pcmciabus_register(ssb, dev, win.Base); |
120 | if (err) | ||
121 | goto err_disable; | ||
118 | dev->priv = ssb; | 122 | dev->priv = ssb; |
119 | 123 | ||
120 | out: | 124 | return 0; |
121 | return err; | 125 | |
122 | err_disable: | 126 | err_disable: |
123 | pcmcia_disable_device(dev); | 127 | pcmcia_disable_device(dev); |
124 | err_kfree_ssb: | 128 | err_kfree_ssb: |
125 | kfree(ssb); | 129 | kfree(ssb); |
130 | out_error: | ||
131 | printk(KERN_ERR "b43-pcmcia: Initialization failed (%d, %d)\n", | ||
132 | res, err); | ||
126 | return err; | 133 | return err; |
127 | } | 134 | } |
128 | 135 | ||
@@ -131,22 +138,21 @@ static void __devexit b43_pcmcia_remove(struct pcmcia_device *dev) | |||
131 | struct ssb_bus *ssb = dev->priv; | 138 | struct ssb_bus *ssb = dev->priv; |
132 | 139 | ||
133 | ssb_bus_unregister(ssb); | 140 | ssb_bus_unregister(ssb); |
134 | pcmcia_release_window(dev->win); | ||
135 | pcmcia_disable_device(dev); | 141 | pcmcia_disable_device(dev); |
136 | kfree(ssb); | 142 | kfree(ssb); |
137 | dev->priv = NULL; | 143 | dev->priv = NULL; |
138 | } | 144 | } |
139 | 145 | ||
140 | static struct pcmcia_driver b43_pcmcia_driver = { | 146 | static struct pcmcia_driver b43_pcmcia_driver = { |
141 | .owner = THIS_MODULE, | 147 | .owner = THIS_MODULE, |
142 | .drv = { | 148 | .drv = { |
143 | .name = "b43-pcmcia", | 149 | .name = "b43-pcmcia", |
144 | }, | 150 | }, |
145 | .id_table = b43_pcmcia_tbl, | 151 | .id_table = b43_pcmcia_tbl, |
146 | .probe = b43_pcmcia_probe, | 152 | .probe = b43_pcmcia_probe, |
147 | .remove = b43_pcmcia_remove, | 153 | .remove = __devexit_p(b43_pcmcia_remove), |
148 | .suspend = b43_pcmcia_suspend, | 154 | .suspend = b43_pcmcia_suspend, |
149 | .resume = b43_pcmcia_resume, | 155 | .resume = b43_pcmcia_resume, |
150 | }; | 156 | }; |
151 | 157 | ||
152 | int b43_pcmcia_init(void) | 158 | int b43_pcmcia_init(void) |