]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/cdrom/cdrom.c
usb gadget: fix platform driver hotplug/coldplug
[linux-2.6-omap-h63xx.git] / drivers / cdrom / cdrom.c
index d70745c84250cb4b3f15d51adae267019a2d32c9..12f5baea439bbf8a85874188b4e2dbeb4d79459a 100644 (file)
@@ -1107,7 +1107,7 @@ int open_for_data(struct cdrom_device_info * cdi)
                       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)current->pid); 
+                                       (unsigned int)task_pid_nr(current));
                    ret=-EMEDIUMTYPE;
                    goto clean_up_and_return;
                }
@@ -1152,8 +1152,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.
 */
-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;
@@ -1206,25 +1206,26 @@ int check_for_audio_disc(struct cdrom_device_info * cdi,
        return 0;
 }
 
-/* Admittedly, the logic below could be performed in a nicer way. */
 int cdrom_release(struct cdrom_device_info *cdi, struct file *fp)
 {
        struct cdrom_device_ops *cdo = cdi->ops;
        int opened_for_data;
 
-       cdinfo(CD_CLOSE, "entering cdrom_release\n"); 
+       cdinfo(CD_CLOSE, "entering cdrom_release\n");
 
        if (cdi->use_count > 0)
                cdi->use_count--;
-       if (cdi->use_count == 0)
+
+       if (cdi->use_count == 0) {
                cdinfo(CD_CLOSE, "Use count for \"/dev/%s\" now zero\n", cdi->name);
-       if (cdi->use_count == 0)
                cdrom_dvd_rw_close_write(cdi);
-       if (cdi->use_count == 0 &&
-           (cdo->capability & CDC_LOCK) && !keeplocked) {
-               cdinfo(CD_CLOSE, "Unlocking door!\n");
-               cdo->lock_door(cdi, 0);
+
+               if ((cdo->capability & CDC_LOCK) && !keeplocked) {
+                       cdinfo(CD_CLOSE, "Unlocking door!\n");
+                       cdo->lock_door(cdi, 0);
+               }
        }
+
        opened_for_data = !(cdi->options & CDO_USE_FFLAGS) ||
                !(fp && fp->f_flags & O_NONBLOCK);
 
@@ -2787,12 +2788,6 @@ int cdrom_ioctl(struct file * file, struct cdrom_device_info *cdi,
        return -ENOSYS;
 }
 
-static inline
-int msf_to_lba(char m, char s, char f)
-{
-       return (((m * CD_SECS) + s) * CD_FRAMES + f) - CD_MSF_OFFSET;
-}
-
 /*
  * Required when we need to use READ_10 to issue other than 2048 block
  * reads