summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Quadros <roger.quadros@nokia.com>2011-04-05 18:36:39 +0300
committerGreg Kroah-Hartman <gregkh@suse.de>2011-04-13 16:40:59 -0700
commit3c624d4962a583516acadcbf60a8ca2a48421f5c (patch)
tree85d60787a7287c2dd3260027026c963680c38f5d
parent73ee4da994e7b97bd8241e39099cf3dd94675d79 (diff)
usb: gadget: f_mass_storage: If 'ro'/'cdrom' specified, open file as read-only
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>
-rw-r--r--drivers/usb/gadget/f_mass_storage.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c
index e9de33d1c9a0..7d95a2cf58a3 100644
--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -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;