usb: gadget: f_mass_storage: If 'ro'/'cdrom' specified, open file as read-only
authorRoger Quadros <roger.quadros@nokia.com>
Tue, 5 Apr 2011 15:36:39 +0000 (18:36 +0300)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 13 Apr 2011 23:40:59 +0000 (16:40 -0700)
If we don't need Write access then attempt to open backing file in Read Only
mode instead of bailing out too soon.

Signed-off-by: Roger Quadros <roger.quadros@nokia.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/gadget/f_mass_storage.c

index e9de33d1c9a06ec0a1e458f78ee413116a80558b..7d95a2cf58a39f2c509f8eb3be60c328734c8d21 100644 (file)
@@ -2757,6 +2757,7 @@ static struct fsg_common *fsg_common_init(struct fsg_common *common,
        for (i = 0, lcfg = cfg->luns; i < nluns; ++i, ++curlun, ++lcfg) {
                curlun->cdrom = !!lcfg->cdrom;
                curlun->ro = lcfg->cdrom || lcfg->ro;
+               curlun->initially_ro = curlun->ro;
                curlun->removable = lcfg->removable;
                curlun->dev.release = fsg_lun_release;
                curlun->dev.parent = &gadget->dev;