void cleanup_module(void) { int unit; unregister_chrdev(major,name); for (unit=0;unit<PG_UNITS;unit++) if (PG.present) pi_release(PI); }
void cleanup_module(void) { int unit; devfs_unregister_blkdev(MAJOR_NR, name); del_gendisk(&pd_gendisk); for (unit=0; unit<PD_UNITS; unit++) if (PD.present) pi_release(PI); }
static int pd_detect( void ) { int k, unit; k = 0; if (pd_drive_count == 0) { /* nothing spec'd - so autoprobe for 1 */ unit = 0; if (pi_init(PI,1,-1,-1,-1,-1,-1,pd_scratch, PI_PD,verbose,PD.name)) { if (pd_probe_drive(unit)) { PD.present = 1; k = 1; } else pi_release(PI); } } else for (unit=0;unit<PD_UNITS;unit++) if (DU[D_PRT]) if (pi_init(PI,0,DU[D_PRT],DU[D_MOD],DU[D_UNI], DU[D_PRO],DU[D_DLY],pd_scratch, PI_PD,verbose,PD.name)) { if (pd_probe_drive(unit)) { PD.present = 1; k = unit+1; } else pi_release(PI); } for (unit=0;unit<PD_UNITS;unit++) register_disk(&pd_gendisk,MKDEV(MAJOR_NR,unit<<PD_BITS), PD_PARTNS,&pd_fops, PD.present?PD.capacity:0); /* We lie about the number of drives found, as the generic partition scanner assumes that the drives are numbered sequentially from 0. This can result in some bogus error messages if non-sequential drive numbers are used. */ if (k) return k; printk("%s: no valid drive found\n",name); return 0; }
int pg_init (void) /* preliminary initialisation */ { int unit; if (disable) return -1; pg_init_units(); if (pg_detect()) return -1; if (register_chrdev(major,name,&pg_fops)) { printk("pg_init: unable to get major number %d\n", major); for (unit=0;unit<PG_UNITS;unit++) if (PG.present) pi_release(PI); return -1; } return 0; }