Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: ft1000-pcmcia: Fix compilation errors.

Following patch will fix all compilation errors. Main problems
was with pcmcia API changes. Also remove BROKEN as now driver
is properly build.

Signed-off-by: Marek Belisko <marek.belisko@open-nandra.com>
Signed-off-by: Stano Lanci <chl.pixo@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Marek Belisko and committed by
Greg Kroah-Hartman
c331e766 267024a9

+55 -247
+1 -1
drivers/staging/ft1000/Kconfig
··· 13 13 14 14 config FT1000_PCMCIA 15 15 tristate "Driver for ft1000 pcmcia device." 16 - depends on PCMCIA && BROKEN 16 + depends on PCMCIA 17 17 depends on NET 18 18 help 19 19 Say Y if you want to have support for Flarion card also called
+36 -227
drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c
··· 39 39 #include <linux/netdevice.h> 40 40 #include <linux/etherdevice.h> 41 41 42 - //#include <pcmcia/version.h> // Slavius 21.10.2009 removed from kernel 43 - #include <pcmcia/cs_types.h> 44 - #include <pcmcia/cs.h> 45 42 #include <pcmcia/cistpl.h> 46 43 #include <pcmcia/cisreg.h> 47 44 #include <pcmcia/ds.h> ··· 47 50 #include <asm/system.h> 48 51 #include <asm/byteorder.h> 49 52 #include <asm/uaccess.h> 50 - 51 - #include "ft1000_cs.h" // Slavius 21.10.2009 because CS_SUCCESS constant is missing due to removed pcmcia/version.h 52 53 53 54 /*====================================================================*/ 54 55 ··· 77 82 78 83 /*====================================================================*/ 79 84 80 - struct net_device *init_ft1000_card(int, int, unsigned char *, 81 - void *ft1000_reset, struct pcmcia_device * link, 82 - struct device *fdev); 85 + struct net_device *init_ft1000_card(struct pcmcia_device *link, 86 + void *ft1000_reset); 83 87 void stop_ft1000_card(struct net_device *); 84 88 85 89 static int ft1000_config(struct pcmcia_device *link); ··· 105 111 106 112 static void ft1000_reset(struct pcmcia_device * link) 107 113 { 108 - conf_reg_t reg; 109 - 110 - DEBUG(0, "ft1000_cs:ft1000_reset is called................\n"); 111 - 112 - /* Soft-Reset card */ 113 - reg.Action = CS_WRITE; 114 - reg.Offset = CISREG_COR; 115 - reg.Value = COR_SOFT_RESET; 116 - pcmcia_access_configuration_register(link, &reg); 117 - 118 - /* Wait until the card has acknowledged our reset */ 119 - udelay(2); 120 - 121 - /* Restore original COR configuration index */ 122 - /* Need at least 2 write to respond */ 123 - reg.Action = CS_WRITE; 124 - reg.Offset = CISREG_COR; 125 - reg.Value = COR_DEFAULT; 126 - pcmcia_access_configuration_register(link, &reg); 127 - 128 - /* Wait until the card has finished restarting */ 129 - udelay(1); 130 - 131 - reg.Action = CS_WRITE; 132 - reg.Offset = CISREG_COR; 133 - reg.Value = COR_DEFAULT; 134 - pcmcia_access_configuration_register(link, &reg); 135 - 136 - /* Wait until the card has finished restarting */ 137 - udelay(1); 138 - 139 - reg.Action = CS_WRITE; 140 - reg.Offset = CISREG_COR; 141 - reg.Value = COR_DEFAULT; 142 - pcmcia_access_configuration_register(link, &reg); 143 - 144 - /* Wait until the card has finished restarting */ 145 - udelay(1); 146 - 147 - } 148 - 149 - /*====================================================================*/ 150 - 151 - static int get_tuple_first(struct pcmcia_device *link, tuple_t * tuple, 152 - cisparse_t * parse) 153 - { 154 - int i; 155 - i = pcmcia_get_first_tuple(link, tuple); 156 - if (i != CS_SUCCESS) 157 - return i; 158 - i = pcmcia_get_tuple_data(link, tuple); 159 - if (i != CS_SUCCESS) 160 - return i; 161 - return pcmcia_parse_tuple(tuple, parse); // Slavius 21.10.2009 removed unused link parameter 162 - } 163 - 164 - static int get_tuple_next(struct pcmcia_device *link, tuple_t * tuple, 165 - cisparse_t * parse) 166 - { 167 - int i; 168 - i = pcmcia_get_next_tuple(link, tuple); 169 - if (i != CS_SUCCESS) 170 - return i; 171 - i = pcmcia_get_tuple_data(link, tuple); 172 - if (i != CS_SUCCESS) 173 - return i; 174 - return pcmcia_parse_tuple(tuple, parse); // Slavius 21.10.2009 removed unused link parameter 114 + pcmcia_reset_card(link->socket); 175 115 } 176 116 177 117 /*====================================================================== ··· 130 202 link->priv = local; 131 203 local->dev = NULL; 132 204 133 - link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; 134 - link->irq.IRQInfo1 = IRQ_LEVEL_ID; 135 - link->conf.Attributes = CONF_ENABLE_IRQ; 136 - link->conf.IntType = INT_MEMORY_AND_IO; 137 - link->irq.Handler = NULL; 205 + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; 138 206 139 207 return ft1000_config(link); 208 + 140 209 } /* ft1000_attach */ 141 210 142 211 /*====================================================================== ··· 160 235 stop_ft1000_card(dev); 161 236 } 162 237 163 - ft1000_release(link); 238 + pcmcia_disable_device(link); 164 239 165 240 /* This points to the parent local_info_t struct */ 166 241 free_netdev(dev); 167 242 168 243 } /* ft1000_detach */ 244 + 245 + /*====================================================================== 246 + 247 + Check if the io window is configured 248 + 249 + ======================================================================*/ 250 + int ft1000_confcheck(struct pcmcia_device *link, void *priv_data) 251 + { 252 + 253 + return pcmcia_request_io(link); 254 + } /* ft1000_confcheck */ 169 255 170 256 /*====================================================================== 171 257 ··· 186 250 187 251 ======================================================================*/ 188 252 189 - #define CS_CHECK(fn, ret) \ 190 - do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) 191 - 192 - #define CFG_CHECK(fn, ret) \ 193 - last_fn = (fn); if ((last_ret = (ret)) != 0) goto next_entry 194 - 195 - static int ft1000_config(struct pcmcia_device * link) 253 + static int ft1000_config(struct pcmcia_device *link) 196 254 { 197 - tuple_t tuple; 198 - cisparse_t parse; 199 - int last_fn, last_ret, i; 200 - u_char buf[64]; 201 - cistpl_lan_node_id_t *node_id; 202 - cistpl_cftable_entry_t dflt = { 0 }; 203 - cistpl_cftable_entry_t *cfg; 204 - unsigned char mac_address[6]; 255 + int ret; 205 256 206 - DEBUG(0, "ft1000_cs: ft1000_config(0x%p)\n", link); 257 + dev_dbg(&link->dev, "ft1000_cs: ft1000_config(0x%p)\n", link); 207 258 208 - /* 209 - This reads the card's CONFIG tuple to find its configuration 210 - registers. 211 - */ 212 - // tuple.DesiredTuple = CISTPL_CONFIG; 213 - // tuple.Attributes = 0; 214 - tuple.TupleData = buf; 215 - tuple.TupleDataMax = sizeof(buf); 216 - tuple.TupleOffset = 0; 217 - // CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); 218 - // CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); 219 - // CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); 220 - // link->conf.ConfigBase = parse.config.base; 221 - // link->conf.Present = parse.config.rmask[0]; 222 - 223 - /* 224 - In this loop, we scan the CIS for configuration table entries, 225 - each of which describes a valid card configuration, including 226 - voltage, IO window, memory window, and interrupt settings. 227 - 228 - We make no assumptions about the card to be configured: we use 229 - just the information available in the CIS. In an ideal world, 230 - this would work for any PCMCIA card, but it requires a complete 231 - and accurate CIS. In practice, a driver usually "knows" most of 232 - these things without consulting the CIS, and most client drivers 233 - will only use the CIS to fill in implementation-defined details. 234 - */ 235 - tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; 236 - tuple.Attributes = 0; 237 - CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); 238 - while (1) { 239 - cfg = &(parse.cftable_entry); 240 - CFG_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); 241 - CFG_CHECK(ParseTuple, 242 - pcmcia_parse_tuple(&tuple, &parse)); // Slavius 21.10.2009 removed unused link parameter 243 - 244 - if (cfg->flags & CISTPL_CFTABLE_DEFAULT) 245 - dflt = *cfg; 246 - if (cfg->index == 0) 247 - goto next_entry; 248 - link->conf.ConfigIndex = cfg->index; 249 - 250 - /* Do we need to allocate an interrupt? */ 251 - if (cfg->irq.IRQInfo1 || dflt.irq.IRQInfo1) 252 - link->conf.Attributes |= CONF_ENABLE_IRQ; 253 - 254 - /* IO window settings */ 255 - link->io.NumPorts1 = link->io.NumPorts2 = 0; 256 - if ((cfg->io.nwin > 0) || (dflt.io.nwin > 0)) { 257 - cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt.io; 258 - link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 259 - if (!(io->flags & CISTPL_IO_8BIT)) { 260 - DEBUG(0, "ft1000_cs: IO_DATA_PATH_WIDTH_16\n"); 261 - link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 262 - } 263 - if (!(io->flags & CISTPL_IO_16BIT)) { 264 - DEBUG(0, "ft1000_cs: IO_DATA_PATH_WIDTH_8\n"); 265 - link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 266 - } 267 - link->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; 268 - link->io.BasePort1 = io->win[0].base; 269 - link->io.NumPorts1 = io->win[0].len; 270 - if (io->nwin > 1) { 271 - link->io.Attributes2 = link->io.Attributes1; 272 - link->io.BasePort2 = io->win[1].base; 273 - link->io.NumPorts2 = io->win[1].len; 274 - } 275 - /* This reserves IO space but doesn't actually enable it */ 276 - pcmcia_request_io(link, &link->io); 277 - } 278 - 279 - break; 280 - 281 - next_entry: 282 - last_ret = pcmcia_get_next_tuple(link, &tuple); 259 + /* setup IO window */ 260 + ret = pcmcia_loop_config(link, ft1000_confcheck, NULL); 261 + if (ret) { 262 + printk(KERN_INFO "ft1000: Could not configure pcmcia\n"); 263 + return -ENODEV; 283 264 } 284 - if (last_ret != CS_SUCCESS) { 285 - cs_error(link, RequestIO, last_ret); 265 + 266 + /* configure device */ 267 + ret = pcmcia_enable_device(link); 268 + if (ret) { 269 + printk(KERN_INFO "ft1000: could not enable pcmcia\n"); 286 270 goto failed; 287 271 } 288 272 289 - /* 290 - Allocate an interrupt line. Note that this does not assign a 291 - handler to the interrupt, unless the 'Handler' member of the 292 - irq structure is initialized. 293 - */ 294 - CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); 295 - 296 - /* 297 - This actually configures the PCMCIA socket -- setting up 298 - the I/O windows and the interrupt mapping, and putting the 299 - card and host interface into "Memory and IO" mode. 300 - */ 301 - CS_CHECK(RequestConfiguration, 302 - pcmcia_request_configuration(link, &link->conf)); 303 - 304 - /* Get MAC address from tuples */ 305 - 306 - tuple.Attributes = tuple.TupleOffset = 0; 307 - tuple.TupleData = buf; 308 - tuple.TupleDataMax = sizeof(buf); 309 - 310 - /* Check for a LAN function extension tuple */ 311 - tuple.DesiredTuple = CISTPL_FUNCE; 312 - i = get_tuple_first(link, &tuple, &parse); 313 - while (i == CS_SUCCESS) { 314 - if (parse.funce.type == CISTPL_FUNCE_LAN_NODE_ID) 315 - break; 316 - i = get_tuple_next(link, &tuple, &parse); 273 + ((local_info_t *) link->priv)->dev = init_ft1000_card(link, 274 + &ft1000_reset); 275 + if (((local_info_t *) link->priv)->dev == NULL) { 276 + printk(KERN_INFO "ft1000: Could not register as network device\n"); 277 + goto failed; 317 278 } 318 - 319 - if (i == CS_SUCCESS) { 320 - node_id = (cistpl_lan_node_id_t *) parse.funce.data; 321 - if (node_id->nb == 6) { 322 - for (i = 0; i < 6; i++) 323 - mac_address[i] = node_id->id[i]; 324 - } 325 - } 326 - 327 - ((local_info_t *) link->priv)->dev = 328 - init_ft1000_card(link->irq.AssignedIRQ, link->io.BasePort1, 329 - &mac_address[0], ft1000_reset, link, 330 - &handle_to_dev(link)); 331 - 332 - /* 333 - At this point, the dev_node_t structure(s) need to be 334 - initialized and arranged in a linked list at link->dev. 335 - */ 336 279 337 280 /* Finally, report what we've done */ 338 281 339 282 return 0; 340 - 341 - cs_failed: 342 - cs_error(link, last_fn, last_ret); 343 283 failed: 344 284 ft1000_release(link); 345 285 return -ENODEV; ··· 241 429 no one will try to access the device or its data structures. 242 430 */ 243 431 244 - /* Unlink the device chain */ 245 - link->dev_node = NULL; 246 - 247 432 /* 248 433 In a normal driver, additional code may be needed to release 249 434 other kernel data structures associated with this device. 250 435 */ 251 - 436 + kfree((local_info_t *) link->priv); 252 437 /* Don't bother checking to see if these succeed or not */ 253 438 254 439 pcmcia_disable_device(link);
-1
drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.h
··· 1 - #define CS_SUCCESS 0x00
+1 -1
drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c
··· 310 310 return chksum; 311 311 } 312 312 313 - int card_download(struct net_device *dev, void *pFileStart, UINT FileLength) 313 + int card_download(struct net_device *dev, const u8 *pFileStart, UINT FileLength) 314 314 { 315 315 FT1000_INFO *info = (PFT1000_INFO) netdev_priv(dev); 316 316 int Status = SUCCESS;
+17 -17
drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c
··· 43 43 #include <linux/firmware.h> 44 44 #include <linux/ethtool.h> 45 45 46 + #include <pcmcia/cistpl.h> 47 + #include <pcmcia/cisreg.h> 48 + #include <pcmcia/ds.h> 49 + 46 50 #ifdef FT_DEBUG 47 51 #define DEBUG(n, args...) printk(KERN_DEBUG args); 48 52 #else ··· 57 53 #include "ft1000_dev.h" 58 54 #include "ft1000.h" 59 55 60 - int card_download(struct net_device *dev, void *pFileStart, UINT FileLength); 56 + int card_download(struct net_device *dev, const u8 *pFileStart, UINT FileLength); 61 57 62 58 void ft1000InitProc(struct net_device *dev); 63 59 void ft1000CleanupProc(struct net_device *dev); ··· 2152 2148 .get_link = ft1000_get_link 2153 2149 }; 2154 2150 2155 - struct net_device *init_ft1000_card(unsigned short irq, int port, 2156 - unsigned char *mac_addr, void *ft1000_reset, 2157 - void *link, struct device *fdev) 2151 + struct net_device *init_ft1000_card(struct pcmcia_device *link, 2152 + void *ft1000_reset) 2158 2153 { 2159 2154 FT1000_INFO *info; 2160 2155 struct net_device *dev; 2161 - int i; 2162 2156 2163 2157 static const struct net_device_ops ft1000ops = // Slavius 21.10.2009 due to kernel changes 2164 2158 { ··· 2167 2165 }; 2168 2166 2169 2167 DEBUG(1, "ft1000_hw: init_ft1000_card()\n"); 2170 - DEBUG(1, "ft1000_hw: irq = %d\n", irq); 2171 - DEBUG(1, "ft1000_hw: port = 0x%04x\n", port); 2168 + DEBUG(1, "ft1000_hw: irq = %d\n", link->irq); 2169 + DEBUG(1, "ft1000_hw: port = 0x%04x\n", link->resource[0]->start); 2172 2170 2173 2171 flarion_ft1000_cnt++; 2174 2172 ··· 2186 2184 return NULL; 2187 2185 } 2188 2186 2189 - SET_NETDEV_DEV(dev, fdev); 2187 + SET_NETDEV_DEV(dev, &link->dev); 2190 2188 info = netdev_priv(dev); 2191 2189 2192 2190 memset(info, 0, sizeof(FT1000_INFO)); ··· 2229 2227 2230 2228 DEBUG(0, "device name = %s\n", dev->name); 2231 2229 2232 - for (i = 0; i < 6; i++) { 2233 - dev->dev_addr[i] = mac_addr[i]; 2234 - DEBUG(1, "ft1000_hw: mac_addr %d = 0x%02x\n", i, mac_addr[i]); 2230 + dev->irq = link->irq; 2231 + dev->base_addr = link->resource[0]->start; 2232 + if (pcmcia_get_mac_from_cis(link, dev)) { 2233 + printk(KERN_ERR "ft1000: Could not read mac address\n"); 2234 + goto err_dev; 2235 2235 } 2236 - 2237 - netif_stop_queue(dev); 2238 - dev->irq = irq; 2239 - dev->base_addr = port; 2240 2236 2241 2237 if (request_irq(dev->irq, ft1000_interrupt, IRQF_SHARED, dev->name, dev)) { 2242 2238 printk(KERN_ERR "ft1000: Could not request_irq\n"); ··· 2254 2254 info->AsicID = ft1000_read_reg(dev, FT1000_REG_ASIC_ID); 2255 2255 if (info->AsicID == ELECTRABUZZ_ID) { 2256 2256 DEBUG(0, "ft1000_hw: ELECTRABUZZ ASIC\n"); 2257 - if (request_firmware(&fw_entry, "ft1000.img", fdev) != 0) { 2257 + if (request_firmware(&fw_entry, "ft1000.img", &link->dev) != 0) { 2258 2258 printk(KERN_INFO "ft1000: Could not open ft1000.img\n"); 2259 2259 goto err_unreg; 2260 2260 } 2261 2261 } else { 2262 2262 DEBUG(0, "ft1000_hw: MAGNEMITE ASIC\n"); 2263 - if (request_firmware(&fw_entry, "ft2000.img", fdev) != 0) { 2263 + if (request_firmware(&fw_entry, "ft2000.img", &link->dev) != 0) { 2264 2264 printk(KERN_INFO "ft1000: Could not open ft2000.img\n"); 2265 2265 goto err_unreg; 2266 2266 }