diff options
author | Michal Nazarewicz <mina86@mina86.com> | 2010-11-12 08:29:29 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-11-16 16:55:19 -0500 |
commit | d8df0b611c66db3b7afd0678213979209616681a (patch) | |
tree | 0623444d83e1d7531c7dcf4257332e884e5e887e /drivers/usb/gadget | |
parent | 5ab54cf7acf418573c9204371cf1ab3497c451ee (diff) |
usb: gadget: f_fs: remove custom printk() wrappers
This commit removes custom printk() wrappers from the f_fs.c
file. They served little purpose above what pr_*() family of
macros provides. Only FVDBG() has been left but renamed to
pr_vdebug() to match other uses.
Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r-- | drivers/usb/gadget/f_fs.c | 108 |
1 files changed, 48 insertions, 60 deletions
diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c index 474f2d9f3a0..5950c4be968 100644 --- a/drivers/usb/gadget/f_fs.c +++ b/drivers/usb/gadget/f_fs.c | |||
@@ -27,6 +27,8 @@ | |||
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 | |||
30 | #include <linux/blkdev.h> | 32 | #include <linux/blkdev.h> |
31 | #include <linux/pagemap.h> | 33 | #include <linux/pagemap.h> |
32 | #include <asm/unaligned.h> | 34 | #include <asm/unaligned.h> |
@@ -41,31 +43,16 @@ | |||
41 | 43 | ||
42 | /* Debugging ****************************************************************/ | 44 | /* Debugging ****************************************************************/ |
43 | 45 | ||
44 | #define ffs_printk(level, fmt, args...) printk(level "f_fs: " fmt "\n", ## args) | ||
45 | |||
46 | #define FERR(...) ffs_printk(KERN_ERR, __VA_ARGS__) | ||
47 | #define FINFO(...) ffs_printk(KERN_INFO, __VA_ARGS__) | ||
48 | |||
49 | #ifdef DEBUG | ||
50 | # define FDBG(...) ffs_printk(KERN_DEBUG, __VA_ARGS__) | ||
51 | #else | ||
52 | # define FDBG(...) do { } while (0) | ||
53 | #endif /* DEBUG */ | ||
54 | |||
55 | #ifdef VERBOSE_DEBUG | ||
56 | # define FVDBG FDBG | ||
57 | #else | ||
58 | # define FVDBG(...) do { } while (0) | ||
59 | #endif /* VERBOSE_DEBUG */ | ||
60 | |||
61 | #define ENTER() FVDBG("%s()", __func__) | ||
62 | |||
63 | #ifdef VERBOSE_DEBUG | 46 | #ifdef VERBOSE_DEBUG |
47 | # define pr_vdebug pr_debug | ||
64 | # define ffs_dump_mem(prefix, ptr, len) \ | 48 | # define ffs_dump_mem(prefix, ptr, len) \ |
65 | print_hex_dump_bytes("f_fs" prefix ": ", DUMP_PREFIX_NONE, ptr, len) | 49 | print_hex_dump_bytes("f_fs" prefix ": ", DUMP_PREFIX_NONE, ptr, len) |
66 | #else | 50 | #else |
51 | # define pr_vdebug(...) do { } while (0) | ||
67 | # define ffs_dump_mem(prefix, ptr, len) do { } while (0) | 52 | # define ffs_dump_mem(prefix, ptr, len) do { } while (0) |
68 | #endif | 53 | #endif /* VERBOSE_DEBUG */ |
54 | |||
55 | #define ENTER() pr_vdebug("%s()", __func__) | ||
69 | 56 | ||
70 | 57 | ||
71 | /* The data structure and setup file ****************************************/ | 58 | /* The data structure and setup file ****************************************/ |
@@ -403,12 +390,12 @@ static int __ffs_ep0_queue_wait(struct ffs_data *ffs, char *data, size_t len) | |||
403 | static int __ffs_ep0_stall(struct ffs_data *ffs) | 390 | static int __ffs_ep0_stall(struct ffs_data *ffs) |
404 | { | 391 | { |
405 | if (ffs->ev.can_stall) { | 392 | if (ffs->ev.can_stall) { |
406 | FVDBG("ep0 stall\n"); | 393 | pr_vdebug("ep0 stall"); |
407 | usb_ep_set_halt(ffs->gadget->ep0); | 394 | usb_ep_set_halt(ffs->gadget->ep0); |
408 | ffs->setup_state = FFS_NO_SETUP; | 395 | ffs->setup_state = FFS_NO_SETUP; |
409 | return -EL2HLT; | 396 | return -EL2HLT; |
410 | } else { | 397 | } else { |
411 | FDBG("bogus ep0 stall!\n"); | 398 | pr_debug("bogus ep0 stall!"); |
412 | return -ESRCH; | 399 | return -ESRCH; |
413 | } | 400 | } |
414 | } | 401 | } |
@@ -449,7 +436,7 @@ static ssize_t ffs_ep0_write(struct file *file, const char __user *buf, | |||
449 | 436 | ||
450 | /* Handle data */ | 437 | /* Handle data */ |
451 | if (ffs->state == FFS_READ_DESCRIPTORS) { | 438 | if (ffs->state == FFS_READ_DESCRIPTORS) { |
452 | FINFO("read descriptors"); | 439 | pr_info("read descriptors"); |
453 | ret = __ffs_data_got_descs(ffs, data, len); | 440 | ret = __ffs_data_got_descs(ffs, data, len); |
454 | if (unlikely(ret < 0)) | 441 | if (unlikely(ret < 0)) |
455 | break; | 442 | break; |
@@ -457,7 +444,7 @@ static ssize_t ffs_ep0_write(struct file *file, const char __user *buf, | |||
457 | ffs->state = FFS_READ_STRINGS; | 444 | ffs->state = FFS_READ_STRINGS; |
458 | ret = len; | 445 | ret = len; |
459 | } else { | 446 | } else { |
460 | FINFO("read strings"); | 447 | pr_info("read strings"); |
461 | ret = __ffs_data_got_strings(ffs, data, len); | 448 | ret = __ffs_data_got_strings(ffs, data, len); |
462 | if (unlikely(ret < 0)) | 449 | if (unlikely(ret < 0)) |
463 | break; | 450 | break; |
@@ -1123,7 +1110,7 @@ static int ffs_fs_parse_opts(struct ffs_sb_fill_data *data, char *opts) | |||
1123 | /* Value limit */ | 1110 | /* Value limit */ |
1124 | eq = strchr(opts, '='); | 1111 | eq = strchr(opts, '='); |
1125 | if (unlikely(!eq)) { | 1112 | if (unlikely(!eq)) { |
1126 | FERR("'=' missing in %s", opts); | 1113 | pr_err("'=' missing in %s", opts); |
1127 | return -EINVAL; | 1114 | return -EINVAL; |
1128 | } | 1115 | } |
1129 | *eq = 0; | 1116 | *eq = 0; |
@@ -1131,7 +1118,7 @@ static int ffs_fs_parse_opts(struct ffs_sb_fill_data *data, char *opts) | |||
1131 | /* Parse value */ | 1118 | /* Parse value */ |
1132 | value = simple_strtoul(eq + 1, &end, 0); | 1119 | value = simple_strtoul(eq + 1, &end, 0); |
1133 | if (unlikely(*end != ',' && *end != 0)) { | 1120 | if (unlikely(*end != ',' && *end != 0)) { |
1134 | FERR("%s: invalid value: %s", opts, eq + 1); | 1121 | pr_err("%s: invalid value: %s", opts, eq + 1); |
1135 | return -EINVAL; | 1122 | return -EINVAL; |
1136 | } | 1123 | } |
1137 | 1124 | ||
@@ -1166,7 +1153,7 @@ static int ffs_fs_parse_opts(struct ffs_sb_fill_data *data, char *opts) | |||
1166 | 1153 | ||
1167 | default: | 1154 | default: |
1168 | invalid: | 1155 | invalid: |
1169 | FERR("%s: invalid option", opts); | 1156 | pr_err("%s: invalid option", opts); |
1170 | return -EINVAL; | 1157 | return -EINVAL; |
1171 | } | 1158 | } |
1172 | 1159 | ||
@@ -1240,9 +1227,9 @@ static int functionfs_init(void) | |||
1240 | 1227 | ||
1241 | ret = register_filesystem(&ffs_fs_type); | 1228 | ret = register_filesystem(&ffs_fs_type); |
1242 | if (likely(!ret)) | 1229 | if (likely(!ret)) |
1243 | FINFO("file system registered"); | 1230 | pr_info("file system registered"); |
1244 | else | 1231 | else |
1245 | FERR("failed registering file system (%d)", ret); | 1232 | pr_err("failed registering file system (%d)", ret); |
1246 | 1233 | ||
1247 | return ret; | 1234 | return ret; |
1248 | } | 1235 | } |
@@ -1251,7 +1238,7 @@ static void functionfs_cleanup(void) | |||
1251 | { | 1238 | { |
1252 | ENTER(); | 1239 | ENTER(); |
1253 | 1240 | ||
1254 | FINFO("unloading"); | 1241 | pr_info("unloading"); |
1255 | unregister_filesystem(&ffs_fs_type); | 1242 | unregister_filesystem(&ffs_fs_type); |
1256 | } | 1243 | } |
1257 | 1244 | ||
@@ -1281,7 +1268,7 @@ static void ffs_data_put(struct ffs_data *ffs) | |||
1281 | ENTER(); | 1268 | ENTER(); |
1282 | 1269 | ||
1283 | if (unlikely(atomic_dec_and_test(&ffs->ref))) { | 1270 | if (unlikely(atomic_dec_and_test(&ffs->ref))) { |
1284 | FINFO("%s(): freeing", __func__); | 1271 | pr_info("%s(): freeing", __func__); |
1285 | ffs_data_clear(ffs); | 1272 | ffs_data_clear(ffs); |
1286 | BUG_ON(mutex_is_locked(&ffs->mutex) || | 1273 | BUG_ON(mutex_is_locked(&ffs->mutex) || |
1287 | spin_is_locked(&ffs->ev.waitq.lock) || | 1274 | spin_is_locked(&ffs->ev.waitq.lock) || |
@@ -1601,14 +1588,14 @@ static int __must_check ffs_do_desc(char *data, unsigned len, | |||
1601 | 1588 | ||
1602 | /* At least two bytes are required: length and type */ | 1589 | /* At least two bytes are required: length and type */ |
1603 | if (len < 2) { | 1590 | if (len < 2) { |
1604 | FVDBG("descriptor too short"); | 1591 | pr_vdebug("descriptor too short"); |
1605 | return -EINVAL; | 1592 | return -EINVAL; |
1606 | } | 1593 | } |
1607 | 1594 | ||
1608 | /* If we have at least as many bytes as the descriptor takes? */ | 1595 | /* If we have at least as many bytes as the descriptor takes? */ |
1609 | length = _ds->bLength; | 1596 | length = _ds->bLength; |
1610 | if (len < length) { | 1597 | if (len < length) { |
1611 | FVDBG("descriptor longer then available data"); | 1598 | pr_vdebug("descriptor longer then available data"); |
1612 | return -EINVAL; | 1599 | return -EINVAL; |
1613 | } | 1600 | } |
1614 | 1601 | ||
@@ -1616,15 +1603,15 @@ static int __must_check ffs_do_desc(char *data, unsigned len, | |||
1616 | #define __entity_check_STRING(val) (val) | 1603 | #define __entity_check_STRING(val) (val) |
1617 | #define __entity_check_ENDPOINT(val) ((val) & USB_ENDPOINT_NUMBER_MASK) | 1604 | #define __entity_check_ENDPOINT(val) ((val) & USB_ENDPOINT_NUMBER_MASK) |
1618 | #define __entity(type, val) do { \ | 1605 | #define __entity(type, val) do { \ |
1619 | FVDBG("entity " #type "(%02x)", (val)); \ | 1606 | pr_vdebug("entity " #type "(%02x)", (val)); \ |
1620 | if (unlikely(!__entity_check_ ##type(val))) { \ | 1607 | if (unlikely(!__entity_check_ ##type(val))) { \ |
1621 | FVDBG("invalid entity's value"); \ | 1608 | pr_vdebug("invalid entity's value"); \ |
1622 | return -EINVAL; \ | 1609 | return -EINVAL; \ |
1623 | } \ | 1610 | } \ |
1624 | ret = entity(FFS_ ##type, &val, _ds, priv); \ | 1611 | ret = entity(FFS_ ##type, &val, _ds, priv); \ |
1625 | if (unlikely(ret < 0)) { \ | 1612 | if (unlikely(ret < 0)) { \ |
1626 | FDBG("entity " #type "(%02x); ret = %d", \ | 1613 | pr_debug("entity " #type "(%02x); ret = %d", \ |
1627 | (val), ret); \ | 1614 | (val), ret); \ |
1628 | return ret; \ | 1615 | return ret; \ |
1629 | } \ | 1616 | } \ |
1630 | } while (0) | 1617 | } while (0) |
@@ -1636,13 +1623,13 @@ static int __must_check ffs_do_desc(char *data, unsigned len, | |||
1636 | case USB_DT_STRING: | 1623 | case USB_DT_STRING: |
1637 | case USB_DT_DEVICE_QUALIFIER: | 1624 | case USB_DT_DEVICE_QUALIFIER: |
1638 | /* function can't have any of those */ | 1625 | /* function can't have any of those */ |
1639 | FVDBG("descriptor reserved for gadget: %d", | 1626 | pr_vdebug("descriptor reserved for gadget: %d", |
1640 | _ds->bDescriptorType); | 1627 | _ds->bDescriptorType); |
1641 | return -EINVAL; | 1628 | return -EINVAL; |
1642 | 1629 | ||
1643 | case USB_DT_INTERFACE: { | 1630 | case USB_DT_INTERFACE: { |
1644 | struct usb_interface_descriptor *ds = (void *)_ds; | 1631 | struct usb_interface_descriptor *ds = (void *)_ds; |
1645 | FVDBG("interface descriptor"); | 1632 | pr_vdebug("interface descriptor"); |
1646 | if (length != sizeof *ds) | 1633 | if (length != sizeof *ds) |
1647 | goto inv_length; | 1634 | goto inv_length; |
1648 | 1635 | ||
@@ -1654,7 +1641,7 @@ static int __must_check ffs_do_desc(char *data, unsigned len, | |||
1654 | 1641 | ||
1655 | case USB_DT_ENDPOINT: { | 1642 | case USB_DT_ENDPOINT: { |
1656 | struct usb_endpoint_descriptor *ds = (void *)_ds; | 1643 | struct usb_endpoint_descriptor *ds = (void *)_ds; |
1657 | FVDBG("endpoint descriptor"); | 1644 | pr_vdebug("endpoint descriptor"); |
1658 | if (length != USB_DT_ENDPOINT_SIZE && | 1645 | if (length != USB_DT_ENDPOINT_SIZE && |
1659 | length != USB_DT_ENDPOINT_AUDIO_SIZE) | 1646 | length != USB_DT_ENDPOINT_AUDIO_SIZE) |
1660 | goto inv_length; | 1647 | goto inv_length; |
@@ -1669,7 +1656,7 @@ static int __must_check ffs_do_desc(char *data, unsigned len, | |||
1669 | 1656 | ||
1670 | case USB_DT_INTERFACE_ASSOCIATION: { | 1657 | case USB_DT_INTERFACE_ASSOCIATION: { |
1671 | struct usb_interface_assoc_descriptor *ds = (void *)_ds; | 1658 | struct usb_interface_assoc_descriptor *ds = (void *)_ds; |
1672 | FVDBG("interface association descriptor"); | 1659 | pr_vdebug("interface association descriptor"); |
1673 | if (length != sizeof *ds) | 1660 | if (length != sizeof *ds) |
1674 | goto inv_length; | 1661 | goto inv_length; |
1675 | if (ds->iFunction) | 1662 | if (ds->iFunction) |
@@ -1683,17 +1670,17 @@ static int __must_check ffs_do_desc(char *data, unsigned len, | |||
1683 | case USB_DT_SECURITY: | 1670 | case USB_DT_SECURITY: |
1684 | case USB_DT_CS_RADIO_CONTROL: | 1671 | case USB_DT_CS_RADIO_CONTROL: |
1685 | /* TODO */ | 1672 | /* TODO */ |
1686 | FVDBG("unimplemented descriptor: %d", _ds->bDescriptorType); | 1673 | pr_vdebug("unimplemented descriptor: %d", _ds->bDescriptorType); |
1687 | return -EINVAL; | 1674 | return -EINVAL; |
1688 | 1675 | ||
1689 | default: | 1676 | default: |
1690 | /* We should never be here */ | 1677 | /* We should never be here */ |
1691 | FVDBG("unknown descriptor: %d", _ds->bDescriptorType); | 1678 | pr_vdebug("unknown descriptor: %d", _ds->bDescriptorType); |
1692 | return -EINVAL; | 1679 | return -EINVAL; |
1693 | 1680 | ||
1694 | inv_length: | 1681 | inv_length: |
1695 | FVDBG("invalid length: %d (descriptor %d)", | 1682 | pr_vdebug("invalid length: %d (descriptor %d)", |
1696 | _ds->bLength, _ds->bDescriptorType); | 1683 | _ds->bLength, _ds->bDescriptorType); |
1697 | return -EINVAL; | 1684 | return -EINVAL; |
1698 | } | 1685 | } |
1699 | 1686 | ||
@@ -1723,7 +1710,8 @@ static int __must_check ffs_do_descs(unsigned count, char *data, unsigned len, | |||
1723 | /* Record "descriptor" entity */ | 1710 | /* Record "descriptor" entity */ |
1724 | ret = entity(FFS_DESCRIPTOR, (u8 *)num, (void *)data, priv); | 1711 | ret = entity(FFS_DESCRIPTOR, (u8 *)num, (void *)data, priv); |
1725 | if (unlikely(ret < 0)) { | 1712 | if (unlikely(ret < 0)) { |
1726 | FDBG("entity DESCRIPTOR(%02lx); ret = %d", num, ret); | 1713 | pr_debug("entity DESCRIPTOR(%02lx); ret = %d", |
1714 | num, ret); | ||
1727 | return ret; | 1715 | return ret; |
1728 | } | 1716 | } |
1729 | 1717 | ||
@@ -1732,7 +1720,7 @@ static int __must_check ffs_do_descs(unsigned count, char *data, unsigned len, | |||
1732 | 1720 | ||
1733 | ret = ffs_do_desc(data, len, entity, priv); | 1721 | ret = ffs_do_desc(data, len, entity, priv); |
1734 | if (unlikely(ret < 0)) { | 1722 | if (unlikely(ret < 0)) { |
1735 | FDBG("%s returns %d", __func__, ret); | 1723 | pr_debug("%s returns %d", __func__, ret); |
1736 | return ret; | 1724 | return ret; |
1737 | } | 1725 | } |
1738 | 1726 | ||
@@ -2025,11 +2013,11 @@ static void __ffs_event_add(struct ffs_data *ffs, | |||
2025 | if ((*ev == rem_type1 || *ev == rem_type2) == neg) | 2013 | if ((*ev == rem_type1 || *ev == rem_type2) == neg) |
2026 | *out++ = *ev; | 2014 | *out++ = *ev; |
2027 | else | 2015 | else |
2028 | FVDBG("purging event %d", *ev); | 2016 | pr_vdebug("purging event %d", *ev); |
2029 | ffs->ev.count = out - ffs->ev.types; | 2017 | ffs->ev.count = out - ffs->ev.types; |
2030 | } | 2018 | } |
2031 | 2019 | ||
2032 | FVDBG("adding event %d", type); | 2020 | pr_vdebug("adding event %d", type); |
2033 | ffs->ev.types[ffs->ev.count++] = type; | 2021 | ffs->ev.types[ffs->ev.count++] = type; |
2034 | wake_up_locked(&ffs->ev.waitq); | 2022 | wake_up_locked(&ffs->ev.waitq); |
2035 | } | 2023 | } |
@@ -2076,9 +2064,9 @@ static int __ffs_func_bind_do_descs(enum ffs_entity_type type, u8 *valuep, | |||
2076 | ffs_ep = func->eps + idx; | 2064 | ffs_ep = func->eps + idx; |
2077 | 2065 | ||
2078 | if (unlikely(ffs_ep->descs[isHS])) { | 2066 | if (unlikely(ffs_ep->descs[isHS])) { |
2079 | FVDBG("two %sspeed descriptors for EP %d", | 2067 | pr_vdebug("two %sspeed descriptors for EP %d", |
2080 | isHS ? "high" : "full", | 2068 | isHS ? "high" : "full", |
2081 | ds->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK); | 2069 | ds->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK); |
2082 | return -EINVAL; | 2070 | return -EINVAL; |
2083 | } | 2071 | } |
2084 | ffs_ep->descs[isHS] = ds; | 2072 | ffs_ep->descs[isHS] = ds; |
@@ -2092,7 +2080,7 @@ static int __ffs_func_bind_do_descs(enum ffs_entity_type type, u8 *valuep, | |||
2092 | struct usb_request *req; | 2080 | struct usb_request *req; |
2093 | struct usb_ep *ep; | 2081 | struct usb_ep *ep; |
2094 | 2082 | ||
2095 | FVDBG("autoconfig"); | 2083 | pr_vdebug("autoconfig"); |
2096 | ep = usb_ep_autoconfig(func->gadget, ds); | 2084 | ep = usb_ep_autoconfig(func->gadget, ds); |
2097 | if (unlikely(!ep)) | 2085 | if (unlikely(!ep)) |
2098 | return -ENOTSUPP; | 2086 | return -ENOTSUPP; |
@@ -2162,7 +2150,7 @@ static int __ffs_func_bind_do_nums(enum ffs_entity_type type, u8 *valuep, | |||
2162 | break; | 2150 | break; |
2163 | } | 2151 | } |
2164 | 2152 | ||
2165 | FVDBG("%02x -> %02x", *valuep, newValue); | 2153 | pr_vdebug("%02x -> %02x", *valuep, newValue); |
2166 | *valuep = newValue; | 2154 | *valuep = newValue; |
2167 | return 0; | 2155 | return 0; |
2168 | } | 2156 | } |
@@ -2327,11 +2315,11 @@ static int ffs_func_setup(struct usb_function *f, | |||
2327 | 2315 | ||
2328 | ENTER(); | 2316 | ENTER(); |
2329 | 2317 | ||
2330 | FVDBG("creq->bRequestType = %02x", creq->bRequestType); | 2318 | pr_vdebug("creq->bRequestType = %02x", creq->bRequestType); |
2331 | FVDBG("creq->bRequest = %02x", creq->bRequest); | 2319 | pr_vdebug("creq->bRequest = %02x", creq->bRequest); |
2332 | FVDBG("creq->wValue = %04x", le16_to_cpu(creq->wValue)); | 2320 | pr_vdebug("creq->wValue = %04x", le16_to_cpu(creq->wValue)); |
2333 | FVDBG("creq->wIndex = %04x", le16_to_cpu(creq->wIndex)); | 2321 | pr_vdebug("creq->wIndex = %04x", le16_to_cpu(creq->wIndex)); |
2334 | FVDBG("creq->wLength = %04x", le16_to_cpu(creq->wLength)); | 2322 | pr_vdebug("creq->wLength = %04x", le16_to_cpu(creq->wLength)); |
2335 | 2323 | ||
2336 | /* | 2324 | /* |
2337 | * Most requests directed to interface go through here | 2325 | * Most requests directed to interface go through here |
@@ -2431,7 +2419,7 @@ static char *ffs_prepare_buffer(const char * __user buf, size_t len) | |||
2431 | return ERR_PTR(-EFAULT); | 2419 | return ERR_PTR(-EFAULT); |
2432 | } | 2420 | } |
2433 | 2421 | ||
2434 | FVDBG("Buffer from user space:"); | 2422 | pr_vdebug("Buffer from user space:"); |
2435 | ffs_dump_mem("", data, len); | 2423 | ffs_dump_mem("", data, len); |
2436 | 2424 | ||
2437 | return data; | 2425 | return data; |