cdrom: removed trailing whitespaces
PATCH 1/8 cdrom: removed trailing whitespaces
Fixed all trailing whitespace coding style issues.
--- drivers/cdrom/cdrom.c | 200 ++++++++++++++++++++++++------------------------ 1 files changed, 100 insertions(+), 100 deletions(-)
drivers/cdrom/cdrom.c +100 -100
@@ -63,8 +63,8 @@ 2.12 Jan 24, 1998 -- Erik Andersen <[email protected]> -- Fixed a bug in the IOCTL_IN and IOCTL_OUT macros. It turns out that - copy_*_user does not return EFAULT on error, but instead returns the number - of bytes not copied. I was returning whatever non-zero stuff came back from + copy_*_user does not return EFAULT on error, but instead returns the number + of bytes not copied. I was returning whatever non-zero stuff came back from the copy_*_user functions directly, which would result in strange errors. 2.13 July 17, 1998 -- Erik Andersen <[email protected]>
@@ -78,7 +78,7 @@ 2.14 August 17, 1998 -- Erik Andersen <[email protected]> -- Fixed a bug in cdrom_media_changed and handling of reporting that - the media had changed for devices that _don't_ implement media_changed. + the media had changed for devices that _don't_ implement media_changed. Thanks to Grant R. Guenther <[email protected]> for spotting this bug. -- Made a few things more pedanticly correct.
@@ -86,12 +86,12 @@ -- New maintainers! Erik was too busy to continue the work on the driver, so now Chris Zwilling <[email protected]> and Jens Axboe <[email protected]> will do their best to follow in his footsteps - + 2.51 Dec 20, 1998 - Jens Axboe <[email protected]> -- Check if drive is capable of doing what we ask before blindly changing cdi->options in various ioctl. -- Added version to proc entry. - + 2.52 Jan 16, 1999 - Jens Axboe <[email protected]> -- Fixed an error in open_for_data where we would sometimes not return the correct error value. Thanks Huba Gaspar <[email protected]>.
@@ -100,7 +100,7 @@ modules had entries in dev. Feb 02 - real bug was in sysctl.c where dev would be removed even though it was used. cdrom.c just illuminated that bug. - + 2.53 Feb 22, 1999 - Jens Axboe <[email protected]> -- Fixup of several ioctl calls, in particular CDROM_SET_OPTIONS has been "rewritten" because capabilities and options aren't in sync. They
@@ -110,16 +110,16 @@ -- Added CDROM_DEBUG ioctl. Enable debug messages on-the-fly. -- Added CDROM_GET_CAPABILITY ioctl. This relieves userspace programs from parsing /proc/sys/dev/cdrom/info. - + 2.54 Mar 15, 1999 - Jens Axboe <[email protected]> -- Check capability mask from low level driver when counting tracks as per suggestion from Corey J. Scotts <[email protected]>. - + 2.55 Apr 25, 1999 - Jens Axboe <[email protected]> -- autoclose was mistakenly checked against CDC_OPEN_TRAY instead of CDC_CLOSE_TRAY. -- proc info didn't mask against capabilities mask. - + 3.00 Aug 5, 1999 - Jens Axboe <[email protected]> -- Unified audio ioctl handling across CD-ROM drivers. A lot of the code was duplicated before. Drives that support the generic packet
@@ -137,13 +137,13 @@ -- Now default to checking media type. -- CDROM_SEND_PACKET ioctl added. The infrastructure was in place for doing this anyway, with the generic_packet addition. - + 3.01 Aug 6, 1999 - Jens Axboe <[email protected]> -- Fix up the sysctl handling so that the option flags get set correctly. -- Fix up ioctl handling so the device specific ones actually get called :). - + 3.02 Aug 8, 1999 - Jens Axboe <[email protected]> -- Fixed volume control on SCSI drives (or others with longer audio page).
@@ -152,7 +152,7 @@ DVD structures and ioctls in the first place! He designed the original DVD patches for ide-cd and while I rearranged and unified them, the interface is still the same. - + 3.03 Sep 1, 1999 - Jens Axboe <[email protected]> -- Moved the rest of the audio ioctls from the CD-ROM drivers here. Only CDROMREADTOCENTRY and CDROMREADTOCHDR are left.
@@ -177,7 +177,7 @@ for ide-cd to handle multisession discs. -- Export cdrom_mode_sense and cdrom_mode_select. -- init_cdrom_command() for setting up a cgc command. - + 3.05 Oct 24, 1999 - Jens Axboe <[email protected]> -- Changed the interface for CDROM_SEND_PACKET. Before it was virtually impossible to send the drive data in a sensible way.
@@ -210,7 +210,7 @@ DVD_HOST_SEND_RPC_STATE did not set buffer size in cdb, and dvd_do_auth passed uninitialized data to drive because init_cdrom_command did not clear a 0 sized buffer. - + 3.09 May 12, 2000 - Jens Axboe <[email protected]> -- Fix Video-CD on SCSI drives that don't support READ_CD command. In that case switch block size and issue plain READ_10 again, then switch
@@ -271,7 +271,7 @@#include <linux/errno.h> #include <linux/kernel.h> #include <linux/mm.h> -#include <linux/slab.h> +#include <linux/slab.h> #include <linux/cdrom.h> #include <linux/sysctl.h> #include <linux/proc_fs.h>
@@ -318,7 +318,7 @@ static const char *mrw_address_space[] = { "DMA", "GAA" }; if ((ERRLOGMASK & type) || debug==1 ) \ printk(KERN_INFO "cdrom: " fmt, ## args) #else -#define cdinfo(type, fmt, args...) +#define cdinfo(type, fmt, args...)#endif /* These are used to simplify getting data in from and back to user land */
@@ -347,7 +347,7 @@ static const char *mrw_address_space[] = { "DMA", "GAA" };static int open_for_data (struct cdrom_device_info * cdi);static int check_for_audio_disc (struct cdrom_device_info * cdi,struct cdrom_device_ops * cdo); -static void sanitize_format (union cdrom_addr *addr, +static void sanitize_format (union cdrom_addr *addr,u_char * curr,u_char requested);static int mmc_ioctl (struct cdrom_device_info *cdi,unsigned int cmd,unsigned long arg);
@@ -390,7 +390,7 @@ int register_cdrom(struct cdrom_device_info *cdi)struct cdrom_device_ops *cdo = cdi->ops;int *change_capability = (int *)&cdo->capability;/* hack */ -cdinfo (CD_OPEN ,"entering register_cdrom\n" ); +cdinfo (CD_OPEN ,"entering register_cdrom\n" );if (cdo->open ==NULL || cdo->release ==NULL )return -EINVAL ;
@@ -412,7 +412,7 @@ int register_cdrom(struct cdrom_device_info *cdi) cdi->mc_flags =0 ; cdo->n_minors =0 ; cdi->options =CDO_USE_FFLAGS ; - +if (autoclose==1 &&CDROM_CAN (CDC_CLOSE_TRAY )) cdi->options |= (int )CDO_AUTO_CLOSE ;if (autoeject==1 &&CDROM_CAN (CDC_OPEN_TRAY ))
@@ -443,7 +443,7 @@ int register_cdrom(struct cdrom_device_info *cdi)void unregister_cdrom (struct cdrom_device_info *cdi) { -cdinfo (CD_OPEN ,"entering unregister_cdrom\n" ); +cdinfo (CD_OPEN ,"entering unregister_cdrom\n" );mutex_lock (&cdrom_mutex);list_del (&cdi->list);
@@ -887,7 +887,7 @@ static int cdrom_open_write(struct cdrom_device_info *cdi) ram_write =1 ; else (void) cdrom_is_random_writable(cdi, &ram_write); - +if (mrw) cdi->mask &= ~CDC_MRW ;else
@@ -977,7 +977,7 @@ int cdrom_open(struct cdrom_device_info *cdi, struct block_device *bdev, fmode_t {int ret; -cdinfo (CD_OPEN ,"entering cdrom_open\n" ); +cdinfo (CD_OPEN ,"entering cdrom_open\n" );/* if this was a O_NONBLOCK open and we should honor the flags, * do a quick open without drive/disc integrity checks. */
@@ -1031,38 +1031,38 @@ int open_for_data(struct cdrom_device_info * cdi)can do clever things. If it can't, well, we at least tried! */ if (cdo->drive_status !=NULL ) { ret = cdo->drive_status (cdi,CDSL_CURRENT ); -cdinfo (CD_OPEN ,"drive_status=%d\n" , ret); +cdinfo (CD_OPEN ,"drive_status=%d\n" , ret);if (ret ==CDS_TRAY_OPEN ) { -cdinfo (CD_OPEN ,"the tray is open...\n" ); +cdinfo (CD_OPEN ,"the tray is open...\n" );/* can/may i close it? */ if (CDROM_CAN (CDC_CLOSE_TRAY ) && cdi->options &CDO_AUTO_CLOSE ) { -cdinfo (CD_OPEN ,"trying to close the tray.\n" ); +cdinfo (CD_OPEN ,"trying to close the tray.\n" ); ret=cdo->tray_move (cdi,0 );if (ret) { -cdinfo (CD_OPEN ,"bummer. tried to close the tray but failed.\n" ); +cdinfo (CD_OPEN ,"bummer. tried to close the tray but failed.\n" );/* Ignore the error from the low level driver. We don't care why it -couldn't close the tray. We only care -that there is no disc in the drive, +couldn't close the tray. We only care +that there is no disc in the drive, since that is the _REAL_ problem here.*/ ret=-ENOMEDIUM ; goto clean_up_and_return; } }else { -cdinfo (CD_OPEN ,"bummer. this drive can't close the tray.\n" ); +cdinfo (CD_OPEN ,"bummer. this drive can't close the tray.\n" ); ret=-ENOMEDIUM ; goto clean_up_and_return; }/* Ok, the door should be closed now.. Check again */ ret = cdo->drive_status (cdi,CDSL_CURRENT );if ((ret ==CDS_NO_DISC ) || (ret==CDS_TRAY_OPEN )) { -cdinfo (CD_OPEN ,"bummer. the tray is still not closed.\n" ); +cdinfo (CD_OPEN ,"bummer. the tray is still not closed.\n" );cdinfo (CD_OPEN ,"tray might not contain a medium.\n" ); ret=-ENOMEDIUM ; goto clean_up_and_return; } -cdinfo (CD_OPEN ,"the tray is now closed.\n" ); +cdinfo (CD_OPEN ,"the tray is now closed.\n" ); }/* the door should be closed now, check for the disc */ ret = cdo->drive_status (cdi,CDSL_CURRENT );
@@ -1083,7 +1083,7 @@ int open_for_data(struct cdrom_device_info * cdi)if (cdi->options &CDO_CHECK_TYPE ) {/* give people a warning shot, now that CDO_CHECK_TYPE is the default case! */ -cdinfo (CD_OPEN ,"bummer. wrong media type.\n" ); +cdinfo (CD_OPEN ,"bummer. wrong media type.\n" );cdinfo (CD_WARNING ,"pid %d must open device O_NONBLOCK!\n" , (unsigned int )task_pid_nr (current)); ret=-EMEDIUMTYPE ;
@@ -1094,32 +1094,32 @@ int open_for_data(struct cdrom_device_info * cdi) } } -cdinfo (CD_OPEN ,"all seems well, opening the device.\n" ); +cdinfo (CD_OPEN ,"all seems well, opening the device.\n" );/* all seems well, we can open the device */ ret = cdo->open (cdi,0 );/* open for data */ -cdinfo (CD_OPEN ,"opening the device gave me %d.\n" , ret); +cdinfo (CD_OPEN ,"opening the device gave me %d.\n" , ret);/* After all this careful checking, we shouldn't have problems -opening the device, but we don't want the device locked if +opening the device, but we don't want the device locked if this somehow fails... */ if (ret) { -cdinfo (CD_OPEN ,"open device failed.\n" ); +cdinfo (CD_OPEN ,"open device failed.\n" ); goto clean_up_and_return; }if (CDROM_CAN (CDC_LOCK ) && (cdi->options &CDO_LOCK )) { cdo->lock_door (cdi,1 );cdinfo (CD_OPEN ,"door locked.\n" ); } -cdinfo (CD_OPEN ,"device opened successfully.\n" ); +cdinfo (CD_OPEN ,"device opened successfully.\n" );return ret;/* Something failed. Try to unlock the drive, because some drivers (notably ide-cd) lock the drive after every command. This produced -a nasty bug where after mount failed, the drive would remain locked! -This ensures that the drive gets unlocked after a mount fails. This -is a goto to avoid bloating the driver with redundant code. */ +a nasty bug where after mount failed, the drive would remain locked! +This ensures that the drive gets unlocked after a mount fails. This +is a goto to avoid bloating the driver with redundant code. */ clean_up_and_return: -cdinfo (CD_OPEN ,"open failed.\n" ); +cdinfo (CD_OPEN ,"open failed.\n" );if (CDROM_CAN (CDC_LOCK ) && cdi->options &CDO_LOCK ) { cdo->lock_door (cdi,0 );cdinfo (CD_OPEN ,"door unlocked.\n" );
@@ -1140,42 +1140,42 @@ static int check_for_audio_disc(struct cdrom_device_info * cdi,return 0 ;if (cdo->drive_status !=NULL ) { ret = cdo->drive_status (cdi,CDSL_CURRENT ); -cdinfo (CD_OPEN ,"drive_status=%d\n" , ret); +cdinfo (CD_OPEN ,"drive_status=%d\n" , ret);if (ret ==CDS_TRAY_OPEN ) { -cdinfo (CD_OPEN ,"the tray is open...\n" ); +cdinfo (CD_OPEN ,"the tray is open...\n" );/* can/may i close it? */ if (CDROM_CAN (CDC_CLOSE_TRAY ) && cdi->options &CDO_AUTO_CLOSE ) { -cdinfo (CD_OPEN ,"trying to close the tray.\n" ); +cdinfo (CD_OPEN ,"trying to close the tray.\n" ); ret=cdo->tray_move (cdi,0 );if (ret) { -cdinfo (CD_OPEN ,"bummer. tried to close tray but failed.\n" ); +cdinfo (CD_OPEN ,"bummer. tried to close tray but failed.\n" );/* Ignore the error from the low level driver. We don't care why it -couldn't close the tray. We only care -that there is no disc in the drive, +couldn't close the tray. We only care +that there is no disc in the drive, since that is the _REAL_ problem here.*/ return -ENOMEDIUM ; } }else { -cdinfo (CD_OPEN ,"bummer. this driver can't close the tray.\n" ); +cdinfo (CD_OPEN ,"bummer. this driver can't close the tray.\n" );return -ENOMEDIUM ; }/* Ok, the door should be closed now.. Check again */ ret = cdo->drive_status (cdi,CDSL_CURRENT );if ((ret ==CDS_NO_DISC ) || (ret==CDS_TRAY_OPEN )) { -cdinfo (CD_OPEN ,"bummer. the tray is still not closed.\n" ); +cdinfo (CD_OPEN ,"bummer. the tray is still not closed.\n" );return -ENOMEDIUM ; - } + }if (ret!=CDS_DISC_OK ) { -cdinfo (CD_OPEN ,"bummer. disc isn't ready.\n" ); +cdinfo (CD_OPEN ,"bummer. disc isn't ready.\n" );return -EIO ; - } -cdinfo (CD_OPEN ,"the tray is now closed.\n" ); - } + } +cdinfo (CD_OPEN ,"the tray is now closed.\n" ); + } }cdrom_count_tracks (cdi, &tracks); -if (tracks.error) +if (tracks.error)return (tracks.error);if (tracks.audio==0 )
@@ -1221,7 +1221,7 @@ void cdrom_release(struct cdrom_device_info *cdi, fmode_t mode) } } -static int cdrom_read_mech_status (struct cdrom_device_info *cdi, +static int cdrom_read_mech_status (struct cdrom_device_info *cdi,struct cdrom_changer_info *buf) {struct packet_command cgc;
@@ -1258,10 +1258,10 @@ static int cdrom_slot_status(struct cdrom_device_info *cdi, int slot)struct cdrom_changer_info *info;int ret; -cdinfo (CD_CHANGER ,"entering cdrom_slot_status()\n" ); +cdinfo (CD_CHANGER ,"entering cdrom_slot_status()\n" );if (cdi->sanyo_slot)return CDS_NO_INFO ; - + info =kmalloc (sizeof (*info),GFP_KERNEL );if (!info)return -ENOMEM ;
@@ -1279,18 +1279,18 @@ out_free:return ret; } -/* Return the number of slots for an ATAPI/SCSI cdrom, -* return 1 if not a changer. +/* Return the number of slots for an ATAPI/SCSI cdrom, +* return 1 if not a changer. */ -int cdrom_number_of_slots (struct cdrom_device_info *cdi) +int cdrom_number_of_slots (struct cdrom_device_info *cdi) {int status;int nslots =1 ;struct cdrom_changer_info *info; -cdinfo (CD_CHANGER ,"entering cdrom_number_of_slots()\n" ); +cdinfo (CD_CHANGER ,"entering cdrom_number_of_slots()\n" );/* cdrom_read_mech_status requires a valid value for capacity: */ - cdi->capacity =0 ; + cdi->capacity =0 ; info =kmalloc (sizeof (*info),GFP_KERNEL );if (!info)
@@ -1305,11 +1305,11 @@ int cdrom_number_of_slots(struct cdrom_device_info *cdi)/* If SLOT < 0, unload the current slot. Otherwise, try to load SLOT. */ -static int cdrom_load_unload (struct cdrom_device_info *cdi,int slot) +static int cdrom_load_unload (struct cdrom_device_info *cdi,int slot) {struct packet_command cgc; -cdinfo (CD_CHANGER ,"entering cdrom_load_unload()\n" ); +cdinfo (CD_CHANGER ,"entering cdrom_load_unload()\n" );if (cdi->sanyo_slot && slot <0 )return 0 ;
@@ -1319,7 +1319,7 @@ static int cdrom_load_unload(struct cdrom_device_info *cdi, int slot) cgc.cmd[8 ] = slot; cgc.timeout =60 *HZ ; -/* The Sanyo 3 CD changer uses byte 7 of the +/* The Sanyo 3 CD changer uses byte 7 of the GPCMD_TEST_UNIT_READY to command to switch CDs instead of using the GPCMD_LOAD_UNLOAD opcode. */ if (cdi->sanyo_slot &&-1 < slot) {
@@ -1338,7 +1338,7 @@ static int cdrom_select_disc(struct cdrom_device_info *cdi, int slot)int curslot;int ret; -cdinfo (CD_CHANGER ,"entering cdrom_select_disc()\n" ); +cdinfo (CD_CHANGER ,"entering cdrom_select_disc()\n" );if (!CDROM_CAN (CDC_SELECT_DISC ))return -EDRIVE_CANT_DO_THIS ;
@@ -1372,7 +1372,7 @@ static int cdrom_select_disc(struct cdrom_device_info *cdi, int slot)/* Specifying CDSL_CURRENT will attempt to load the currnet slot, which is useful if it had been previously unloaded. -Whether it can or not, it returns the current slot. +Whether it can or not, it returns the current slot. Similarly, if slot happens to be the current one, we still try and load it. */ if (slot ==CDSL_CURRENT )
@@ -1412,9 +1412,9 @@ int media_changed(struct cdrom_device_info *cdi, int queue)int cdrom_media_changed (struct cdrom_device_info *cdi) { -/* This talks to the VFS, which doesn't like errors - just 1 or 0. -* Returning "0" is always safe (media hasn't been changed). Do that -* if the low-level cdrom driver dosn't support media changed. */ +/* This talks to the VFS, which doesn't like errors - just 1 or 0. +* Returning "0" is always safe (media hasn't been changed). Do that +* if the low-level cdrom driver dosn't support media changed. */ if (cdi ==NULL || cdi->ops->media_changed ==NULL )return 0 ;if (!CDROM_CAN (CDC_MEDIA_CHANGED ))
@@ -1433,7 +1433,7 @@ static void cdrom_count_tracks(struct cdrom_device_info *cdi, tracktype* tracks) tracks->cdi=0 ; tracks->xa=0 ; tracks->error=0 ; -cdinfo (CD_COUNT_TRACKS ,"entering cdrom_count_tracks\n" ); +cdinfo (CD_COUNT_TRACKS ,"entering cdrom_count_tracks\n" );/* Grab the TOC header so we can see how many tracks there are */ if ((ret = cdi->ops->audio_ioctl (cdi,CDROMREADTOCHDR , &header))) {if (ret == -ENOMEDIUM )
@@ -1441,7 +1441,7 @@ static void cdrom_count_tracks(struct cdrom_device_info *cdi, tracktype* tracks)else tracks->error =CDS_NO_INFO ;return ; - } + }/* check what type of tracks are on this disc */ entry.cdte_format =CDROM_MSF ;for (i = header.cdth_trk0; i <= header.cdth_trk1; i++) {
@@ -1449,11 +1449,11 @@ static void cdrom_count_tracks(struct cdrom_device_info *cdi, tracktype* tracks)if (cdi->ops->audio_ioctl (cdi,CDROMREADTOCENTRY , &entry)) { tracks->error=CDS_NO_INFO ;return ; - } + }if (entry.cdte_ctrl &CDROM_DATA_TRACK ) {if (entry.cdte_format ==0x10 ) tracks->cdi++; -else if (entry.cdte_format ==0x20 ) +else if (entry.cdte_format ==0x20 ) tracks->xa++;else tracks->data++;
@@ -1461,11 +1461,11 @@ static void cdrom_count_tracks(struct cdrom_device_info *cdi, tracktype* tracks) tracks->audio++;cdinfo (CD_COUNT_TRACKS ,"track %d: format=%d, ctrl=%d\n" , i, entry.cdte_format, entry.cdte_ctrl); - } -cdinfo (CD_COUNT_TRACKS ,"disc has %d tracks: %d=audio %d=data %d=Cd-I %d=XA\n" , - header.cdth_trk1, tracks->audio, tracks->data, + } +cdinfo (CD_COUNT_TRACKS ,"disc has %d tracks: %d=audio %d=data %d=Cd-I %d=XA\n" , + header.cdth_trk1, tracks->audio, tracks->data, tracks->cdi, tracks->xa); -} +}/* Requests to the low-level drivers will /always/ be done in the following format convention:
@@ -1578,7 +1578,7 @@ static int dvd_do_auth(struct cdrom_device_info *cdi, dvd_authinfo *ai)switch (ai->type) {/* LU data send */ case DVD_LU_SEND_AGID : -cdinfo (CD_DVD ,"entering DVD_LU_SEND_AGID\n" ); +cdinfo (CD_DVD ,"entering DVD_LU_SEND_AGID\n" ); cgc.quiet =1 ;setup_report_key (&cgc, ai->lsa.agid,0 );
@@ -1590,7 +1590,7 @@ static int dvd_do_auth(struct cdrom_device_info *cdi, dvd_authinfo *ai)break ;case DVD_LU_SEND_KEY1 : -cdinfo (CD_DVD ,"entering DVD_LU_SEND_KEY1\n" ); +cdinfo (CD_DVD ,"entering DVD_LU_SEND_KEY1\n" );setup_report_key (&cgc, ai->lsk.agid,2 );if ((ret = cdo->generic_packet (cdi, &cgc)))
@@ -1601,7 +1601,7 @@ static int dvd_do_auth(struct cdrom_device_info *cdi, dvd_authinfo *ai)break ;case DVD_LU_SEND_CHALLENGE : -cdinfo (CD_DVD ,"entering DVD_LU_SEND_CHALLENGE\n" ); +cdinfo (CD_DVD ,"entering DVD_LU_SEND_CHALLENGE\n" );setup_report_key (&cgc, ai->lsc.agid,1 );if ((ret = cdo->generic_packet (cdi, &cgc)))
@@ -1613,7 +1613,7 @@ static int dvd_do_auth(struct cdrom_device_info *cdi, dvd_authinfo *ai)/* Post-auth key */ case DVD_LU_SEND_TITLE_KEY : -cdinfo (CD_DVD ,"entering DVD_LU_SEND_TITLE_KEY\n" ); +cdinfo (CD_DVD ,"entering DVD_LU_SEND_TITLE_KEY\n" ); cgc.quiet =1 ;setup_report_key (&cgc, ai->lstk.agid,4 ); cgc.cmd[5 ] = ai->lstk.lba;
@@ -1632,9 +1632,9 @@ static int dvd_do_auth(struct cdrom_device_info *cdi, dvd_authinfo *ai)break ;case DVD_LU_SEND_ASF : -cdinfo (CD_DVD ,"entering DVD_LU_SEND_ASF\n" ); +cdinfo (CD_DVD ,"entering DVD_LU_SEND_ASF\n" );setup_report_key (&cgc, ai->lsasf.agid,5 ); - +if ((ret = cdo->generic_packet (cdi, &cgc)))return ret;
@@ -1643,7 +1643,7 @@ static int dvd_do_auth(struct cdrom_device_info *cdi, dvd_authinfo *ai)/* LU data receive (LU changes state) */ case DVD_HOST_SEND_CHALLENGE : -cdinfo (CD_DVD ,"entering DVD_HOST_SEND_CHALLENGE\n" ); +cdinfo (CD_DVD ,"entering DVD_HOST_SEND_CHALLENGE\n" );setup_send_key (&cgc, ai->hsc.agid,1 ); buf[1 ] =0xe ;copy_chal (&buf[4 ], ai->hsc.chal);
@@ -1655,7 +1655,7 @@ static int dvd_do_auth(struct cdrom_device_info *cdi, dvd_authinfo *ai)break ;case DVD_HOST_SEND_KEY2 : -cdinfo (CD_DVD ,"entering DVD_HOST_SEND_KEY2\n" ); +cdinfo (CD_DVD ,"entering DVD_HOST_SEND_KEY2\n" );setup_send_key (&cgc, ai->hsk.agid,3 ); buf[1 ] =0xa ;copy_key (&buf[4 ], ai->hsk.key);
@@ -1670,7 +1670,7 @@ static int dvd_do_auth(struct cdrom_device_info *cdi, dvd_authinfo *ai)/* Misc */ case DVD_INVALIDATE_AGID : cgc.quiet =1 ; -cdinfo (CD_DVD ,"entering DVD_INVALIDATE_AGID\n" ); +cdinfo (CD_DVD ,"entering DVD_INVALIDATE_AGID\n" );setup_report_key (&cgc, ai->lsa.agid,0x3f );if ((ret = cdo->generic_packet (cdi, &cgc)))return ret;
@@ -1903,7 +1903,7 @@ static int dvd_read_struct(struct cdrom_device_info *cdi, dvd_struct *s,case DVD_STRUCT_MANUFACT :return dvd_read_manufact (cdi, s, cgc); - +default :cdinfo (CD_WARNING ,": Invalid DVD structure read requested (%d)\n" , s->type);
@@ -2019,7 +2019,7 @@ static int cdrom_read_block(struct cdrom_device_info *cdi, cgc->cmd[7 ] = (nblocks >>8 ) &0xff ; cgc->cmd[8 ] = nblocks &0xff ; cgc->buflen = blksize * nblocks; - +/* set the header info returned */ switch (blksize) {case CD_FRAMESIZE_RAW0 : cgc->cmd[9 ] =0x58 ;break ;
@@ -2027,7 +2027,7 @@ static int cdrom_read_block(struct cdrom_device_info *cdi,case CD_FRAMESIZE_RAW : cgc->cmd[9 ] =0xf8 ;break ;default : cgc->cmd[9 ] =0x10 ; } - +return cdo->generic_packet (cdi, cgc); }
@@ -2191,7 +2191,7 @@ retry:printk ("cdrom: dropping to old style cdda (sense=%x)\n" , cdi->last_sense); cdi->cdda_method =CDDA_OLD ; -return cdrom_read_cdda_old (cdi, ubuf, lba, nframes); +return cdrom_read_cdda_old (cdi, ubuf, lba, nframes); } static int cdrom_ioctl_multisession(struct cdrom_device_info *cdi,
@@ -2964,7 +2964,7 @@ static noinline int mmc_ioctl_cdrom_volume(struct cdrom_device_info *cdi, ret =cdrom_mode_sense (cdi, cgc,GPMODE_AUDIO_CTL_PAGE ,0 );if (ret)return ret; - +/* originally the code depended on buffer[1] to determine how much data is available for transfer. buffer[1] is unfortunately ambigious and the only reliable way seem
@@ -2997,7 +2997,7 @@ static noinline int mmc_ioctl_cdrom_volume(struct cdrom_device_info *cdi, IOCTL_OUT(arg, struct cdrom_volctrl, volctrl);return 0 ; } - +/* get the volume mask */ cgc->buffer = mask; ret =cdrom_mode_sense (cdi, cgc,GPMODE_AUDIO_CTL_PAGE ,1 );
@@ -3176,7 +3176,7 @@ static int cdrom_get_track_info(struct cdrom_device_info *cdi, __u16 track, __u8if ((ret = cdo->generic_packet (cdi, &cgc)))return ret; - + buflen =be16_to_cpu (ti->track_information_length) +sizeof (ti->track_information_length);
@@ -3418,7 +3418,7 @@ static int cdrom_sysctl_info(ctl_table *ctl, int write,int pos;char *info = cdrom_sysctl_settings.info;const int max_size =sizeof (cdrom_sysctl_settings.info); - +if (!*lenp || (*ppos && !write)) { *lenp =0 ;return 0 ;
@@ -3427,7 +3427,7 @@ static int cdrom_sysctl_info(ctl_table *ctl, int write,mutex_lock (&cdrom_mutex); pos =sprintf (info,"CD-ROM information, " VERSION "\n" ); - +if (cdrom_print_info ("\ndrive name:\t" ,0 , info, &pos,CTL_NAME )) goto done;if (cdrom_print_info ("\ndrive speed:\t" ,0 , info, &pos,CTL_SPEED ))
@@ -3529,11 +3529,11 @@ static int cdrom_sysctl_handler(ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos) { int ret; - + ret =proc_dointvec (ctl, write, buffer, lenp, ppos);if (write) { - +/* we only care for 1 or 0. */ autoclose = !!cdrom_sysctl_settings.autoclose; autoeject = !!cdrom_sysctl_settings.autoeject;
@@ -3554,7 +3554,7 @@ static int cdrom_sysctl_handler(ctl_table *ctl, int write,static ctl_table cdrom_table[] = { { .procname ="info" , - .data = &cdrom_sysctl_settings.info, + .data = &cdrom_sysctl_settings.info, .maxlen =CDROM_STR_SIZE , .mode =0444 , .proc_handler = cdrom_sysctl_info,
Signature · 1 line
1.7.0
PATCH 2/8 cdrom: adjoined pointer asterisks to data names
Fixed "foo * bar" should be "foo *bar" coding style errors.
--- drivers/cdrom/cdrom.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-)
drivers/cdrom/cdrom.c +8 -8
@@ -344,11 +344,11 @@ static const char *mrw_address_space[] = { "DMA", "GAA" };#define CDROM_DEF_TIMEOUT (7 * HZ)/* Not-exported routines. */ -static int open_for_data (struct cdrom_device_info * cdi); -static int check_for_audio_disc (struct cdrom_device_info * cdi, -struct cdrom_device_ops * cdo); +static int open_for_data (struct cdrom_device_info *cdi); +static int check_for_audio_disc (struct cdrom_device_info *cdi, +struct cdrom_device_ops *cdo);static void sanitize_format (union cdrom_addr *addr, -u_char * curr,u_char requested); +u_char *curr,u_char requested);static int mmc_ioctl (struct cdrom_device_info *cdi,unsigned int cmd,unsigned long arg);
@@ -1021,7 +1021,7 @@ err: }static -int open_for_data (struct cdrom_device_info * cdi) +int open_for_data (struct cdrom_device_info *cdi) {int ret;struct cdrom_device_ops *cdo = cdi->ops;
@@ -1130,8 +1130,8 @@ clean_up_and_return:/* This code is similar to that in open_for_data. The routine is called whenever an audio play operation is requested. */ -static int check_for_audio_disc (struct cdrom_device_info * cdi, -struct cdrom_device_ops * cdo) +static int check_for_audio_disc (struct cdrom_device_info *cdi, +struct cdrom_device_ops *cdo) {int ret;tracktype tracks;
@@ -1485,7 +1485,7 @@ static void cdrom_count_tracks(struct cdrom_device_info *cdi, tracktype* tracks)static void sanitize_format (union cdrom_addr *addr, -u_char * curr,u_char requested) +u_char *curr,u_char requested) {if (*curr == requested)return ;/* nothing to be done! */
Signature · 1 line
1.7.0
PATCH 3/8 cdrom: fixed braces coding style issues
In reply to Stefan MelmukFixed two coding style issues.
--- drivers/cdrom/cdrom.c | 8 +++----- 1 files changed, 3 insertions(+), 5 deletions(-)
drivers/cdrom/cdrom.c +3 -5
@@ -1088,8 +1088,7 @@ int open_for_data(struct cdrom_device_info *cdi) (unsigned int)task_pid_nr(current)); ret=-EMEDIUMTYPE ; goto clean_up_and_return; - } -else { + }else {cdinfo (CD_OPEN ,"wrong media type, but CDO_CHECK_TYPE not set.\n" ); } }
@@ -1363,11 +1362,10 @@ static int cdrom_select_disc(struct cdrom_device_info *cdi, int slot)kfree (info);if (cdi->use_count >1 || keeplocked) { -if (slot ==CDSL_CURRENT ) { +if (slot ==CDSL_CURRENT )return curslot; - }else { +else return -EBUSY ; - } }/* Specifying CDSL_CURRENT will attempt to load the currnet slot,
Signature · 1 line
1.7.0
PATCH 4/8 cdrom: added some spaces to fix coding style issues
In reply to Stefan MelmukAdded required spaces around binary operators and after commas.
--- drivers/cdrom/cdrom.c | 66 ++++++++++++++++++++++++------------------------ 1 files changed, 33 insertions(+), 33 deletions(-)
drivers/cdrom/cdrom.c +33 -33
@@ -288,7 +288,7 @@ static int debug;/* used to keep tray locked at all times */ static int keeplocked;/* default compatibility mode */ -static int autoclose=1 ; +static int autoclose =1 ;static int autoeject;static int lockdoor =1 ;/* will we ever get to use this... sigh. */
@@ -313,9 +313,9 @@ static const char *mrw_format_status[] = {static const char *mrw_address_space[] = {"DMA" ,"GAA" }; -#if (ERRLOGMASK !=CD_NOTHING ) +#if (ERRLOGMASK !=CD_NOTHING ) #define cdinfo(type, fmt, args...) \ - if ((ERRLOGMASK & type) || debug==1 ) \ + if ((ERRLOGMASK & type) || debug == 1 ) \ printk(KERN_INFO "cdrom: " fmt, ## args)#else #define cdinfo(type, fmt, args...)
@@ -335,7 +335,7 @@ static const char *mrw_address_space[] = { "DMA", "GAA" };#define CDROM_CAN (type) (cdi->ops->capability & ~cdi->mask & (type))/* used in the audio ioctls */ -#define CHECKAUDIO if ((ret=check_for_audio_disc(cdi, cdo))) return ret +#define CHECKAUDIO if ((ret = check_for_audio_disc(cdi, cdo))) return ret/* * Another popular OS uses 7 seconds as the hard timeout for default
@@ -413,13 +413,13 @@ int register_cdrom(struct cdrom_device_info *cdi) cdo->n_minors =0 ; cdi->options =CDO_USE_FFLAGS ; -if (autoclose==1 &&CDROM_CAN (CDC_CLOSE_TRAY )) +if (autoclose ==1 &&CDROM_CAN (CDC_CLOSE_TRAY )) cdi->options |= (int )CDO_AUTO_CLOSE ; -if (autoeject==1 &&CDROM_CAN (CDC_OPEN_TRAY )) +if (autoeject ==1 &&CDROM_CAN (CDC_OPEN_TRAY )) cdi->options |= (int )CDO_AUTO_EJECT ; -if (lockdoor==1 ) +if (lockdoor ==1 ) cdi->options |= (int )CDO_LOCK ; -if (check_media_type==1 ) +if (check_media_type ==1 ) cdi->options |= (int )CDO_CHECK_TYPE ;if (CDROM_CAN (CDC_MRW_W ))
@@ -617,7 +617,7 @@ static int cdrom_mrw_exit(struct cdrom_device_info *cdi)int ret; ret =cdrom_get_disc_info (cdi, &di); -if (ret <0 || ret < (int )offsetof(typeof (di ),disc_type)) +if (ret <0 || ret < (int )offsetof(typeof (di ), disc_type))return 1 ; ret =0 ;
@@ -767,7 +767,7 @@ static int cdrom_mrw_open_write(struct cdrom_device_info *cdi) } ret =cdrom_get_disc_info (cdi, &di); -if (ret <0 || ret < offsetof(typeof (di ),disc_type)) +if (ret <0 || ret < offsetof(typeof (di ), disc_type))return 1 ;if (!di.erasable)
@@ -1038,7 +1038,7 @@ int open_for_data(struct cdrom_device_info *cdi)if (CDROM_CAN (CDC_CLOSE_TRAY ) && cdi->options &CDO_AUTO_CLOSE ) {cdinfo (CD_OPEN ,"trying to close the tray.\n" ); - ret=cdo->tray_move (cdi,0 ); + ret = cdo->tray_move (cdi,0 );if (ret) {cdinfo (CD_OPEN ,"bummer. tried to close the tray but failed.\n" );/* Ignore the error from the low
@@ -1046,27 +1046,27 @@ int open_for_data(struct cdrom_device_info *cdi)couldn't close the tray. We only care that there is no disc in the drive, since that is the _REAL_ problem here.*/ - ret=-ENOMEDIUM ; + ret = -ENOMEDIUM ; goto clean_up_and_return; } }else {cdinfo (CD_OPEN ,"bummer. this drive can't close the tray.\n" ); - ret=-ENOMEDIUM ; + ret = -ENOMEDIUM ; goto clean_up_and_return; }/* Ok, the door should be closed now.. Check again */ ret = cdo->drive_status (cdi,CDSL_CURRENT ); -if ((ret ==CDS_NO_DISC ) || (ret==CDS_TRAY_OPEN )) { +if ((ret ==CDS_NO_DISC ) || (ret ==CDS_TRAY_OPEN )) {cdinfo (CD_OPEN ,"bummer. the tray is still not closed.\n" );cdinfo (CD_OPEN ,"tray might not contain a medium.\n" ); - ret=-ENOMEDIUM ; + ret = -ENOMEDIUM ; goto clean_up_and_return; }cdinfo (CD_OPEN ,"the tray is now closed.\n" ); }/* the door should be closed now, check for the disc */ ret = cdo->drive_status (cdi,CDSL_CURRENT ); -if (ret!=CDS_DISC_OK ) { +if (ret !=CDS_DISC_OK ) { ret = -ENOMEDIUM ; goto clean_up_and_return; }
@@ -1074,19 +1074,19 @@ int open_for_data(struct cdrom_device_info *cdi)cdrom_count_tracks (cdi, &tracks);if (tracks.error ==CDS_NO_DISC ) {cdinfo (CD_OPEN ,"bummer. no disc.\n" ); - ret=-ENOMEDIUM ; + ret = -ENOMEDIUM ; goto clean_up_and_return; }/* CD-Players which don't use O_NONBLOCK, workman * for example, need bit CDO_CHECK_TYPE cleared! */ -if (tracks.data==0 ) { +if (tracks.data ==0 ) {if (cdi->options &CDO_CHECK_TYPE ) {/* give people a warning shot, now that CDO_CHECK_TYPE is the default case! */ cdinfo (CD_OPEN ,"bummer. wrong media type.\n" );cdinfo (CD_WARNING ,"pid %d must open device O_NONBLOCK!\n" , (unsigned int )task_pid_nr (current)); - ret=-EMEDIUMTYPE ; + ret = -EMEDIUMTYPE ; goto clean_up_and_return; }else {cdinfo (CD_OPEN ,"wrong media type, but CDO_CHECK_TYPE not set.\n" );
@@ -1146,7 +1146,7 @@ static int check_for_audio_disc(struct cdrom_device_info *cdi,if (CDROM_CAN (CDC_CLOSE_TRAY ) && cdi->options &CDO_AUTO_CLOSE ) {cdinfo (CD_OPEN ,"trying to close the tray.\n" ); - ret=cdo->tray_move (cdi,0 ); + ret = cdo->tray_move (cdi,0 );if (ret) {cdinfo (CD_OPEN ,"bummer. tried to close tray but failed.\n" );/* Ignore the error from the low
@@ -1162,11 +1162,11 @@ static int check_for_audio_disc(struct cdrom_device_info *cdi, }/* Ok, the door should be closed now.. Check again */ ret = cdo->drive_status (cdi,CDSL_CURRENT ); -if ((ret ==CDS_NO_DISC ) || (ret==CDS_TRAY_OPEN )) { +if ((ret ==CDS_NO_DISC ) || (ret ==CDS_TRAY_OPEN )) {cdinfo (CD_OPEN ,"bummer. the tray is still not closed.\n" );return -ENOMEDIUM ; } -if (ret!=CDS_DISC_OK ) { +if (ret !=CDS_DISC_OK ) {cdinfo (CD_OPEN ,"bummer. disc isn't ready.\n" );return -EIO ; }
@@ -1177,7 +1177,7 @@ static int check_for_audio_disc(struct cdrom_device_info *cdi,if (tracks.error)return (tracks.error); -if (tracks.audio==0 ) +if (tracks.audio ==0 )return -EMEDIUMTYPE ;return 0 ;
@@ -1426,11 +1426,11 @@ static void cdrom_count_tracks(struct cdrom_device_info *cdi, tracktype* tracks)struct cdrom_tochdr header;struct cdrom_tocentry entry;int ret, i; - tracks->data=0 ; - tracks->audio=0 ; - tracks->cdi=0 ; - tracks->xa=0 ; - tracks->error=0 ; + tracks->data =0 ; + tracks->audio =0 ; + tracks->cdi =0 ; + tracks->xa =0 ; + tracks->error =0 ;cdinfo (CD_COUNT_TRACKS ,"entering cdrom_count_tracks\n" );/* Grab the TOC header so we can see how many tracks there are */ if ((ret = cdi->ops->audio_ioctl (cdi,CDROMREADTOCHDR , &header))) {
@@ -1445,7 +1445,7 @@ static void cdrom_count_tracks(struct cdrom_device_info *cdi, tracktype* tracks)for (i = header.cdth_trk0; i <= header.cdth_trk1; i++) { entry.cdte_track = i;if (cdi->ops->audio_ioctl (cdi,CDROMREADTOCENTRY , &entry)) { - tracks->error=CDS_NO_INFO ; + tracks->error =CDS_NO_INFO ;return ; }if (entry.cdte_ctrl &CDROM_DATA_TRACK ) {
@@ -1515,8 +1515,8 @@ void init_cdrom_command(struct packet_command *cgc, void *buf, int len,/* DVD handling */ -#define copy_key (dest,src) memcpy((dest), (src), sizeof(dvd_key)) -#define copy_chal (dest,src) memcpy((dest), (src), sizeof(dvd_challenge)) +#define copy_key (dest, src) memcpy((dest), (src), sizeof(dvd_key)) +#define copy_chal (dest, src) memcpy((dest), (src), sizeof(dvd_challenge))static void setup_report_key (struct packet_command *cgc,unsigned agid,unsigned type) {
@@ -2501,7 +2501,7 @@ static int cdrom_ioctl_disc_status(struct cdrom_device_info *cdi)return CDS_DATA_1 ;/* Policy mode off */ -cdinfo (CD_WARNING ,"This disc doesn't have any tracks I recognize!\n" ); +cdinfo (CD_WARNING ,"This disc doesn't have any tracks I recognize!\n" );return CDS_NO_INFO ; }
@@ -3248,7 +3248,7 @@ int cdrom_get_last_written(struct cdrom_device_info *cdi, long *last_written)/* if this track is blank, try the previous. */ if (ti.blank) { -if (last_track==1 ) +if (last_track ==1 ) goto use_toc; last_track--; ti_size =cdrom_get_track_info (cdi, last_track,1 , &ti);
Signature · 1 line
1.7.0
PATCH 5/8 cdrom: fixed assignment in if condition style issues
In reply to Stefan MelmukFixed all assignments in conditions errors.
--- drivers/cdrom/cdrom.c | 96 ++++++++++++++++++++++++++++++++---------------- 1 files changed, 64 insertions(+), 32 deletions(-)
drivers/cdrom/cdrom.c +64 -32
@@ -524,7 +524,8 @@ static int cdrom_is_mrw(struct cdrom_device_info *cdi, int *write) cgc.cmd[8 ] =sizeof (buffer); cgc.quiet =1 ; -if ((ret = cdi->ops->generic_packet (cdi, &cgc))) + ret = cdi->ops->generic_packet (cdi, &cgc); +if (ret)return ret; mfd = (struct mrw_feature_desc *)&buffer[sizeof (struct feature_header )];
@@ -532,7 +533,8 @@ static int cdrom_is_mrw(struct cdrom_device_info *cdi, int *write)return 1 ; *write = mfd->write; -if ((ret =cdrom_mrw_probe_pc (cdi))) { + ret =cdrom_mrw_probe_pc (cdi); +if (ret) { *write =0 ;return ret; }
@@ -645,7 +647,8 @@ static int cdrom_mrw_set_lba_space(struct cdrom_device_info *cdi, int space) cgc.buffer = buffer; cgc.buflen =sizeof (buffer); -if ((ret =cdrom_mode_sense (cdi, &cgc, cdi->mrw_mode_page,0 ))) + ret =cdrom_mode_sense (cdi, &cgc, cdi->mrw_mode_page,0 ); +if (ret)return ret; mph = (struct mode_page_header *) buffer;
@@ -655,7 +658,8 @@ static int cdrom_mrw_set_lba_space(struct cdrom_device_info *cdi, int space) buffer[offset +3 ] = space; cgc.buflen = size; -if ((ret =cdrom_mode_select (cdi, &cgc))) + ret =cdrom_mode_select (cdi, &cgc); +if (ret)return ret;printk (KERN_INFO "cdrom: %s: mrw address space %s selected\n" , cdi->name, mrw_address_space[space]);
@@ -676,7 +680,8 @@ static int cdrom_get_random_writable(struct cdrom_device_info *cdi, cgc.cmd[8 ] =sizeof (buffer);/* often 0x18 */ cgc.quiet =1 ; -if ((ret = cdi->ops->generic_packet (cdi, &cgc))) + ret = cdi->ops->generic_packet (cdi, &cgc); +if (ret)return ret;memcpy (rfd, &buffer[sizeof (struct feature_header )],sizeof (*rfd));
@@ -697,7 +702,8 @@ static int cdrom_has_defect_mgt(struct cdrom_device_info *cdi) cgc.cmd[8 ] =sizeof (buffer); cgc.quiet =1 ; -if ((ret = cdi->ops->generic_packet (cdi, &cgc))) + ret = cdi->ops->generic_packet (cdi, &cgc); +if (ret)return ret; feature_code = (__be16 *) &buffer[sizeof (struct feature_header )];
@@ -715,7 +721,8 @@ static int cdrom_is_random_writable(struct cdrom_device_info *cdi, int *write) *write =0 ; -if ((ret =cdrom_get_random_writable (cdi, &rfd))) + ret =cdrom_get_random_writable (cdi, &rfd); +if (ret)return ret;if (CDF_RWRT ==be16_to_cpu (rfd.feature_code))
@@ -826,10 +833,12 @@ static int cdrom_ram_open_write(struct cdrom_device_info *cdi)struct rwrt_feature_desc rfd;int ret; -if ((ret =cdrom_has_defect_mgt (cdi))) + ret =cdrom_has_defect_mgt (cdi); +if (ret)return ret; -if ((ret =cdrom_get_random_writable (cdi, &rfd))) + ret =cdrom_get_random_writable (cdi, &rfd); +if (ret)return ret;else if (CDF_RWRT ==be16_to_cpu (rfd.feature_code)) ret = !rfd.curr;
@@ -852,7 +861,8 @@ static void cdrom_mmc3_profile(struct cdrom_device_info *cdi) cgc.cmd[8 ] =sizeof (buffer);/* Allocation Length */ cgc.quiet =1 ; -if ((ret = cdi->ops->generic_packet (cdi, &cgc))) + ret = cdi->ops->generic_packet (cdi, &cgc); +if (ret) mmc3_profile =0xffff ;else mmc3_profile = (buffer[6 ] <<8 ) | buffer[7 ];
@@ -1265,7 +1275,8 @@ static int cdrom_slot_status(struct cdrom_device_info *cdi, int slot)if (!info)return -ENOMEM ; -if ((ret =cdrom_read_mech_status (cdi, info))) + ret =cdrom_read_mech_status (cdi, info); +if (ret) goto out_free;if (info->slots[slot].disc_present)
@@ -1295,7 +1306,8 @@ int cdrom_number_of_slots(struct cdrom_device_info *cdi)if (!info)return -ENOMEM ; -if ((status =cdrom_read_mech_status (cdi, info)) ==0 ) + status =cdrom_read_mech_status (cdi, info); +if (status ==0 ) nslots = info->hdr.nslots;kfree (info);
@@ -1353,7 +1365,8 @@ static int cdrom_select_disc(struct cdrom_device_info *cdi, int slot)if (!info)return -ENOMEM ; -if ((ret =cdrom_read_mech_status (cdi, info))) { + ret =cdrom_read_mech_status (cdi, info); +if (ret) {kfree (info);return ret; }
@@ -1378,7 +1391,8 @@ static int cdrom_select_disc(struct cdrom_device_info *cdi, int slot)/* set media changed bits on both queues */ cdi->mc_flags =0x3 ; -if ((ret =cdrom_load_unload (cdi, slot))) + ret =cdrom_load_unload (cdi, slot); +if (ret)return ret;return slot;
@@ -1433,7 +1447,8 @@ static void cdrom_count_tracks(struct cdrom_device_info *cdi, tracktype* tracks) tracks->error =0 ;cdinfo (CD_COUNT_TRACKS ,"entering cdrom_count_tracks\n" );/* Grab the TOC header so we can see how many tracks there are */ -if ((ret = cdi->ops->audio_ioctl (cdi,CDROMREADTOCHDR , &header))) { + ret = cdi->ops->audio_ioctl (cdi,CDROMREADTOCHDR , &header); +if (ret) {if (ret == -ENOMEDIUM ) tracks->error =CDS_NO_DISC ;else
@@ -1580,7 +1595,8 @@ static int dvd_do_auth(struct cdrom_device_info *cdi, dvd_authinfo *ai) cgc.quiet =1 ;setup_report_key (&cgc, ai->lsa.agid,0 ); -if ((ret = cdo->generic_packet (cdi, &cgc))) + ret = cdo->generic_packet (cdi, &cgc); +if (ret)return ret; ai->lsa.agid = buf[7 ] >>6 ;
@@ -1591,7 +1607,8 @@ static int dvd_do_auth(struct cdrom_device_info *cdi, dvd_authinfo *ai)cdinfo (CD_DVD ,"entering DVD_LU_SEND_KEY1\n" );setup_report_key (&cgc, ai->lsk.agid,2 ); -if ((ret = cdo->generic_packet (cdi, &cgc))) + ret = cdo->generic_packet (cdi, &cgc); +if (ret)return ret;copy_key (ai->lsk.key, &buf[4 ]);
@@ -1602,7 +1619,8 @@ static int dvd_do_auth(struct cdrom_device_info *cdi, dvd_authinfo *ai)cdinfo (CD_DVD ,"entering DVD_LU_SEND_CHALLENGE\n" );setup_report_key (&cgc, ai->lsc.agid,1 ); -if ((ret = cdo->generic_packet (cdi, &cgc))) + ret = cdo->generic_packet (cdi, &cgc); +if (ret)return ret;copy_chal (ai->lsc.chal, &buf[4 ]);
@@ -1619,7 +1637,8 @@ static int dvd_do_auth(struct cdrom_device_info *cdi, dvd_authinfo *ai) cgc.cmd[3 ] = ai->lstk.lba >>16 ; cgc.cmd[2 ] = ai->lstk.lba >>24 ; -if ((ret = cdo->generic_packet (cdi, &cgc))) + ret = cdo->generic_packet (cdi, &cgc); +if (ret)return ret; ai->lstk.cpm = (buf[4 ] >>7 ) &1 ;
@@ -1633,7 +1652,8 @@ static int dvd_do_auth(struct cdrom_device_info *cdi, dvd_authinfo *ai)cdinfo (CD_DVD ,"entering DVD_LU_SEND_ASF\n" );setup_report_key (&cgc, ai->lsasf.agid,5 ); -if ((ret = cdo->generic_packet (cdi, &cgc))) + ret = cdo->generic_packet (cdi, &cgc); +if (ret)return ret; ai->lsasf.asf = buf[7 ] &1 ;
@@ -1646,7 +1666,8 @@ static int dvd_do_auth(struct cdrom_device_info *cdi, dvd_authinfo *ai) buf[1 ] =0xe ;copy_chal (&buf[4 ], ai->hsc.chal); -if ((ret = cdo->generic_packet (cdi, &cgc))) + ret = cdo->generic_packet (cdi, &cgc); +if (ret)return ret; ai->type =DVD_LU_SEND_KEY1 ;
@@ -1658,7 +1679,8 @@ static int dvd_do_auth(struct cdrom_device_info *cdi, dvd_authinfo *ai) buf[1 ] =0xa ;copy_key (&buf[4 ], ai->hsk.key); -if ((ret = cdo->generic_packet (cdi, &cgc))) { + ret = cdo->generic_packet (cdi, &cgc); +if (ret) { ai->type =DVD_AUTH_FAILURE ;return ret; }
@@ -1670,7 +1692,8 @@ static int dvd_do_auth(struct cdrom_device_info *cdi, dvd_authinfo *ai) cgc.quiet =1 ;cdinfo (CD_DVD ,"entering DVD_INVALIDATE_AGID\n" );setup_report_key (&cgc, ai->lsa.agid,0x3f ); -if ((ret = cdo->generic_packet (cdi, &cgc))) + ret = cdo->generic_packet (cdi, &cgc); +if (ret)return ret;break ;
@@ -1681,7 +1704,8 @@ static int dvd_do_auth(struct cdrom_device_info *cdi, dvd_authinfo *ai)memset (&rpc_state,0 ,sizeof (rpc_state_t)); cgc.buffer = (char *) &rpc_state; -if ((ret = cdo->generic_packet (cdi, &cgc))) + ret = cdo->generic_packet (cdi, &cgc); +if (ret)return ret; ai->lrpcs.type = rpc_state.type_code;
@@ -1698,7 +1722,8 @@ static int dvd_do_auth(struct cdrom_device_info *cdi, dvd_authinfo *ai) buf[1 ] =6 ; buf[4 ] = ai->hrpcs.pdrc; -if ((ret = cdo->generic_packet (cdi, &cgc))) + ret = cdo->generic_packet (cdi, &cgc); +if (ret)return ret;break ;
@@ -1955,7 +1980,8 @@ static int cdrom_read_subchannel(struct cdrom_device_info *cdi, cgc.cmd[3 ] = mcn ?2 :1 ; cgc.cmd[8 ] =16 ; -if ((ret = cdo->generic_packet (cdi, &cgc))) + ret = cdo->generic_packet (cdi, &cgc); +if (ret)return ret; subchnl->cdsc_audiostatus = cgc.buffer[1 ];
@@ -3172,7 +3198,8 @@ static int cdrom_get_track_info(struct cdrom_device_info *cdi, __u16 track, __u8 cgc.cmd[8 ] =8 ; cgc.quiet =1 ; -if ((ret = cdo->generic_packet (cdi, &cgc))) + ret = cdo->generic_packet (cdi, &cgc); +if (ret)return ret; buflen = be16_to_cpu(ti->track_information_length) +
@@ -3182,7 +3209,8 @@ static int cdrom_get_track_info(struct cdrom_device_info *cdi, __u16 track, __u8 buflen =sizeof (track_information); cgc.cmd[8 ] = cgc.buflen = buflen; -if ((ret = cdo->generic_packet (cdi, &cgc))) + ret = cdo->generic_packet (cdi, &cgc); +if (ret)return ret;/* return actual fill size */
@@ -3202,7 +3230,8 @@ static int cdrom_get_disc_info(struct cdrom_device_info *cdi, disc_information * cgc.cmd[8 ] = cgc.buflen =2 ; cgc.quiet =1 ; -if ((ret = cdo->generic_packet (cdi, &cgc))) + ret = cdo->generic_packet (cdi, &cgc); +if (ret)return ret;/* not all drives have the same disc_info length, so requeue
@@ -3215,7 +3244,8 @@ static int cdrom_get_disc_info(struct cdrom_device_info *cdi, disc_information * buflen =sizeof (disc_information); cgc.cmd[8 ] = cgc.buflen = buflen; -if ((ret = cdo->generic_packet (cdi, &cgc))) + ret = cdo->generic_packet (cdi, &cgc); +if (ret)return ret;/* return actual fill size */
@@ -3278,7 +3308,8 @@ int cdrom_get_last_written(struct cdrom_device_info *cdi, long *last_written) use_toc: toc.cdte_format =CDROM_MSF ; toc.cdte_track =CDROM_LEADOUT ; -if ((ret = cdi->ops->audio_ioctl (cdi,CDROMREADTOCENTRY , &toc))) + ret = cdi->ops->audio_ioctl (cdi,CDROMREADTOCENTRY , &toc); +if (ret)return ret;sanitize_format (&toc.cdte_addr, &toc.cdte_format,CDROM_LBA ); *last_written = toc.cdte_addr.lba;
@@ -3325,7 +3356,8 @@ static int cdrom_get_next_writable(struct cdrom_device_info *cdi, long *next_wri } use_last_written: -if ((ret =cdrom_get_last_written (cdi, next_writable))) { + ret =cdrom_get_last_written (cdi, next_writable); +if (ret) { *next_writable =0 ;return ret; }else {
Signature · 1 line
1.7.0
PATCH 6/8 cdrom: fixed prohibited spaces coding style issues
In reply to Stefan MelmukRemoved all prohibited spaces.
--- drivers/cdrom/cdrom.c | 25 ++++++++++++++++--------- 1 files changed, 16 insertions(+), 9 deletions(-)
drivers/cdrom/cdrom.c +16 -9
@@ -315,7 +315,7 @@ static const char *mrw_address_space[] = { "DMA", "GAA" };#if (ERRLOGMASK !=CD_NOTHING ) #define cdinfo(type, fmt, args...) \ - if ((ERRLOGMASK & type) || debug == 1 ) \ + if ((ERRLOGMASK & type) || debug == 1) \ printk(KERN_INFO "cdrom: " fmt, ## args)#else #define cdinfo(type, fmt, args...)
@@ -323,11 +323,11 @@ static const char *mrw_address_space[] = { "DMA", "GAA" };/* These are used to simplify getting data in from and back to user land */ #define IOCTL_IN (arg, type, in) \ - if (copy_from_user(&(in), (type __user *) (arg), sizeof (in))) \ + if (copy_from_user(&(in), (type __user *) (arg), sizeof(in))) \ return -EFAULT;#define IOCTL_OUT (arg, type, out) \ - if (copy_to_user((type __user *) (arg), &(out), sizeof (out))) \ + if (copy_to_user((type __user *) (arg), &(out), sizeof(out))) \ return -EFAULT;/* The (cdo->capability & ~cdi->mask & CDC_XXX) construct was used in
@@ -400,7 +400,7 @@ int register_cdrom(struct cdrom_device_info *cdi)cdrom_sysctl_register (); } -ENSURE (drive_status,CDC_DRIVE_STATUS ); +ENSURE (drive_status,CDC_DRIVE_STATUS );ENSURE (media_changed,CDC_MEDIA_CHANGED );ENSURE (tray_move,CDC_CLOSE_TRAY |CDC_OPEN_TRAY );ENSURE (lock_door,CDC_LOCK );
@@ -684,7 +684,7 @@ static int cdrom_get_random_writable(struct cdrom_device_info *cdi,if (ret)return ret; -memcpy (rfd, &buffer[sizeof (struct feature_header )],sizeof (*rfd)); +memcpy (rfd, &buffer[sizeof (struct feature_header )],sizeof (*rfd));return 0 ; }
@@ -2046,10 +2046,17 @@ static int cdrom_read_block(struct cdrom_device_info *cdi,/* set the header info returned */ switch (blksize) { -case CD_FRAMESIZE_RAW0 : cgc->cmd[9 ] =0x58 ;break ; -case CD_FRAMESIZE_RAW1 : cgc->cmd[9 ] =0x78 ;break ; -case CD_FRAMESIZE_RAW : cgc->cmd[9 ] =0xf8 ;break ; -default : cgc->cmd[9 ] =0x10 ; +case CD_FRAMESIZE_RAW0 : + cgc->cmd[9 ] =0x58 ; +break ; +case CD_FRAMESIZE_RAW1 : + cgc->cmd[9 ] =0x78 ; +break ; +case CD_FRAMESIZE_RAW : + cgc->cmd[9 ] =0xf8 ; +break ; +default : + cgc->cmd[9 ] =0x10 ; }return cdo->generic_packet (cdi, cgc);
Signature · 1 line
1.7.0
PATCH 7/8 cdrom: fixed indentation coding style issues
In reply to Stefan MelmukFixed all indentation coding style issues
--- drivers/cdrom/cdrom.c | 30 +++++++++++++++--------------- 1 files changed, 15 insertions(+), 15 deletions(-)
drivers/cdrom/cdrom.c +15 -15
@@ -315,8 +315,8 @@ static const char *mrw_address_space[] = { "DMA", "GAA" };#if (ERRLOGMASK !=CD_NOTHING ) #define cdinfo(type, fmt, args...) \ - if ((ERRLOGMASK & type) || debug == 1) \ - printk(KERN_INFO "cdrom: " fmt, ## args) + if ((ERRLOGMASK & type) || debug == 1) \ + printk(KERN_INFO "cdrom: " fmt, ## args)#else #define cdinfo(type, fmt, args...)#endif
@@ -387,8 +387,8 @@ static int cdrom_dummy_generic_packet(struct cdrom_device_info *cdi,int register_cdrom (struct cdrom_device_info *cdi) {static char banner_printed; -struct cdrom_device_ops *cdo = cdi->ops; -int *change_capability = (int *)&cdo->capability;/* hack */ +struct cdrom_device_ops *cdo = cdi->ops; +int *change_capability = (int *)&cdo->capability;/* hack */ cdinfo (CD_OPEN ,"entering register_cdrom\n" );
@@ -411,7 +411,7 @@ int register_cdrom(struct cdrom_device_info *cdi)ENSURE (generic_packet,CDC_GENERIC_PACKET ); cdi->mc_flags =0 ; cdo->n_minors =0 ; - cdi->options =CDO_USE_FFLAGS ; + cdi->options =CDO_USE_FFLAGS ;if (autoclose ==1 &&CDROM_CAN (CDC_CLOSE_TRAY )) cdi->options |= (int )CDO_AUTO_CLOSE ;
@@ -917,9 +917,9 @@ static int cdrom_open_write(struct cdrom_device_info *cdi) ret =cdrom_mrw_open_write (cdi); else if (CDROM_CAN(CDC_DVD_RAM)) ret =cdrom_dvdram_open_write (cdi); - else if (CDROM_CAN(CDC_RAM) && - !CDROM_CAN(CDC_CD_R|CDC_CD_RW|CDC_DVD|CDC_DVD_R|CDC_MRW|CDC_MO_DRIVE)) - ret =cdrom_ram_open_write (cdi); + else if (CDROM_CAN(CDC_RAM) && + !CDROM_CAN(CDC_CD_R|CDC_CD_RW|CDC_DVD|CDC_DVD_R|CDC_MRW|CDC_MO_DRIVE)) + ret =cdrom_ram_open_write (cdi); else if (CDROM_CAN(CDC_MO_DRIVE)) ret =mo_open_write (cdi); else if (!cdrom_is_dvd_rw(cdi))
@@ -1142,7 +1142,7 @@ clean_up_and_return:static int check_for_audio_disc (struct cdrom_device_info *cdi,struct cdrom_device_ops *cdo) { -int ret; +int ret;tracktype tracks;cdinfo (CD_OPEN ,"entering check_for_audio_disc\n" );if (!(cdi->options &CDO_CHECK_TYPE ))
@@ -1185,7 +1185,7 @@ static int check_for_audio_disc(struct cdrom_device_info *cdi, }cdrom_count_tracks (cdi, &tracks);if (tracks.error) -return (tracks.error); +return tracks.error;if (tracks.audio ==0 )return -EMEDIUMTYPE ;
@@ -1376,7 +1376,7 @@ static int cdrom_select_disc(struct cdrom_device_info *cdi, int slot)if (cdi->use_count >1 || keeplocked) {if (slot ==CDSL_CURRENT ) -return curslot; +return curslot;else return -EBUSY ; }
@@ -2447,7 +2447,7 @@ static int cdrom_ioctl_debug(struct cdrom_device_info *cdi,static int cdrom_ioctl_get_capability (struct cdrom_device_info *cdi) {cdinfo (CD_DO_IOCTL ,"entering CDROM_GET_CAPABILITY\n" ); -return (cdi->ops->capability & ~cdi->mask); +return cdi->ops->capability & ~cdi->mask; }/*
@@ -3345,7 +3345,7 @@ static int cdrom_get_next_writable(struct cdrom_device_info *cdi, long *next_wriif (ti_size <0 || ti_size < offsetof(typeof (ti ), track_start)) goto use_last_written; -/* if this track is blank, try the previous. */ +/* if this track is blank, try the previous. */ if (ti.blank) {if (last_track ==1 ) goto use_last_written;
@@ -3450,7 +3450,7 @@ static int cdrom_print_info(const char *header, int val, char *info, }static int cdrom_sysctl_info (ctl_table *ctl,int write, -void __user *buffer,size_t *lenp,loff_t *ppos) +void __user *buffer,size_t *lenp,loff_t *ppos) {int pos;char *info = cdrom_sysctl_settings.info;
@@ -3584,7 +3584,7 @@ static int cdrom_sysctl_handler(ctl_table *ctl, int write,cdrom_update_settings (); } -return ret; +return ret; }/* Place files in /proc/sys/dev/cdrom */
Signature · 1 line
1.7.0
PATCH 8/8 cdrom: fixed EXPORT_SYMBOL coding style issue
In reply to Stefan MelmukFixed all EXPORT_SYMBOL(foo) coding style warnings.
--- drivers/cdrom/cdrom.c | 24 ++++++++++++------------ 1 files changed, 12 insertions(+), 12 deletions(-)
drivers/cdrom/cdrom.c +12 -12
@@ -439,6 +439,7 @@ int register_cdrom(struct cdrom_device_info *cdi)mutex_unlock (&cdrom_mutex);return 0 ; } +EXPORT_SYMBOL (register_cdrom);#undef ENSUREvoid unregister_cdrom (struct cdrom_device_info *cdi)
@@ -455,6 +456,7 @@ void unregister_cdrom(struct cdrom_device_info *cdi) cdi->ops->n_minors--;cdinfo (CD_REG_UNREG ,"drive \"/dev/%s\" unregistered\n" , cdi->name); } +EXPORT_SYMBOL (unregister_cdrom);int cdrom_get_media_event (struct cdrom_device_info *cdi,struct media_event_desc *med)
@@ -482,6 +484,7 @@ int cdrom_get_media_event(struct cdrom_device_info *cdi,memcpy (med, &buffer[sizeof (*eh)],sizeof (*med));return 0 ; } +EXPORT_SYMBOL (cdrom_get_media_event);/* * the first prototypes used 0x2c as the page code for the mrw mode page,
@@ -1029,6 +1032,7 @@ err: cdi->use_count--;return ret; } +EXPORT_SYMBOL (cdrom_open);static int open_for_data (struct cdrom_device_info *cdi)
@@ -1229,6 +1233,7 @@ void cdrom_release(struct cdrom_device_info *cdi, fmode_t mode) cdo->tray_move (cdi,1 ); } } +EXPORT_SYMBOL (cdrom_release);static int cdrom_read_mech_status (struct cdrom_device_info *cdi,struct cdrom_changer_info *buf)
@@ -1313,6 +1318,7 @@ int cdrom_number_of_slots(struct cdrom_device_info *cdi)kfree (info);return nslots; } +EXPORT_SYMBOL (cdrom_number_of_slots);/* If SLOT < 0, unload the current slot. Otherwise, try to load SLOT. */
@@ -1433,6 +1439,7 @@ int cdrom_media_changed(struct cdrom_device_info *cdi)return 0 ;return media_changed (cdi,0 ); } +EXPORT_SYMBOL (cdrom_media_changed);/* badly broken, I know. Is due for a fixup anytime. */ static void cdrom_count_tracks (struct cdrom_device_info *cdi,tracktype * tracks)
@@ -1527,6 +1534,7 @@ void init_cdrom_command(struct packet_command *cgc, void *buf, int len, cgc->data_direction = type; cgc->timeout =CDROM_DEF_TIMEOUT ; } +EXPORT_SYMBOL (init_cdrom_command);/* DVD handling */
@@ -1949,6 +1957,7 @@ int cdrom_mode_sense(struct cdrom_device_info *cdi, cgc->data_direction =CGC_DATA_READ ;return cdo->generic_packet (cdi, cgc); } +EXPORT_SYMBOL (cdrom_mode_sense);int cdrom_mode_select (struct cdrom_device_info *cdi,struct packet_command *cgc)
@@ -1964,6 +1973,7 @@ int cdrom_mode_select(struct cdrom_device_info *cdi, cgc->data_direction =CGC_DATA_WRITE ;return cdo->generic_packet (cdi, cgc); } +EXPORT_SYMBOL (cdrom_mode_select);static int cdrom_read_subchannel (struct cdrom_device_info *cdi,struct cdrom_subchnl *subchnl,int mcn)
@@ -2802,6 +2812,7 @@ int cdrom_ioctl(struct cdrom_device_info *cdi, struct block_device *bdev,return -ENOSYS ; } +EXPORT_SYMBOL (cdrom_ioctl);/* * Required when we need to use READ_10 to issue other than 2048 block
@@ -3322,6 +3333,7 @@ use_toc: *last_written = toc.cdte_addr.lba;return 0 ; } +EXPORT_SYMBOL (cdrom_get_last_written);/* return the next writable block. also for udf file system. */ static int cdrom_get_next_writable (struct cdrom_device_info *cdi,long *next_writable)
@@ -3373,18 +3385,6 @@ use_last_written: } } -EXPORT_SYMBOL (cdrom_get_last_written); -EXPORT_SYMBOL (register_cdrom); -EXPORT_SYMBOL (unregister_cdrom); -EXPORT_SYMBOL (cdrom_open); -EXPORT_SYMBOL (cdrom_release); -EXPORT_SYMBOL (cdrom_ioctl); -EXPORT_SYMBOL (cdrom_media_changed); -EXPORT_SYMBOL (cdrom_number_of_slots); -EXPORT_SYMBOL (cdrom_mode_select); -EXPORT_SYMBOL (cdrom_mode_sense); -EXPORT_SYMBOL (init_cdrom_command); -EXPORT_SYMBOL (cdrom_get_media_event);#ifdef CONFIG_SYSCTL
Signature · 1 line
1.7.0