]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/usb/gadget/f_mass_storage.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[karo-tx-linux.git] / drivers / usb / gadget / f_mass_storage.c
index 50a46a429efb2eda2e9bc2c3116493685ddb6ac9..97666e8b1b9554ce54b1b6309a537eb456e406d5 100644 (file)
@@ -246,20 +246,6 @@ struct fsg_operations {
         * set).
         */
        int (*thread_exits)(struct fsg_common *common);
-
-       /*
-        * Called prior to ejection.  Negative return means error,
-        * zero means to continue with ejection, positive means not to
-        * eject.
-        */
-       int (*pre_eject)(struct fsg_common *common,
-                        struct fsg_lun *lun, int num);
-       /*
-        * Called after ejection.  Negative return means error, zero
-        * or positive is just a success.
-        */
-       int (*post_eject)(struct fsg_common *common,
-                         struct fsg_lun *lun, int num);
 };
 
 /* Data shared by all the FSG instances. */
@@ -1374,26 +1360,13 @@ static int do_start_stop(struct fsg_common *common)
        if (!loej)
                return 0;
 
-       /* Simulate an unload/eject */
-       if (common->ops && common->ops->pre_eject) {
-               int r = common->ops->pre_eject(common, curlun,
-                                              curlun - common->luns);
-               if (unlikely(r < 0))
-                       return r;
-               else if (r)
-                       return 0;
-       }
-
        up_read(&common->filesem);
        down_write(&common->filesem);
        fsg_lun_close(curlun);
        up_write(&common->filesem);
        down_read(&common->filesem);
 
-       return common->ops && common->ops->post_eject
-               ? min(0, common->ops->post_eject(common, curlun,
-                                                curlun - common->luns))
-               : 0;
+       return 0;
 }
 
 static int do_prevent_allow(struct fsg_common *common)
@@ -1718,7 +1691,7 @@ static int check_command(struct fsg_common *common, int cmnd_size,
                         int needs_medium, const char *name)
 {
        int                     i;
-       int                     lun = common->cmnd[1] >> 5;
+       unsigned int            lun = common->cmnd[1] >> 5;
        static const char       dirletter[4] = {'u', 'o', 'i', 'n'};
        char                    hdlen[20];
        struct fsg_lun          *curlun;
@@ -1784,7 +1757,7 @@ static int check_command(struct fsg_common *common, int cmnd_size,
 
        /* Check that the LUN values are consistent */
        if (common->lun != lun)
-               DBG(common, "using LUN %d from CBW, not LUN %d from CDB\n",
+               DBG(common, "using LUN %u from CBW, not LUN %u from CDB\n",
                    common->lun, lun);
 
        /* Check the LUN */
@@ -1804,7 +1777,7 @@ static int check_command(struct fsg_common *common, int cmnd_size,
                 */
                if (common->cmnd[0] != INQUIRY &&
                    common->cmnd[0] != REQUEST_SENSE) {
-                       DBG(common, "unsupported LUN %d\n", common->lun);
+                       DBG(common, "unsupported LUN %u\n", common->lun);
                        return -EINVAL;
                }
        }
@@ -2196,7 +2169,7 @@ static int received_cbw(struct fsg_dev *fsg, struct fsg_buffhd *bh)
        if (common->data_size == 0)
                common->data_dir = DATA_DIR_NONE;
        common->lun = cbw->Lun;
-       if (common->lun >= 0 && common->lun < common->nluns)
+       if (common->lun < common->nluns)
                common->curlun = &common->luns[common->lun];
        else
                common->curlun = NULL;