static void __init DoC_Probe(unsigned long physadr) { void __iomem *docptr; struct DiskOnChip *this; struct mtd_info *mtd; int ChipID; char namebuf[15]; char *name = namebuf; char *im_funcname = NULL; char *im_modname = NULL; void (*initroutine)(struct mtd_info *) = NULL; docptr = ioremap(physadr, DOC_IOREMAP_LEN); if (!docptr) return; if ((ChipID = doccheck(docptr, physadr))) { if (ChipID == DOC_ChipID_Doc2kTSOP) { /* Remove this at your own peril. The hardware driver works but nothing prevents you from erasing bad blocks */ printk(KERN_NOTICE "Refusing to drive DiskOnChip 2000 TSOP until Bad Block Table is correctly supported by INFTL\n"); iounmap(docptr); return; } docfound = 1; mtd = kmalloc(sizeof(struct DiskOnChip) + sizeof(struct mtd_info), GFP_KERNEL); if (!mtd) { printk(KERN_WARNING "Cannot allocate memory for data structures. Dropping.\n"); iounmap(docptr); return; } this = (struct DiskOnChip *)(&mtd[1]); memset((char *)mtd,0, sizeof(struct mtd_info)); memset((char *)this, 0, sizeof(struct DiskOnChip)); mtd->priv = this; this->virtadr = docptr; this->physadr = physadr; this->ChipID = ChipID; sprintf(namebuf, "with ChipID %2.2X", ChipID); switch(ChipID) { case DOC_ChipID_Doc2kTSOP: name="2000 TSOP"; im_funcname = "DoC2k_init"; im_modname = "doc2000"; break; case DOC_ChipID_Doc2k: name="2000"; im_funcname = "DoC2k_init"; im_modname = "doc2000"; break; case DOC_ChipID_DocMil: name="Millennium"; #ifdef DOC_SINGLE_DRIVER im_funcname = "DoC2k_init"; im_modname = "doc2000"; #else im_funcname = "DoCMil_init"; im_modname = "doc2001"; #endif /* DOC_SINGLE_DRIVER */ break; case DOC_ChipID_DocMilPlus16: case DOC_ChipID_DocMilPlus32: name="MillenniumPlus"; im_funcname = "DoCMilPlus_init"; im_modname = "doc2001plus"; break; } if (im_funcname) initroutine = inter_module_get_request(im_funcname, im_modname); if (initroutine) { (*initroutine)(mtd); inter_module_put(im_funcname); return; } printk(KERN_NOTICE "Cannot find driver for DiskOnChip %s at 0x%lX\n", name, physadr); kfree(mtd); } iounmap(docptr); }
static void __init DoC_Probe(unsigned long physadr) { unsigned long docptr; struct DiskOnChip *this; struct mtd_info *mtd; int ChipID; char namebuf[15]; char *name = namebuf; char *im_funcname = NULL; char *im_modname = NULL; void (*initroutine)(struct mtd_info *) = NULL; docptr = (unsigned long)ioremap(physadr, DOC_IOREMAP_LEN); if (!docptr) return; if ((ChipID = doccheck(docptr, physadr))) { docfound = 1; mtd = kmalloc(sizeof(struct DiskOnChip) + sizeof(struct mtd_info), GFP_KERNEL); if (!mtd) { printk(KERN_WARNING "Cannot allocate memory for data structures. Dropping.\n"); iounmap((void *)docptr); return; } this = (struct DiskOnChip *)(&mtd[1]); memset((char *)mtd,0, sizeof(struct mtd_info)); memset((char *)this, 0, sizeof(struct DiskOnChip)); mtd->priv = this; this->virtadr = docptr; this->physadr = physadr; this->ChipID = ChipID; sprintf(namebuf, "with ChipID %2.2X", ChipID); switch(ChipID) { case DOC_ChipID_Doc2k: name="2000"; im_funcname = "DoC2k_init"; im_modname = "doc2000"; break; case DOC_ChipID_DocMil: name="Millennium"; #ifdef DOC_SINGLE_DRIVER im_funcname = "DoC2k_init"; im_modname = "doc2000"; #else im_funcname = "DoCMil_init"; im_modname = "doc2001"; #endif /* DOC_SINGLE_DRIVER */ break; case DOC_ChipID_DocMilPlus16: case DOC_ChipID_DocMilPlus32: name="MillenniumPlus"; im_funcname = "DoCMilPlus_init"; im_modname = "doc2001plus"; break; } if (im_funcname) initroutine = inter_module_get_request(im_funcname, im_modname); if (initroutine) { (*initroutine)(mtd); inter_module_put(im_funcname); return; } printk(KERN_NOTICE "Cannot find driver for DiskOnChip %s at 0x%lX\n", name, physadr); } iounmap((void *)docptr); }