remove null register_disk
PATCH 1/1 remove null register_disk
In fs/partitions/check.c we read
void register_disk(struct gendisk *gdev, kdev_t dev, unsigned minors,
struct block_device_operations *ops, long size)
{
if (!gdev)
return;
grok_partitions(gdev, MINOR(dev)>>gdev->minor_shift, minors, size);
}showing that register_disk is void when its first argument is NULL. This allows one to remove some dead code.
Can be applied to 2.4. No behaviour is changed.
(I sent patch 01, adding set blocksize ioctls - hope you applied it. And patch 02, adding blkdev_get_size_in_bytes - hope you didnt, ftp.kernel.org has the right version but I mailed a version with typo. This is patch 05, independent of earlier ones, an attempt to break 1+MB of patch into meaningful small fragments that each improve something.)
Andries
linux/arch/m68k/atari/stram.c renamed from linux-2.4.6-pre3/linux/arch/m68k/atari/stram.c +0 -2
@@ -1067,8 +1067,6 @@ blksize_size[STRAM_MAJOR ] = stram_blocksizes; stram_sizes[STRAM_MINOR ] = (swap_end - swap_start)/1024 ; blk_size[STRAM_MAJOR ] = stram_sizes; -register_disk (NULL ,MKDEV (STRAM_MAJOR ,STRAM_MINOR ),1 , &stram_fops, - (swap_end-swap_start)>>9 );return (0 ); }
linux/drivers/block/floppy.c renamed from linux-2.4.6-pre3/linux/drivers/block/floppy.c +0 -9
@@ -4268,15 +4268,6 @@devfs_unregister_blkdev (MAJOR_NR ,"fd" ); } -for (drive =0 ; drive <N_DRIVE ; drive++) { -if (!(allowed_drive_mask & (1 << drive))) -continue ; -if (fdc_state[FDC (drive)].version ==FDC_NONE ) -continue ; -for (i =0 ; i<NUMBER (floppy_type); i++) -register_disk (NULL ,MKDEV (MAJOR_NR ,TOMINOR (drive)+i*4 ), -1 , &floppy_fops,0 ); - }return have_no_fdc; }
linux/drivers/block/loop.c renamed from linux-2.4.6-pre3/linux/drivers/block/loop.c +0 -2
@@ -1007,8 +1007,6 @@memset (loop_blksizes,0 , max_loop *sizeof (int )); blk_size[MAJOR_NR ] = loop_sizes; blksize_size[MAJOR_NR ] = loop_blksizes; -for (i =0 ; i < max_loop; i++) -register_disk (NULL ,MKDEV (MAJOR_NR , i),1 , &lo_fops,0 );printk (KERN_INFO "loop: loaded (max %d devices)\n" , max_loop);return 0 ;
linux/drivers/block/nbd.c renamed from linux-2.4.6-pre3/linux/drivers/block/nbd.c +0 -2
@@ -513,8 +513,6 @@ nbd_blksize_bits[i] =10 ; nbd_bytesizes[i] =0x7ffffc00 ;/* 2GB */ nbd_sizes[i] = nbd_bytesizes[i] >>BLOCK_SIZE_BITS ; -register_disk (NULL ,MKDEV (MAJOR_NR ,i),1 , &nbd_fops, - nbd_bytesizes[i]>>9 ); } devfs_handle =devfs_mk_dir (NULL ,"nbd" ,NULL ); devfs_register_series (devfs_handle, "%u", MAX_NBD,
linux/drivers/block/paride/pf.c renamed from linux-2.4.6-pre3/linux/drivers/block/paride/pf.c +0 -2
@@ -415,8 +415,6 @@for (i=0 ;i<PF_UNITS ;i++) pf_blocksizes[i] =1024 ; blksize_size[MAJOR_NR ] = pf_blocksizes; -for (i=0 ;i<PF_UNITS ;i++) -register_disk (NULL ,MKDEV (MAJOR_NR , i),1 , &pf_fops,0 );return 0 ; }
linux/drivers/block/rd.c renamed from linux-2.4.6-pre3/linux/drivers/block/rd.c +0 -3
@@ -420,9 +420,6 @@S_IFBLK |S_IRUSR |S_IWUSR , &fd_fops, NULL); -for (i =0 ; i <NUM_RAMDISKS ; i++) -register_disk (NULL ,MKDEV (MAJOR_NR ,i),1 , &fd_fops, rd_size<<1 ); -#ifdef CONFIG_BLK_DEV_INITRD /* We ought to separate initrd operations here */ register_disk (NULL ,MKDEV (MAJOR_NR ,INITRD_MINOR ),1 , &fd_fops, rd_size<<1 );
linux/drivers/cdrom/aztcd.c renamed from linux-2.4.6-pre3/linux/drivers/cdrom/aztcd.c +0 -1
@@ -1804,7 +1804,6 @@ blksize_size[MAJOR_NR ] = aztcd_blocksizes;#endif read_ahead[MAJOR_NR ] =4 ; -register_disk (NULL ,MKDEV (MAJOR_NR ,0 ),1 , &azt_fops,0 );if ((azt_port==0x1f0 )||(azt_port==0x170 ))request_region (azt_port,8 ,"aztcd" );/*IDE-interface*/
linux/drivers/cdrom/gscd.c renamed from linux-2.4.6-pre3/linux/drivers/cdrom/gscd.c +0 -1
@@ -1092,7 +1092,6 @@ gscdPresent =1 ;request_region (gscd_port,4 ,"gscd" ); -register_disk (NULL ,MKDEV (MAJOR_NR ,0 ),1 , &gscd_fops,0 );printk (KERN_INFO "GSCD: GoldStar CD-ROM Drive found.\n" );return 0 ;
linux/drivers/cdrom/optcd.c renamed from linux-2.4.6-pre3/linux/drivers/cdrom/optcd.c +0 -1
@@ -2071,7 +2071,6 @@blk_init_queue (BLK_DEFAULT_QUEUE (MAJOR_NR ),DEVICE_REQUEST ); read_ahead[MAJOR_NR ] =4 ;request_region (optcd_port,4 ,"optcd" ); -register_disk (NULL ,MKDEV (MAJOR_NR ,0 ),1 , &opt_fops,0 );printk (KERN_INFO "optcd: DOLPHIN 8000 AT CDROM at 0x%x\n" , optcd_port);return 0 ;
linux/drivers/cdrom/sjcd.c renamed from linux-2.4.6-pre3/linux/drivers/cdrom/sjcd.c +0 -1
@@ -1480,7 +1480,6 @@blk_init_queue (BLK_DEFAULT_QUEUE (MAJOR_NR ),DEVICE_REQUEST ); read_ahead[MAJOR_NR ] =4 ; -register_disk (NULL ,MKDEV (MAJOR_NR ,0 ),1 , &sjcd_fops,0 );if (check_region ( sjcd_base,4 ) ){ printk( "SJCD: Init failed, I/O port (%X) is already in use\n",
linux/drivers/cdrom/sonycd535.c renamed from linux-2.4.6-pre3/linux/drivers/cdrom/sonycd535.c +0 -1
@@ -1645,7 +1645,6 @@return -EIO ; }request_region (sony535_cd_base_io,4 ,CDU535_HANDLE ); -register_disk (NULL ,MKDEV (MAJOR_NR ,0 ),1 , &cdu_fops,0 );return 0 ; }
linux/drivers/sbus/char/jsflash.c renamed from linux-2.4.6-pre3/linux/drivers/sbus/char/jsflash.c +0 -2
@@ -672,8 +672,6 @@ jsfd_blksizes[i] =1024 ; jsfd_bytesizes[i] = jdp->dsize; jsfd_sizes[i] = jsfd_bytesizes[i] >>10 ; -register_disk (NULL ,MKDEV (JSFD_MAJOR , i),1 , &jsfd_fops, - jsfd_bytesizes[i] >>9 );set_device_ro (MKDEV (JSFD_MAJOR , i),1 ); }return 0 ;
Quoted 10 lines · On Wed, 20 Jun 2001 [email protected] wrote:
In
fs/partitions/check.cwe readvoid register_disk(struct gendisk *gdev,
kdev_tdev, unsigned minors,
structblock_device_operations*ops, long size){ if (!gdev) return; grok_partitions(gdev, MINOR(dev)>>gdev->minor_shift, minors, size); }
Quoted 3 lines
showing that
register_diskis void when its first argument is NULL. This allows one to remove some dead code.
Can be applied to 2.4. No behaviour is changed.
That's simply wrong. We will need register_disk(). Reinserting it into the right places in 2.5 is a unnecessary PITA.
Quoted 3 lines
showing that
register_diskis void when its first argument is NULL. This allows one to remove some dead code.
Can be applied to 2.4. No behaviour is changed.
Is it worth keeping these so we can build things like nice /proc files or use them later ?