@@ -342,8 +342,8 @@ static void cdrom_sysctl_register(void);
342342
343343static LIST_HEAD (cdrom_list );
344344
345- static int cdrom_dummy_generic_packet (struct cdrom_device_info * cdi ,
346- struct packet_command * cgc )
345+ int cdrom_dummy_generic_packet (struct cdrom_device_info * cdi ,
346+ struct packet_command * cgc )
347347{
348348 if (cgc -> sense ) {
349349 cgc -> sense -> sense_key = 0x05 ;
@@ -354,6 +354,7 @@ static int cdrom_dummy_generic_packet(struct cdrom_device_info *cdi,
354354 cgc -> stat = - EIO ;
355355 return - EIO ;
356356}
357+ EXPORT_SYMBOL (cdrom_dummy_generic_packet );
357358
358359static int cdrom_flush_cache (struct cdrom_device_info * cdi )
359360{
@@ -371,7 +372,7 @@ static int cdrom_flush_cache(struct cdrom_device_info *cdi)
371372static int cdrom_get_disc_info (struct cdrom_device_info * cdi ,
372373 disc_information * di )
373374{
374- struct cdrom_device_ops * cdo = cdi -> ops ;
375+ const struct cdrom_device_ops * cdo = cdi -> ops ;
375376 struct packet_command cgc ;
376377 int ret , buflen ;
377378
@@ -586,7 +587,7 @@ static int cdrom_mrw_set_lba_space(struct cdrom_device_info *cdi, int space)
586587int register_cdrom (struct cdrom_device_info * cdi )
587588{
588589 static char banner_printed ;
589- struct cdrom_device_ops * cdo = cdi -> ops ;
590+ const struct cdrom_device_ops * cdo = cdi -> ops ;
590591 int * change_capability = (int * )& cdo -> capability ; /* hack */
591592
592593 cd_dbg (CD_OPEN , "entering register_cdrom\n" );
@@ -610,7 +611,6 @@ int register_cdrom(struct cdrom_device_info *cdi)
610611 ENSURE (reset , CDC_RESET );
611612 ENSURE (generic_packet , CDC_GENERIC_PACKET );
612613 cdi -> mc_flags = 0 ;
613- cdo -> n_minors = 0 ;
614614 cdi -> options = CDO_USE_FFLAGS ;
615615
616616 if (autoclose == 1 && CDROM_CAN (CDC_CLOSE_TRAY ))
@@ -630,8 +630,7 @@ int register_cdrom(struct cdrom_device_info *cdi)
630630 else
631631 cdi -> cdda_method = CDDA_OLD ;
632632
633- if (!cdo -> generic_packet )
634- cdo -> generic_packet = cdrom_dummy_generic_packet ;
633+ WARN_ON (!cdo -> generic_packet );
635634
636635 cd_dbg (CD_REG_UNREG , "drive \"/dev/%s\" registered\n" , cdi -> name );
637636 mutex_lock (& cdrom_mutex );
@@ -652,7 +651,6 @@ void unregister_cdrom(struct cdrom_device_info *cdi)
652651 if (cdi -> exit )
653652 cdi -> exit (cdi );
654653
655- cdi -> ops -> n_minors -- ;
656654 cd_dbg (CD_REG_UNREG , "drive \"/dev/%s\" unregistered\n" , cdi -> name );
657655}
658656
@@ -1036,7 +1034,7 @@ static
10361034int open_for_data (struct cdrom_device_info * cdi )
10371035{
10381036 int ret ;
1039- struct cdrom_device_ops * cdo = cdi -> ops ;
1037+ const struct cdrom_device_ops * cdo = cdi -> ops ;
10401038 tracktype tracks ;
10411039 cd_dbg (CD_OPEN , "entering open_for_data\n" );
10421040 /* Check if the driver can report drive status. If it can, we
@@ -1198,8 +1196,8 @@ int cdrom_open(struct cdrom_device_info *cdi, struct block_device *bdev,
11981196/* This code is similar to that in open_for_data. The routine is called
11991197 whenever an audio play operation is requested.
12001198*/
1201- static int check_for_audio_disc (struct cdrom_device_info * cdi ,
1202- struct cdrom_device_ops * cdo )
1199+ static int check_for_audio_disc (struct cdrom_device_info * cdi ,
1200+ const struct cdrom_device_ops * cdo )
12031201{
12041202 int ret ;
12051203 tracktype tracks ;
@@ -1254,7 +1252,7 @@ static int check_for_audio_disc(struct cdrom_device_info * cdi,
12541252
12551253void cdrom_release (struct cdrom_device_info * cdi , fmode_t mode )
12561254{
1257- struct cdrom_device_ops * cdo = cdi -> ops ;
1255+ const struct cdrom_device_ops * cdo = cdi -> ops ;
12581256 int opened_for_data ;
12591257
12601258 cd_dbg (CD_CLOSE , "entering cdrom_release\n" );
@@ -1294,7 +1292,7 @@ static int cdrom_read_mech_status(struct cdrom_device_info *cdi,
12941292 struct cdrom_changer_info * buf )
12951293{
12961294 struct packet_command cgc ;
1297- struct cdrom_device_ops * cdo = cdi -> ops ;
1295+ const struct cdrom_device_ops * cdo = cdi -> ops ;
12981296 int length ;
12991297
13001298 /*
@@ -1643,7 +1641,7 @@ static int dvd_do_auth(struct cdrom_device_info *cdi, dvd_authinfo *ai)
16431641 int ret ;
16441642 u_char buf [20 ];
16451643 struct packet_command cgc ;
1646- struct cdrom_device_ops * cdo = cdi -> ops ;
1644+ const struct cdrom_device_ops * cdo = cdi -> ops ;
16471645 rpc_state_t rpc_state ;
16481646
16491647 memset (buf , 0 , sizeof (buf ));
@@ -1791,7 +1789,7 @@ static int dvd_read_physical(struct cdrom_device_info *cdi, dvd_struct *s,
17911789{
17921790 unsigned char buf [21 ], * base ;
17931791 struct dvd_layer * layer ;
1794- struct cdrom_device_ops * cdo = cdi -> ops ;
1792+ const struct cdrom_device_ops * cdo = cdi -> ops ;
17951793 int ret , layer_num = s -> physical .layer_num ;
17961794
17971795 if (layer_num >= DVD_LAYERS )
@@ -1842,7 +1840,7 @@ static int dvd_read_copyright(struct cdrom_device_info *cdi, dvd_struct *s,
18421840{
18431841 int ret ;
18441842 u_char buf [8 ];
1845- struct cdrom_device_ops * cdo = cdi -> ops ;
1843+ const struct cdrom_device_ops * cdo = cdi -> ops ;
18461844
18471845 init_cdrom_command (cgc , buf , sizeof (buf ), CGC_DATA_READ );
18481846 cgc -> cmd [0 ] = GPCMD_READ_DVD_STRUCTURE ;
@@ -1866,7 +1864,7 @@ static int dvd_read_disckey(struct cdrom_device_info *cdi, dvd_struct *s,
18661864{
18671865 int ret , size ;
18681866 u_char * buf ;
1869- struct cdrom_device_ops * cdo = cdi -> ops ;
1867+ const struct cdrom_device_ops * cdo = cdi -> ops ;
18701868
18711869 size = sizeof (s -> disckey .value ) + 4 ;
18721870
@@ -1894,7 +1892,7 @@ static int dvd_read_bca(struct cdrom_device_info *cdi, dvd_struct *s,
18941892{
18951893 int ret , size = 4 + 188 ;
18961894 u_char * buf ;
1897- struct cdrom_device_ops * cdo = cdi -> ops ;
1895+ const struct cdrom_device_ops * cdo = cdi -> ops ;
18981896
18991897 buf = kmalloc (size , GFP_KERNEL );
19001898 if (!buf )
@@ -1928,7 +1926,7 @@ static int dvd_read_manufact(struct cdrom_device_info *cdi, dvd_struct *s,
19281926{
19291927 int ret = 0 , size ;
19301928 u_char * buf ;
1931- struct cdrom_device_ops * cdo = cdi -> ops ;
1929+ const struct cdrom_device_ops * cdo = cdi -> ops ;
19321930
19331931 size = sizeof (s -> manufact .value ) + 4 ;
19341932
@@ -1995,7 +1993,7 @@ int cdrom_mode_sense(struct cdrom_device_info *cdi,
19951993 struct packet_command * cgc ,
19961994 int page_code , int page_control )
19971995{
1998- struct cdrom_device_ops * cdo = cdi -> ops ;
1996+ const struct cdrom_device_ops * cdo = cdi -> ops ;
19991997
20001998 memset (cgc -> cmd , 0 , sizeof (cgc -> cmd ));
20011999
@@ -2010,7 +2008,7 @@ int cdrom_mode_sense(struct cdrom_device_info *cdi,
20102008int cdrom_mode_select (struct cdrom_device_info * cdi ,
20112009 struct packet_command * cgc )
20122010{
2013- struct cdrom_device_ops * cdo = cdi -> ops ;
2011+ const struct cdrom_device_ops * cdo = cdi -> ops ;
20142012
20152013 memset (cgc -> cmd , 0 , sizeof (cgc -> cmd ));
20162014 memset (cgc -> buffer , 0 , 2 );
@@ -2025,7 +2023,7 @@ int cdrom_mode_select(struct cdrom_device_info *cdi,
20252023static int cdrom_read_subchannel (struct cdrom_device_info * cdi ,
20262024 struct cdrom_subchnl * subchnl , int mcn )
20272025{
2028- struct cdrom_device_ops * cdo = cdi -> ops ;
2026+ const struct cdrom_device_ops * cdo = cdi -> ops ;
20292027 struct packet_command cgc ;
20302028 char buffer [32 ];
20312029 int ret ;
@@ -2073,7 +2071,7 @@ static int cdrom_read_cd(struct cdrom_device_info *cdi,
20732071 struct packet_command * cgc , int lba ,
20742072 int blocksize , int nblocks )
20752073{
2076- struct cdrom_device_ops * cdo = cdi -> ops ;
2074+ const struct cdrom_device_ops * cdo = cdi -> ops ;
20772075
20782076 memset (& cgc -> cmd , 0 , sizeof (cgc -> cmd ));
20792077 cgc -> cmd [0 ] = GPCMD_READ_10 ;
@@ -2093,7 +2091,7 @@ static int cdrom_read_block(struct cdrom_device_info *cdi,
20932091 struct packet_command * cgc ,
20942092 int lba , int nblocks , int format , int blksize )
20952093{
2096- struct cdrom_device_ops * cdo = cdi -> ops ;
2094+ const struct cdrom_device_ops * cdo = cdi -> ops ;
20972095
20982096 memset (& cgc -> cmd , 0 , sizeof (cgc -> cmd ));
20992097 cgc -> cmd [0 ] = GPCMD_READ_CD ;
@@ -2764,7 +2762,7 @@ static int cdrom_ioctl_audioctl(struct cdrom_device_info *cdi,
27642762 */
27652763static int cdrom_switch_blocksize (struct cdrom_device_info * cdi , int size )
27662764{
2767- struct cdrom_device_ops * cdo = cdi -> ops ;
2765+ const struct cdrom_device_ops * cdo = cdi -> ops ;
27682766 struct packet_command cgc ;
27692767 struct modesel_head mh ;
27702768
@@ -2790,7 +2788,7 @@ static int cdrom_switch_blocksize(struct cdrom_device_info *cdi, int size)
27902788static int cdrom_get_track_info (struct cdrom_device_info * cdi ,
27912789 __u16 track , __u8 type , track_information * ti )
27922790{
2793- struct cdrom_device_ops * cdo = cdi -> ops ;
2791+ const struct cdrom_device_ops * cdo = cdi -> ops ;
27942792 struct packet_command cgc ;
27952793 int ret , buflen ;
27962794
@@ -3049,7 +3047,7 @@ static noinline int mmc_ioctl_cdrom_play_msf(struct cdrom_device_info *cdi,
30493047 void __user * arg ,
30503048 struct packet_command * cgc )
30513049{
3052- struct cdrom_device_ops * cdo = cdi -> ops ;
3050+ const struct cdrom_device_ops * cdo = cdi -> ops ;
30533051 struct cdrom_msf msf ;
30543052 cd_dbg (CD_DO_IOCTL , "entering CDROMPLAYMSF\n" );
30553053 if (copy_from_user (& msf , (struct cdrom_msf __user * )arg , sizeof (msf )))
@@ -3069,7 +3067,7 @@ static noinline int mmc_ioctl_cdrom_play_blk(struct cdrom_device_info *cdi,
30693067 void __user * arg ,
30703068 struct packet_command * cgc )
30713069{
3072- struct cdrom_device_ops * cdo = cdi -> ops ;
3070+ const struct cdrom_device_ops * cdo = cdi -> ops ;
30733071 struct cdrom_blk blk ;
30743072 cd_dbg (CD_DO_IOCTL , "entering CDROMPLAYBLK\n" );
30753073 if (copy_from_user (& blk , (struct cdrom_blk __user * )arg , sizeof (blk )))
@@ -3164,7 +3162,7 @@ static noinline int mmc_ioctl_cdrom_start_stop(struct cdrom_device_info *cdi,
31643162 struct packet_command * cgc ,
31653163 int cmd )
31663164{
3167- struct cdrom_device_ops * cdo = cdi -> ops ;
3165+ const struct cdrom_device_ops * cdo = cdi -> ops ;
31683166 cd_dbg (CD_DO_IOCTL , "entering CDROMSTART/CDROMSTOP\n" );
31693167 cgc -> cmd [0 ] = GPCMD_START_STOP_UNIT ;
31703168 cgc -> cmd [1 ] = 1 ;
@@ -3177,7 +3175,7 @@ static noinline int mmc_ioctl_cdrom_pause_resume(struct cdrom_device_info *cdi,
31773175 struct packet_command * cgc ,
31783176 int cmd )
31793177{
3180- struct cdrom_device_ops * cdo = cdi -> ops ;
3178+ const struct cdrom_device_ops * cdo = cdi -> ops ;
31813179 cd_dbg (CD_DO_IOCTL , "entering CDROMPAUSE/CDROMRESUME\n" );
31823180 cgc -> cmd [0 ] = GPCMD_PAUSE_RESUME ;
31833181 cgc -> cmd [8 ] = (cmd == CDROMRESUME ) ? 1 : 0 ;
0 commit comments