diff options
| author | Joe Perches <joe@perches.com> | 2014-05-04 20:05:05 -0400 |
|---|---|---|
| committer | Jens Axboe <axboe@fb.com> | 2014-05-05 16:58:05 -0400 |
| commit | 82b91540ba24a1295c82572b922d50cbcf48fcee (patch) | |
| tree | 5ac9ccfbd0b7e53e7492d15b2fd8431128453c38 /drivers/cdrom | |
| parent | a09c391df309c846b7c49771526acd311ccbc93e (diff) | |
cdrom: Remove prototype for open_for_data
Move static function to the appropriate place to remove
the now unnecessary prototype.
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/cdrom')
| -rw-r--r-- | drivers/cdrom/cdrom.c | 114 |
1 files changed, 57 insertions, 57 deletions
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c index 47dee5ed5cba..5a38b5681ca3 100644 --- a/drivers/cdrom/cdrom.c +++ b/drivers/cdrom/cdrom.c | |||
| @@ -337,7 +337,6 @@ do { \ | |||
| 337 | #define CDROM_DEF_TIMEOUT (7 * HZ) | 337 | #define CDROM_DEF_TIMEOUT (7 * HZ) |
| 338 | 338 | ||
| 339 | /* Not-exported routines. */ | 339 | /* Not-exported routines. */ |
| 340 | static int open_for_data(struct cdrom_device_info * cdi); | ||
| 341 | static int check_for_audio_disc(struct cdrom_device_info * cdi, | 340 | static int check_for_audio_disc(struct cdrom_device_info * cdi, |
| 342 | struct cdrom_device_ops * cdo); | 341 | struct cdrom_device_ops * cdo); |
| 343 | static void sanitize_format(union cdrom_addr *addr, | 342 | static void sanitize_format(union cdrom_addr *addr, |
| @@ -957,63 +956,8 @@ static int cdrom_close_write(struct cdrom_device_info *cdi) | |||
| 957 | #endif | 956 | #endif |
| 958 | } | 957 | } |
| 959 | 958 | ||
| 960 | /* We use the open-option O_NONBLOCK to indicate that the | ||
| 961 | * purpose of opening is only for subsequent ioctl() calls; no device | ||
| 962 | * integrity checks are performed. | ||
| 963 | * | ||
| 964 | * We hope that all cd-player programs will adopt this convention. It | ||
| 965 | * is in their own interest: device control becomes a lot easier | ||
| 966 | * this way. | ||
| 967 | */ | ||
| 968 | int cdrom_open(struct cdrom_device_info *cdi, struct block_device *bdev, fmode_t mode) | ||
| 969 | { | ||
| 970 | int ret; | ||
| 971 | |||
| 972 | cd_dbg(CD_OPEN, "entering cdrom_open\n"); | ||
| 973 | |||
| 974 | /* open is event synchronization point, check events first */ | ||
| 975 | check_disk_change(bdev); | ||
| 976 | |||
| 977 | /* if this was a O_NONBLOCK open and we should honor the flags, | ||
| 978 | * do a quick open without drive/disc integrity checks. */ | ||
| 979 | cdi->use_count++; | ||
| 980 | if ((mode & FMODE_NDELAY) && (cdi->options & CDO_USE_FFLAGS)) { | ||
| 981 | ret = cdi->ops->open(cdi, 1); | ||
| 982 | } else { | ||
| 983 | ret = open_for_data(cdi); | ||
| 984 | if (ret) | ||
| 985 | goto err; | ||
| 986 | cdrom_mmc3_profile(cdi); | ||
| 987 | if (mode & FMODE_WRITE) { | ||
| 988 | ret = -EROFS; | ||
| 989 | if (cdrom_open_write(cdi)) | ||
| 990 | goto err_release; | ||
| 991 | if (!CDROM_CAN(CDC_RAM)) | ||
| 992 | goto err_release; | ||
| 993 | ret = 0; | ||
| 994 | cdi->media_written = 0; | ||
| 995 | } | ||
| 996 | } | ||
| 997 | |||
| 998 | if (ret) | ||
| 999 | goto err; | ||
| 1000 | |||
| 1001 | cd_dbg(CD_OPEN, "Use count for \"/dev/%s\" now %d\n", | ||
| 1002 | cdi->name, cdi->use_count); | ||
| 1003 | return 0; | ||
| 1004 | err_release: | ||
| 1005 | if (CDROM_CAN(CDC_LOCK) && cdi->options & CDO_LOCK) { | ||
| 1006 | cdi->ops->lock_door(cdi, 0); | ||
| 1007 | cd_dbg(CD_OPEN, "door unlocked\n"); | ||
| 1008 | } | ||
| 1009 | cdi->ops->release(cdi); | ||
| 1010 | err: | ||
| 1011 | cdi->use_count--; | ||
| 1012 | return ret; | ||
| 1013 | } | ||
| 1014 | |||
| 1015 | static | 959 | static |
| 1016 | int open_for_data(struct cdrom_device_info * cdi) | 960 | int open_for_data(struct cdrom_device_info *cdi) |
| 1017 | { | 961 | { |
| 1018 | int ret; | 962 | int ret; |
| 1019 | struct cdrom_device_ops *cdo = cdi->ops; | 963 | struct cdrom_device_ops *cdo = cdi->ops; |
| @@ -1119,6 +1063,62 @@ clean_up_and_return: | |||
| 1119 | return ret; | 1063 | return ret; |
| 1120 | } | 1064 | } |
| 1121 | 1065 | ||
| 1066 | /* We use the open-option O_NONBLOCK to indicate that the | ||
| 1067 | * purpose of opening is only for subsequent ioctl() calls; no device | ||
| 1068 | * integrity checks are performed. | ||
| 1069 | * | ||
| 1070 | * We hope that all cd-player programs will adopt this convention. It | ||
| 1071 | * is in their own interest: device control becomes a lot easier | ||
| 1072 | * this way. | ||
| 1073 | */ | ||
| 1074 | int cdrom_open(struct cdrom_device_info *cdi, struct block_device *bdev, | ||
| 1075 | fmode_t mode) | ||
| 1076 | { | ||
| 1077 | int ret; | ||
| 1078 | |||
| 1079 | cd_dbg(CD_OPEN, "entering cdrom_open\n"); | ||
| 1080 | |||
| 1081 | /* open is event synchronization point, check events first */ | ||
| 1082 | check_disk_change(bdev); | ||
| 1083 | |||
| 1084 | /* if this was a O_NONBLOCK open and we should honor the flags, | ||
| 1085 | * do a quick open without drive/disc integrity checks. */ | ||
| 1086 | cdi->use_count++; | ||
| 1087 | if ((mode & FMODE_NDELAY) && (cdi->options & CDO_USE_FFLAGS)) { | ||
| 1088 | ret = cdi->ops->open(cdi, 1); | ||
| 1089 | } else { | ||
| 1090 | ret = open_for_data(cdi); | ||
| 1091 | if (ret) | ||
| 1092 | goto err; | ||
| 1093 | cdrom_mmc3_profile(cdi); | ||
| 1094 | if (mode & FMODE_WRITE) { | ||
| 1095 | ret = -EROFS; | ||
| 1096 | if (cdrom_open_write(cdi)) | ||
| 1097 | goto err_release; | ||
| 1098 | if (!CDROM_CAN(CDC_RAM)) | ||
| 1099 | goto err_release; | ||
| 1100 | ret = 0; | ||
| 1101 | cdi->media_written = 0; | ||
| 1102 | } | ||
| 1103 | } | ||
| 1104 | |||
| 1105 | if (ret) | ||
| 1106 | goto err; | ||
| 1107 | |||
| 1108 | cd_dbg(CD_OPEN, "Use count for \"/dev/%s\" now %d\n", | ||
| 1109 | cdi->name, cdi->use_count); | ||
| 1110 | return 0; | ||
| 1111 | err_release: | ||
| 1112 | if (CDROM_CAN(CDC_LOCK) && cdi->options & CDO_LOCK) { | ||
| 1113 | cdi->ops->lock_door(cdi, 0); | ||
| 1114 | cd_dbg(CD_OPEN, "door unlocked\n"); | ||
| 1115 | } | ||
| 1116 | cdi->ops->release(cdi); | ||
| 1117 | err: | ||
| 1118 | cdi->use_count--; | ||
| 1119 | return ret; | ||
| 1120 | } | ||
| 1121 | |||
| 1122 | /* This code is similar to that in open_for_data. The routine is called | 1122 | /* This code is similar to that in open_for_data. The routine is called |
| 1123 | whenever an audio play operation is requested. | 1123 | whenever an audio play operation is requested. |
| 1124 | */ | 1124 | */ |
