Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 316921
b: refs/heads/master
c: 48a31af
h: refs/heads/master
i:
  316919: 22e8db2
v: v3
  • Loading branch information
Michal Nazarewicz authored and Felipe Balbi committed Jul 2, 2012
1 parent 83f3f9c commit 4665f30
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 31bde1ceaa873bcaecd49e829bfabceacc4c512d
refs/heads/master: 48a31af74404e6460eabca410bf0b4a625bfd372
26 changes: 21 additions & 5 deletions trunk/drivers/usb/gadget/f_mass_storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -2609,11 +2609,15 @@ static int fsg_main_thread(void *common_)

/*************************** DEVICE ATTRIBUTES ***************************/

/* Write permission is checked per LUN in store_*() functions. */
static DEVICE_ATTR(ro, 0644, fsg_show_ro, fsg_store_ro);
static DEVICE_ATTR(nofua, 0644, fsg_show_nofua, fsg_store_nofua);
static DEVICE_ATTR(file, 0644, fsg_show_file, fsg_store_file);

static struct device_attribute dev_attr_ro_cdrom =
__ATTR(ro, 0444, fsg_show_ro, NULL);
static struct device_attribute dev_attr_file_nonremovable =
__ATTR(file, 0444, fsg_show_file, NULL);


/****************************** FSG COMMON ******************************/

Expand Down Expand Up @@ -2724,10 +2728,16 @@ static struct fsg_common *fsg_common_init(struct fsg_common *common,
goto error_release;
}

rc = device_create_file(&curlun->dev, &dev_attr_ro);
rc = device_create_file(&curlun->dev,
curlun->cdrom
? &dev_attr_ro_cdrom
: &dev_attr_ro);
if (rc)
goto error_luns;
rc = device_create_file(&curlun->dev, &dev_attr_file);
rc = device_create_file(&curlun->dev,
curlun->removable
? &dev_attr_file
: &dev_attr_file_nonremovable);
if (rc)
goto error_luns;
rc = device_create_file(&curlun->dev, &dev_attr_nofua);
Expand Down Expand Up @@ -2862,8 +2872,14 @@ static void fsg_common_release(struct kref *ref)
/* In error recovery common->nluns may be zero. */
for (; i; --i, ++lun) {
device_remove_file(&lun->dev, &dev_attr_nofua);
device_remove_file(&lun->dev, &dev_attr_ro);
device_remove_file(&lun->dev, &dev_attr_file);
device_remove_file(&lun->dev,
lun->cdrom
? &dev_attr_ro_cdrom
: &dev_attr_ro);
device_remove_file(&lun->dev,
lun->removable
? &dev_attr_file
: &dev_attr_file_nonremovable);
fsg_lun_close(lun);
device_unregister(&lun->dev);
}
Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/usb/gadget/storage_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,6 @@ static ssize_t fsg_store_file(struct device *dev, struct device_attribute *attr,
if (count > 0 && buf[count-1] == '\n')
((char *) buf)[count-1] = 0; /* Ugh! */


/* Load new medium */
down_write(filesem);
if (count > 0 && buf[0]) {
Expand Down

0 comments on commit 4665f30

Please sign in to comment.