static int ecard_prints(char *buffer, ecard_t *ec) { char *start = buffer; buffer += sprintf(buffer, " %d: ", ec->slot_no); if (ec->cid.id == 0) { struct in_chunk_dir incd; buffer += sprintf(buffer, "[%04X:%04X] ", ec->cid.manufacturer, ec->cid.product); if (!ec->card_desc && ec->cid.cd && ecard_readchunk(&incd, ec, 0xf5, 0)) { ec->card_desc = kmalloc(strlen(incd.d.string)+1, GFP_KERNEL); if (ec->card_desc) strcpy((char *)ec->card_desc, incd.d.string); } buffer += sprintf(buffer, "%s\n", ec->card_desc ? ec->card_desc : "*unknown*"); } else buffer += sprintf(buffer, "Simple card %d\n", ec->cid.id); return buffer - start; }
/* * Read the ethernet address string from the on board rom. * This is an ascii string!!! */ static int __devinit ether3_addr(char *addr, struct expansion_card *ec) { struct in_chunk_dir cd; char *s; if (ecard_readchunk(&cd, ec, 0xf5, 0) && (s = strchr(cd.d.string, '('))) { int i; for (i = 0; i<6; i++) { addr[i] = simple_strtoul(s + 1, &s, 0x10); if (*s != (i==5?')' : ':' )) break; } if (i == 6) return 0; } /* I wonder if we should even let the user continue in this case * - no, it would be better to disable the device */ printk(KERN_ERR "ether3: Couldn't read a valid MAC address from card.\n"); return -ENODEV; }