diff options
author | Michal Nazarewicz <mina86@mina86.com> | 2010-11-17 11:09:47 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-11-17 16:24:46 -0500 |
commit | aa02f172ac85f144d0baa248e27e34e165963f94 (patch) | |
tree | 14355f3d00caeebcea89293bea84449bab0421cf /drivers/usb/gadget/f_fs.c | |
parent | c08512c761e7b9eaaab0e9167a389393f268e93c (diff) |
usb: gadget: g_fs: Fix compilation warning
This commit fixes warning in f_fs.c introduced by "usb:
gadget: f_fs: remove custom printk() wrappers":
In file included from drivers/usb/gadget/g_ffs.c:64:
drivers/usb/gadget/f_fs.c:30:1: warning: "pr_fmt" redefined
Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/gadget/f_fs.c')
-rw-r--r-- | drivers/usb/gadget/f_fs.c | 78 |
1 files changed, 38 insertions, 40 deletions
diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c index 5950c4be9680..255969cd1639 100644 --- a/drivers/usb/gadget/f_fs.c +++ b/drivers/usb/gadget/f_fs.c | |||
@@ -27,8 +27,6 @@ | |||
27 | /* #define DEBUG */ | 27 | /* #define DEBUG */ |
28 | /* #define VERBOSE_DEBUG */ | 28 | /* #define VERBOSE_DEBUG */ |
29 | 29 | ||
30 | #define pr_fmt(fmt) "f_fs: " fmt "\n" | ||
31 | |||
32 | #include <linux/blkdev.h> | 30 | #include <linux/blkdev.h> |
33 | #include <linux/pagemap.h> | 31 | #include <linux/pagemap.h> |
34 | #include <asm/unaligned.h> | 32 | #include <asm/unaligned.h> |
@@ -46,13 +44,13 @@ | |||
46 | #ifdef VERBOSE_DEBUG | 44 | #ifdef VERBOSE_DEBUG |
47 | # define pr_vdebug pr_debug | 45 | # define pr_vdebug pr_debug |
48 | # define ffs_dump_mem(prefix, ptr, len) \ | 46 | # define ffs_dump_mem(prefix, ptr, len) \ |
49 | print_hex_dump_bytes("f_fs" prefix ": ", DUMP_PREFIX_NONE, ptr, len) | 47 | print_hex_dump_bytes(pr_fmt(prefix ": "), DUMP_PREFIX_NONE, ptr, len) |
50 | #else | 48 | #else |
51 | # define pr_vdebug(...) do { } while (0) | 49 | # define pr_vdebug(...) do { } while (0) |
52 | # define ffs_dump_mem(prefix, ptr, len) do { } while (0) | 50 | # define ffs_dump_mem(prefix, ptr, len) do { } while (0) |
53 | #endif /* VERBOSE_DEBUG */ | 51 | #endif /* VERBOSE_DEBUG */ |
54 | 52 | ||
55 | #define ENTER() pr_vdebug("%s()", __func__) | 53 | #define ENTER() pr_vdebug("%s()\n", __func__) |
56 | 54 | ||
57 | 55 | ||
58 | /* The data structure and setup file ****************************************/ | 56 | /* The data structure and setup file ****************************************/ |
@@ -390,12 +388,12 @@ static int __ffs_ep0_queue_wait(struct ffs_data *ffs, char *data, size_t len) | |||
390 | static int __ffs_ep0_stall(struct ffs_data *ffs) | 388 | static int __ffs_ep0_stall(struct ffs_data *ffs) |
391 | { | 389 | { |
392 | if (ffs->ev.can_stall) { | 390 | if (ffs->ev.can_stall) { |
393 | pr_vdebug("ep0 stall"); | 391 | pr_vdebug("ep0 stall\n"); |
394 | usb_ep_set_halt(ffs->gadget->ep0); | 392 | usb_ep_set_halt(ffs->gadget->ep0); |
395 | ffs->setup_state = FFS_NO_SETUP; | 393 | ffs->setup_state = FFS_NO_SETUP; |
396 | return -EL2HLT; | 394 | return -EL2HLT; |
397 | } else { | 395 | } else { |
398 | pr_debug("bogus ep0 stall!"); | 396 | pr_debug("bogus ep0 stall!\n"); |
399 | return -ESRCH; | 397 | return -ESRCH; |
400 | } | 398 | } |
401 | } | 399 | } |
@@ -436,7 +434,7 @@ static ssize_t ffs_ep0_write(struct file *file, const char __user *buf, | |||
436 | 434 | ||
437 | /* Handle data */ | 435 | /* Handle data */ |
438 | if (ffs->state == FFS_READ_DESCRIPTORS) { | 436 | if (ffs->state == FFS_READ_DESCRIPTORS) { |
439 | pr_info("read descriptors"); | 437 | pr_info("read descriptors\n"); |
440 | ret = __ffs_data_got_descs(ffs, data, len); | 438 | ret = __ffs_data_got_descs(ffs, data, len); |
441 | if (unlikely(ret < 0)) | 439 | if (unlikely(ret < 0)) |
442 | break; | 440 | break; |
@@ -444,7 +442,7 @@ static ssize_t ffs_ep0_write(struct file *file, const char __user *buf, | |||
444 | ffs->state = FFS_READ_STRINGS; | 442 | ffs->state = FFS_READ_STRINGS; |
445 | ret = len; | 443 | ret = len; |
446 | } else { | 444 | } else { |
447 | pr_info("read strings"); | 445 | pr_info("read strings\n"); |
448 | ret = __ffs_data_got_strings(ffs, data, len); | 446 | ret = __ffs_data_got_strings(ffs, data, len); |
449 | if (unlikely(ret < 0)) | 447 | if (unlikely(ret < 0)) |
450 | break; | 448 | break; |
@@ -1110,7 +1108,7 @@ static int ffs_fs_parse_opts(struct ffs_sb_fill_data *data, char *opts) | |||
1110 | /* Value limit */ | 1108 | /* Value limit */ |
1111 | eq = strchr(opts, '='); | 1109 | eq = strchr(opts, '='); |
1112 | if (unlikely(!eq)) { | 1110 | if (unlikely(!eq)) { |
1113 | pr_err("'=' missing in %s", opts); | 1111 | pr_err("'=' missing in %s\n", opts); |
1114 | return -EINVAL; | 1112 | return -EINVAL; |
1115 | } | 1113 | } |
1116 | *eq = 0; | 1114 | *eq = 0; |
@@ -1118,7 +1116,7 @@ static int ffs_fs_parse_opts(struct ffs_sb_fill_data *data, char *opts) | |||
1118 | /* Parse value */ | 1116 | /* Parse value */ |
1119 | value = simple_strtoul(eq + 1, &end, 0); | 1117 | value = simple_strtoul(eq + 1, &end, 0); |
1120 | if (unlikely(*end != ',' && *end != 0)) { | 1118 | if (unlikely(*end != ',' && *end != 0)) { |
1121 | pr_err("%s: invalid value: %s", opts, eq + 1); | 1119 | pr_err("%s: invalid value: %s\n", opts, eq + 1); |
1122 | return -EINVAL; | 1120 | return -EINVAL; |
1123 | } | 1121 | } |
1124 | 1122 | ||
@@ -1153,7 +1151,7 @@ static int ffs_fs_parse_opts(struct ffs_sb_fill_data *data, char *opts) | |||
1153 | 1151 | ||
1154 | default: | 1152 | default: |
1155 | invalid: | 1153 | invalid: |
1156 | pr_err("%s: invalid option", opts); | 1154 | pr_err("%s: invalid option\n", opts); |
1157 | return -EINVAL; | 1155 | return -EINVAL; |
1158 | } | 1156 | } |
1159 | 1157 | ||
@@ -1227,9 +1225,9 @@ static int functionfs_init(void) | |||
1227 | 1225 | ||
1228 | ret = register_filesystem(&ffs_fs_type); | 1226 | ret = register_filesystem(&ffs_fs_type); |
1229 | if (likely(!ret)) | 1227 | if (likely(!ret)) |
1230 | pr_info("file system registered"); | 1228 | pr_info("file system registered\n"); |
1231 | else | 1229 | else |
1232 | pr_err("failed registering file system (%d)", ret); | 1230 | pr_err("failed registering file system (%d)\n", ret); |
1233 | 1231 | ||
1234 | return ret; | 1232 | return ret; |
1235 | } | 1233 | } |
@@ -1238,7 +1236,7 @@ static void functionfs_cleanup(void) | |||
1238 | { | 1236 | { |
1239 | ENTER(); | 1237 | ENTER(); |
1240 | 1238 | ||
1241 | pr_info("unloading"); | 1239 | pr_info("unloading\n"); |
1242 | unregister_filesystem(&ffs_fs_type); | 1240 | unregister_filesystem(&ffs_fs_type); |
1243 | } | 1241 | } |
1244 | 1242 | ||
@@ -1268,7 +1266,7 @@ static void ffs_data_put(struct ffs_data *ffs) | |||
1268 | ENTER(); | 1266 | ENTER(); |
1269 | 1267 | ||
1270 | if (unlikely(atomic_dec_and_test(&ffs->ref))) { | 1268 | if (unlikely(atomic_dec_and_test(&ffs->ref))) { |
1271 | pr_info("%s(): freeing", __func__); | 1269 | pr_info("%s(): freeing\n", __func__); |
1272 | ffs_data_clear(ffs); | 1270 | ffs_data_clear(ffs); |
1273 | BUG_ON(mutex_is_locked(&ffs->mutex) || | 1271 | BUG_ON(mutex_is_locked(&ffs->mutex) || |
1274 | spin_is_locked(&ffs->ev.waitq.lock) || | 1272 | spin_is_locked(&ffs->ev.waitq.lock) || |
@@ -1588,14 +1586,14 @@ static int __must_check ffs_do_desc(char *data, unsigned len, | |||
1588 | 1586 | ||
1589 | /* At least two bytes are required: length and type */ | 1587 | /* At least two bytes are required: length and type */ |
1590 | if (len < 2) { | 1588 | if (len < 2) { |
1591 | pr_vdebug("descriptor too short"); | 1589 | pr_vdebug("descriptor too short\n"); |
1592 | return -EINVAL; | 1590 | return -EINVAL; |
1593 | } | 1591 | } |
1594 | 1592 | ||
1595 | /* If we have at least as many bytes as the descriptor takes? */ | 1593 | /* If we have at least as many bytes as the descriptor takes? */ |
1596 | length = _ds->bLength; | 1594 | length = _ds->bLength; |
1597 | if (len < length) { | 1595 | if (len < length) { |
1598 | pr_vdebug("descriptor longer then available data"); | 1596 | pr_vdebug("descriptor longer then available data\n"); |
1599 | return -EINVAL; | 1597 | return -EINVAL; |
1600 | } | 1598 | } |
1601 | 1599 | ||
@@ -1603,14 +1601,14 @@ static int __must_check ffs_do_desc(char *data, unsigned len, | |||
1603 | #define __entity_check_STRING(val) (val) | 1601 | #define __entity_check_STRING(val) (val) |
1604 | #define __entity_check_ENDPOINT(val) ((val) & USB_ENDPOINT_NUMBER_MASK) | 1602 | #define __entity_check_ENDPOINT(val) ((val) & USB_ENDPOINT_NUMBER_MASK) |
1605 | #define __entity(type, val) do { \ | 1603 | #define __entity(type, val) do { \ |
1606 | pr_vdebug("entity " #type "(%02x)", (val)); \ | 1604 | pr_vdebug("entity " #type "(%02x)\n", (val)); \ |
1607 | if (unlikely(!__entity_check_ ##type(val))) { \ | 1605 | if (unlikely(!__entity_check_ ##type(val))) { \ |
1608 | pr_vdebug("invalid entity's value"); \ | 1606 | pr_vdebug("invalid entity's value\n"); \ |
1609 | return -EINVAL; \ | 1607 | return -EINVAL; \ |
1610 | } \ | 1608 | } \ |
1611 | ret = entity(FFS_ ##type, &val, _ds, priv); \ | 1609 | ret = entity(FFS_ ##type, &val, _ds, priv); \ |
1612 | if (unlikely(ret < 0)) { \ | 1610 | if (unlikely(ret < 0)) { \ |
1613 | pr_debug("entity " #type "(%02x); ret = %d", \ | 1611 | pr_debug("entity " #type "(%02x); ret = %d\n", \ |
1614 | (val), ret); \ | 1612 | (val), ret); \ |
1615 | return ret; \ | 1613 | return ret; \ |
1616 | } \ | 1614 | } \ |
@@ -1623,13 +1621,13 @@ static int __must_check ffs_do_desc(char *data, unsigned len, | |||
1623 | case USB_DT_STRING: | 1621 | case USB_DT_STRING: |
1624 | case USB_DT_DEVICE_QUALIFIER: | 1622 | case USB_DT_DEVICE_QUALIFIER: |
1625 | /* function can't have any of those */ | 1623 | /* function can't have any of those */ |
1626 | pr_vdebug("descriptor reserved for gadget: %d", | 1624 | pr_vdebug("descriptor reserved for gadget: %d\n", |
1627 | _ds->bDescriptorType); | 1625 | _ds->bDescriptorType); |
1628 | return -EINVAL; | 1626 | return -EINVAL; |
1629 | 1627 | ||
1630 | case USB_DT_INTERFACE: { | 1628 | case USB_DT_INTERFACE: { |
1631 | struct usb_interface_descriptor *ds = (void *)_ds; | 1629 | struct usb_interface_descriptor *ds = (void *)_ds; |
1632 | pr_vdebug("interface descriptor"); | 1630 | pr_vdebug("interface descriptor\n"); |
1633 | if (length != sizeof *ds) | 1631 | if (length != sizeof *ds) |
1634 | goto inv_length; | 1632 | goto inv_length; |
1635 | 1633 | ||
@@ -1641,7 +1639,7 @@ static int __must_check ffs_do_desc(char *data, unsigned len, | |||
1641 | 1639 | ||
1642 | case USB_DT_ENDPOINT: { | 1640 | case USB_DT_ENDPOINT: { |
1643 | struct usb_endpoint_descriptor *ds = (void *)_ds; | 1641 | struct usb_endpoint_descriptor *ds = (void *)_ds; |
1644 | pr_vdebug("endpoint descriptor"); | 1642 | pr_vdebug("endpoint descriptor\n"); |
1645 | if (length != USB_DT_ENDPOINT_SIZE && | 1643 | if (length != USB_DT_ENDPOINT_SIZE && |
1646 | length != USB_DT_ENDPOINT_AUDIO_SIZE) | 1644 | length != USB_DT_ENDPOINT_AUDIO_SIZE) |
1647 | goto inv_length; | 1645 | goto inv_length; |
@@ -1656,7 +1654,7 @@ static int __must_check ffs_do_desc(char *data, unsigned len, | |||
1656 | 1654 | ||
1657 | case USB_DT_INTERFACE_ASSOCIATION: { | 1655 | case USB_DT_INTERFACE_ASSOCIATION: { |
1658 | struct usb_interface_assoc_descriptor *ds = (void *)_ds; | 1656 | struct usb_interface_assoc_descriptor *ds = (void *)_ds; |
1659 | pr_vdebug("interface association descriptor"); | 1657 | pr_vdebug("interface association descriptor\n"); |
1660 | if (length != sizeof *ds) | 1658 | if (length != sizeof *ds) |
1661 | goto inv_length; | 1659 | goto inv_length; |
1662 | if (ds->iFunction) | 1660 | if (ds->iFunction) |
@@ -1670,16 +1668,16 @@ static int __must_check ffs_do_desc(char *data, unsigned len, | |||
1670 | case USB_DT_SECURITY: | 1668 | case USB_DT_SECURITY: |
1671 | case USB_DT_CS_RADIO_CONTROL: | 1669 | case USB_DT_CS_RADIO_CONTROL: |
1672 | /* TODO */ | 1670 | /* TODO */ |
1673 | pr_vdebug("unimplemented descriptor: %d", _ds->bDescriptorType); | 1671 | pr_vdebug("unimplemented descriptor: %d\n", _ds->bDescriptorType); |
1674 | return -EINVAL; | 1672 | return -EINVAL; |
1675 | 1673 | ||
1676 | default: | 1674 | default: |
1677 | /* We should never be here */ | 1675 | /* We should never be here */ |
1678 | pr_vdebug("unknown descriptor: %d", _ds->bDescriptorType); | 1676 | pr_vdebug("unknown descriptor: %d\n", _ds->bDescriptorType); |
1679 | return -EINVAL; | 1677 | return -EINVAL; |
1680 | 1678 | ||
1681 | inv_length: | 1679 | inv_length: |
1682 | pr_vdebug("invalid length: %d (descriptor %d)", | 1680 | pr_vdebug("invalid length: %d (descriptor %d)\n", |
1683 | _ds->bLength, _ds->bDescriptorType); | 1681 | _ds->bLength, _ds->bDescriptorType); |
1684 | return -EINVAL; | 1682 | return -EINVAL; |
1685 | } | 1683 | } |
@@ -1710,7 +1708,7 @@ static int __must_check ffs_do_descs(unsigned count, char *data, unsigned len, | |||
1710 | /* Record "descriptor" entity */ | 1708 | /* Record "descriptor" entity */ |
1711 | ret = entity(FFS_DESCRIPTOR, (u8 *)num, (void *)data, priv); | 1709 | ret = entity(FFS_DESCRIPTOR, (u8 *)num, (void *)data, priv); |
1712 | if (unlikely(ret < 0)) { | 1710 | if (unlikely(ret < 0)) { |
1713 | pr_debug("entity DESCRIPTOR(%02lx); ret = %d", | 1711 | pr_debug("entity DESCRIPTOR(%02lx); ret = %d\n", |
1714 | num, ret); | 1712 | num, ret); |
1715 | return ret; | 1713 | return ret; |
1716 | } | 1714 | } |
@@ -1720,7 +1718,7 @@ static int __must_check ffs_do_descs(unsigned count, char *data, unsigned len, | |||
1720 | 1718 | ||
1721 | ret = ffs_do_desc(data, len, entity, priv); | 1719 | ret = ffs_do_desc(data, len, entity, priv); |
1722 | if (unlikely(ret < 0)) { | 1720 | if (unlikely(ret < 0)) { |
1723 | pr_debug("%s returns %d", __func__, ret); | 1721 | pr_debug("%s returns %d\n", __func__, ret); |
1724 | return ret; | 1722 | return ret; |
1725 | } | 1723 | } |
1726 | 1724 | ||
@@ -2013,11 +2011,11 @@ static void __ffs_event_add(struct ffs_data *ffs, | |||
2013 | if ((*ev == rem_type1 || *ev == rem_type2) == neg) | 2011 | if ((*ev == rem_type1 || *ev == rem_type2) == neg) |
2014 | *out++ = *ev; | 2012 | *out++ = *ev; |
2015 | else | 2013 | else |
2016 | pr_vdebug("purging event %d", *ev); | 2014 | pr_vdebug("purging event %d\n", *ev); |
2017 | ffs->ev.count = out - ffs->ev.types; | 2015 | ffs->ev.count = out - ffs->ev.types; |
2018 | } | 2016 | } |
2019 | 2017 | ||
2020 | pr_vdebug("adding event %d", type); | 2018 | pr_vdebug("adding event %d\n", type); |
2021 | ffs->ev.types[ffs->ev.count++] = type; | 2019 | ffs->ev.types[ffs->ev.count++] = type; |
2022 | wake_up_locked(&ffs->ev.waitq); | 2020 | wake_up_locked(&ffs->ev.waitq); |
2023 | } | 2021 | } |
@@ -2064,7 +2062,7 @@ static int __ffs_func_bind_do_descs(enum ffs_entity_type type, u8 *valuep, | |||
2064 | ffs_ep = func->eps + idx; | 2062 | ffs_ep = func->eps + idx; |
2065 | 2063 | ||
2066 | if (unlikely(ffs_ep->descs[isHS])) { | 2064 | if (unlikely(ffs_ep->descs[isHS])) { |
2067 | pr_vdebug("two %sspeed descriptors for EP %d", | 2065 | pr_vdebug("two %sspeed descriptors for EP %d\n", |
2068 | isHS ? "high" : "full", | 2066 | isHS ? "high" : "full", |
2069 | ds->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK); | 2067 | ds->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK); |
2070 | return -EINVAL; | 2068 | return -EINVAL; |
@@ -2080,7 +2078,7 @@ static int __ffs_func_bind_do_descs(enum ffs_entity_type type, u8 *valuep, | |||
2080 | struct usb_request *req; | 2078 | struct usb_request *req; |
2081 | struct usb_ep *ep; | 2079 | struct usb_ep *ep; |
2082 | 2080 | ||
2083 | pr_vdebug("autoconfig"); | 2081 | pr_vdebug("autoconfig\n"); |
2084 | ep = usb_ep_autoconfig(func->gadget, ds); | 2082 | ep = usb_ep_autoconfig(func->gadget, ds); |
2085 | if (unlikely(!ep)) | 2083 | if (unlikely(!ep)) |
2086 | return -ENOTSUPP; | 2084 | return -ENOTSUPP; |
@@ -2150,7 +2148,7 @@ static int __ffs_func_bind_do_nums(enum ffs_entity_type type, u8 *valuep, | |||
2150 | break; | 2148 | break; |
2151 | } | 2149 | } |
2152 | 2150 | ||
2153 | pr_vdebug("%02x -> %02x", *valuep, newValue); | 2151 | pr_vdebug("%02x -> %02x\n", *valuep, newValue); |
2154 | *valuep = newValue; | 2152 | *valuep = newValue; |
2155 | return 0; | 2153 | return 0; |
2156 | } | 2154 | } |
@@ -2315,11 +2313,11 @@ static int ffs_func_setup(struct usb_function *f, | |||
2315 | 2313 | ||
2316 | ENTER(); | 2314 | ENTER(); |
2317 | 2315 | ||
2318 | pr_vdebug("creq->bRequestType = %02x", creq->bRequestType); | 2316 | pr_vdebug("creq->bRequestType = %02x\n", creq->bRequestType); |
2319 | pr_vdebug("creq->bRequest = %02x", creq->bRequest); | 2317 | pr_vdebug("creq->bRequest = %02x\n", creq->bRequest); |
2320 | pr_vdebug("creq->wValue = %04x", le16_to_cpu(creq->wValue)); | 2318 | pr_vdebug("creq->wValue = %04x\n", le16_to_cpu(creq->wValue)); |
2321 | pr_vdebug("creq->wIndex = %04x", le16_to_cpu(creq->wIndex)); | 2319 | pr_vdebug("creq->wIndex = %04x\n", le16_to_cpu(creq->wIndex)); |
2322 | pr_vdebug("creq->wLength = %04x", le16_to_cpu(creq->wLength)); | 2320 | pr_vdebug("creq->wLength = %04x\n", le16_to_cpu(creq->wLength)); |
2323 | 2321 | ||
2324 | /* | 2322 | /* |
2325 | * Most requests directed to interface go through here | 2323 | * Most requests directed to interface go through here |
@@ -2419,7 +2417,7 @@ static char *ffs_prepare_buffer(const char * __user buf, size_t len) | |||
2419 | return ERR_PTR(-EFAULT); | 2417 | return ERR_PTR(-EFAULT); |
2420 | } | 2418 | } |
2421 | 2419 | ||
2422 | pr_vdebug("Buffer from user space:"); | 2420 | pr_vdebug("Buffer from user space:\n"); |
2423 | ffs_dump_mem("", data, len); | 2421 | ffs_dump_mem("", data, len); |
2424 | 2422 | ||
2425 | return data; | 2423 | return data; |