]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
greybus: don't use %h and %hh for printing short and char variables
authorViresh Kumar <viresh.kumar@linaro.org>
Fri, 4 Dec 2015 16:00:09 +0000 (21:30 +0530)
committerGreg Kroah-Hartman <gregkh@google.com>
Sat, 5 Dec 2015 00:23:36 +0000 (16:23 -0800)
Because the width of our fields is already known, we can use %0Nx (for
hex) to print N bytes and %u (for unsigned decimal), instead of using %h
and %hh, which isn't that readable.

This patch makes following changes:
- s/%hx/%04x
- s/%04hx/%04x
- s/%hhx/%02x
- s/%02hhx/%02x
- s/%hhu/%u
- s/%hu/%u
- s/%x/%02x for u8 value (only at a single place)

Suggested-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/bundle.c
drivers/staging/greybus/connection.c
drivers/staging/greybus/es2.c
drivers/staging/greybus/firmware.c
drivers/staging/greybus/hid.c
drivers/staging/greybus/loopback.c
drivers/staging/greybus/manifest.c
drivers/staging/greybus/operation.c
drivers/staging/greybus/protocol.c
drivers/staging/greybus/svc.c

index 3df7d5f915f922986d38e5ecb5fe4699df9c4cba..97a8195ab0357a019492aa0924179ac25217d996 100644 (file)
@@ -128,7 +128,7 @@ struct gb_bundle *gb_bundle_create(struct gb_interface *intf, u8 bundle_id,
         * the interface bundle list locked here.
         */
        if (gb_bundle_find(intf, bundle_id)) {
-               pr_err("duplicate bundle id 0x%02hhx\n", bundle_id);
+               pr_err("duplicate bundle id 0x%02x\n", bundle_id);
                return NULL;
        }
 
@@ -152,7 +152,7 @@ struct gb_bundle *gb_bundle_create(struct gb_interface *intf, u8 bundle_id,
 
        retval = device_add(&bundle->dev);
        if (retval) {
-               pr_err("failed to add bundle device for id 0x%02hhx\n",
+               pr_err("failed to add bundle device for id 0x%02x\n",
                        bundle_id);
                put_device(&bundle->dev);
                return NULL;
index 2b078466854795c1c0e4c483c626699fce3e7fae..674e9a83962d636036d5906e2c4396ec59d58604 100644 (file)
@@ -89,7 +89,7 @@ static void gb_connection_init_name(struct gb_connection *connection)
        }
 
        snprintf(connection->name, sizeof(connection->name),
-                       "%hu/%hhu:%hu", hd_cport_id, intf_id, cport_id);
+                       "%u/%u:%u", hd_cport_id, intf_id, cport_id);
 }
 
 /*
@@ -129,7 +129,7 @@ gb_connection_create(struct gb_host_device *hd, int hd_cport_id,
         * about holding the connection lock.
         */
        if (bundle && gb_connection_intf_find(bundle->intf, cport_id)) {
-               dev_err(&bundle->dev, "cport 0x%04hx already connected\n",
+               dev_err(&bundle->dev, "cport 0x%04x already connected\n",
                                cport_id);
                return NULL;
        }
@@ -534,7 +534,7 @@ int gb_connection_bind_protocol(struct gb_connection *connection)
                                   connection->minor);
        if (!protocol) {
                dev_warn(&connection->hd->dev,
-                               "protocol 0x%02hhx version %hhu.%hhu not found\n",
+                               "protocol 0x%02x version %u.%u not found\n",
                                connection->protocol_id,
                                connection->major, connection->minor);
                return 0;
index 0eb96459b68b5126672900d6e6083bddcdb6f630..ed22b6c0a73e87e2bc677f7bd7f573e717c5faf6 100644 (file)
@@ -442,7 +442,7 @@ static int cport_reset(struct gb_host_device *hd, u16 cport_id)
                                 USB_RECIP_INTERFACE, cport_id, 0,
                                 NULL, 0, ES2_TIMEOUT);
        if (retval < 0) {
-               dev_err(&udev->dev, "failed to reset cport %hu: %d\n", cport_id,
+               dev_err(&udev->dev, "failed to reset cport %u: %d\n", cport_id,
                        retval);
                return retval;
        }
@@ -890,7 +890,7 @@ static int ap_probe(struct usb_interface *interface,
                                endpoint->bEndpointAddress;
                } else {
                        dev_err(&udev->dev,
-                               "Unknown endpoint type found, address %x\n",
+                               "Unknown endpoint type found, address %02x\n",
                                endpoint->bEndpointAddress);
                }
        }
index cd2184cec7587a3cedc47ae563df398441a926d6..9d1739d78cca57e93289e6517c635cf54878761c 100644 (file)
@@ -210,7 +210,7 @@ static int gb_firmware_request_recv(u8 type, struct gb_operation *op)
                return gb_firmware_ready_to_boot(op);
        default:
                dev_err(&op->connection->bundle->dev,
-                       "unsupported request: %hhu\n", type);
+                       "unsupported request: %u\n", type);
                return -EINVAL;
        }
 }
index 2adcb1c47d2e795418aadd9d7246f66f631cbdb6..f45b444716ba04bb644b3e20854981ed64423e07 100644 (file)
@@ -411,7 +411,7 @@ static int gb_hid_init(struct gb_hid *ghid)
 //     hid->bus = BUS_GREYBUS; /* Need a bustype for GREYBUS in <linux/input.h> */
 
        /* Set HID device's name */
-       snprintf(hid->name, sizeof(hid->name), "%s %04hX:%04hX",
+       snprintf(hid->name, sizeof(hid->name), "%s %04X:%04X",
                 dev_name(&ghid->connection->bundle->dev),
                 hid->vendor, hid->product);
 
index 8524ce128738736f2c3f3301326ff505fe158919..689ebfdb456ea2cc1e15876c23b90485ba0a899e 100644 (file)
@@ -487,7 +487,7 @@ static int gb_loopback_request_recv(u8 type, struct gb_operation *operation)
 
                return 0;
        default:
-               dev_err(dev, "unsupported request: %hhu\n", type);
+               dev_err(dev, "unsupported request: %u\n", type);
                return -EINVAL;
        }
 }
index ea5ff8682e6951cdd8e15ce88d1f46299a97b460..72400e38b392112550fced9de2967127fda96abb 100644 (file)
@@ -140,7 +140,7 @@ static int identify_descriptor(struct gb_interface *intf,
                break;
        case GREYBUS_TYPE_INVALID:
        default:
-               pr_err("invalid descriptor type (%hhu)\n", desc_header->type);
+               pr_err("invalid descriptor type (%u)\n", desc_header->type);
                return -EINVAL;
        }
 
@@ -440,14 +440,14 @@ bool gb_manifest_parse(struct gb_interface *intf, void *data, size_t size)
        header = &manifest->header;
        manifest_size = le16_to_cpu(header->size);
        if (manifest_size != size) {
-               pr_err("manifest size mismatch (%zu != %hu)\n",
+               pr_err("manifest size mismatch (%zu != %u)\n",
                        size, manifest_size);
                return false;
        }
 
        /* Validate major/minor number */
        if (header->version_major > GREYBUS_VERSION_MAJOR) {
-               pr_err("manifest version too new (%hhu.%hhu > %hhu.%hhu)\n",
+               pr_err("manifest version too new (%u.%u > %u.%u)\n",
                       header->version_major, header->version_minor,
                       GREYBUS_VERSION_MAJOR, GREYBUS_VERSION_MINOR);
                return false;
index 01ad08bc85d0aad6e82c684433ad91c8be29a3c0..ae3ada0b54e3bd4ceb209c55f7a3bf10289c436d 100644 (file)
@@ -229,7 +229,7 @@ static void gb_operation_request_handle(struct gb_operation *operation)
                status = protocol->request_recv(operation->type, operation);
        } else {
                dev_err(&connection->hd->dev,
-                       "%s: unexpected incoming request of type 0x%02hhx\n",
+                       "%s: unexpected incoming request of type 0x%02x\n",
                        connection->name, operation->type);
 
                status = -EPROTONOSUPPORT;
@@ -238,7 +238,7 @@ static void gb_operation_request_handle(struct gb_operation *operation)
        ret = gb_operation_response_send(operation, status);
        if (ret) {
                dev_err(&connection->hd->dev,
-                       "%s: failed to send response %d for type 0x%02hhx: %d\n",
+                       "%s: failed to send response %d for type 0x%02x: %d\n",
                        connection->name, status, operation->type, ret);
                        return;
        }
@@ -797,7 +797,7 @@ void greybus_message_sent(struct gb_host_device *hd,
        if (message == operation->response) {
                if (status) {
                        dev_err(&connection->hd->dev,
-                               "%s: error sending response 0x%02hhx: %d\n",
+                               "%s: error sending response 0x%02x: %d\n",
                                connection->name, operation->type, status);
                }
                gb_operation_put_active(operation);
@@ -868,7 +868,7 @@ static void gb_connection_recv_response(struct gb_connection *connection,
        operation = gb_operation_find_outgoing(connection, operation_id);
        if (!operation) {
                dev_err(&connection->hd->dev,
-                       "%s: unexpected response id 0x%04hx received\n",
+                       "%s: unexpected response id 0x%04x received\n",
                        connection->name, operation_id);
                return;
        }
@@ -877,7 +877,7 @@ static void gb_connection_recv_response(struct gb_connection *connection,
        message_size = sizeof(*message->header) + message->payload_size;
        if (!errno && size != message_size) {
                dev_err(&connection->hd->dev,
-                       "%s: malformed response 0x%02hhx received (%zu != %zu)\n",
+                       "%s: malformed response 0x%02x received (%zu != %zu)\n",
                        connection->name, message->header->type, size,
                        message_size);
                errno = -EMSGSIZE;
@@ -926,7 +926,7 @@ void gb_connection_recv(struct gb_connection *connection,
        msg_size = le16_to_cpu(header.size);
        if (size < msg_size) {
                dev_err(dev,
-                       "%s: incomplete message 0x%04hx of type 0x%02hhx received (%zu < %zu)\n",
+                       "%s: incomplete message 0x%04x of type 0x%02x received (%zu < %zu)\n",
                        connection->name, le16_to_cpu(header.operation_id),
                        header.type, size, msg_size);
                return;         /* XXX Should still complete operation */
@@ -1036,7 +1036,7 @@ int gb_operation_sync_timeout(struct gb_connection *connection, int type,
        ret = gb_operation_request_send_sync_timeout(operation, timeout);
        if (ret) {
                dev_err(&connection->hd->dev,
-                       "%s: synchronous operation of type 0x%02hhx failed: %d\n",
+                       "%s: synchronous operation of type 0x%02x failed: %d\n",
                        connection->name, type, ret);
        } else {
                if (response_size) {
index 47b74799090267be07a2969b1cb62c1565ef28bd..aadb793912fd8b7d45e486461a75ae3d39419795 100644 (file)
@@ -166,7 +166,7 @@ int gb_protocol_get_version(struct gb_connection *connection)
 
        if (response.major > connection->protocol->major) {
                dev_err(&connection->hd->dev,
-                       "%s: unsupported major version (%hhu > %hhu)\n",
+                       "%s: unsupported major version (%u > %u)\n",
                        connection->name, response.major,
                        connection->protocol->major);
                return -ENOTSUPP;
@@ -176,7 +176,7 @@ int gb_protocol_get_version(struct gb_connection *connection)
        connection->module_minor = response.minor;
 
        dev_dbg(&connection->hd->dev,
-               "%s: %s (0x%02hhx) v%hhu.%hhu\n", connection->name,
+               "%s: %s (0x%02x) v%u.%u\n", connection->name,
                protocol->name, protocol->id, response.major, response.minor);
 
        return 0;
index 220aed0168afe037e9e0d318b6c57a2fb3f6fa30..4514e869a288784f328514df2ec6f6e4aaa126f6 100644 (file)
@@ -85,14 +85,14 @@ int gb_svc_dme_peer_get(struct gb_svc *svc, u8 intf_id, u16 attr, u16 selector,
                                &request, sizeof(request),
                                &response, sizeof(response));
        if (ret) {
-               dev_err(&svc->dev, "failed to get DME attribute (%hhu %hx %hu): %d\n",
+               dev_err(&svc->dev, "failed to get DME attribute (%u %04x %u): %d\n",
                                intf_id, attr, selector, ret);
                return ret;
        }
 
        result = le16_to_cpu(response.result_code);
        if (result) {
-               dev_err(&svc->dev, "UniPro error while getting DME attribute (%hhu %hx %hu): %hu\n",
+               dev_err(&svc->dev, "UniPro error while getting DME attribute (%u %04x %u): %u\n",
                                intf_id, attr, selector, result);
                return -EIO;
        }
@@ -121,14 +121,14 @@ int gb_svc_dme_peer_set(struct gb_svc *svc, u8 intf_id, u16 attr, u16 selector,
                                &request, sizeof(request),
                                &response, sizeof(response));
        if (ret) {
-               dev_err(&svc->dev, "failed to set DME attribute (%hhu %hx %hu %u): %d\n",
+               dev_err(&svc->dev, "failed to set DME attribute (%u %04x %u %u): %d\n",
                                intf_id, attr, selector, value, ret);
                return ret;
        }
 
        result = le16_to_cpu(response.result_code);
        if (result) {
-               dev_err(&svc->dev, "UniPro error while setting DME attribute (%hhu %hx %hu %u): %hu\n",
+               dev_err(&svc->dev, "UniPro error while setting DME attribute (%u %04x %u %u): %u\n",
                                intf_id, attr, selector, value, result);
                return -EIO;
        }
@@ -232,7 +232,7 @@ void gb_svc_connection_destroy(struct gb_svc *svc, u8 intf1_id, u16 cport1_id,
        ret = gb_operation_sync(connection, GB_SVC_TYPE_CONN_DESTROY,
                                &request, sizeof(request), NULL, 0);
        if (ret) {
-               dev_err(&svc->dev, "failed to destroy connection (%hhu:%hu %hhu:%hu): %d\n",
+               dev_err(&svc->dev, "failed to destroy connection (%u:%u %u:%u): %d\n",
                                intf1_id, cport1_id, intf2_id, cport2_id, ret);
        }
 }
@@ -265,7 +265,7 @@ static void gb_svc_route_destroy(struct gb_svc *svc, u8 intf1_id, u8 intf2_id)
        ret = gb_operation_sync(svc->connection, GB_SVC_TYPE_ROUTE_DESTROY,
                                &request, sizeof(request), NULL, 0);
        if (ret) {
-               dev_err(&svc->dev, "failed to destroy route (%hhu %hhu): %d\n",
+               dev_err(&svc->dev, "failed to destroy route (%u %u): %d\n",
                                intf1_id, intf2_id, ret);
        }
 }
@@ -287,7 +287,7 @@ static int gb_svc_version_request(struct gb_operation *op)
        request = op->request->payload;
 
        if (request->major > GB_SVC_VERSION_MAJOR) {
-               dev_warn(&svc->dev, "unsupported major version (%hhu > %hhu)\n",
+               dev_warn(&svc->dev, "unsupported major version (%u > %u)\n",
                                request->major, GB_SVC_VERSION_MAJOR);
                return -ENOTSUPP;
        }
@@ -380,14 +380,14 @@ static void gb_svc_process_intf_hotplug(struct gb_operation *operation)
                 * Remove the interface and add it again, and let user know
                 * about this with a print message.
                 */
-               dev_info(&svc->dev, "removing interface %hhu to add it again\n",
+               dev_info(&svc->dev, "removing interface %u to add it again\n",
                                intf_id);
                gb_svc_intf_remove(svc, intf);
        }
 
        intf = gb_interface_create(hd, intf_id);
        if (!intf) {
-               dev_err(&svc->dev, "failed to create interface %hhu\n",
+               dev_err(&svc->dev, "failed to create interface %u\n",
                                intf_id);
                return;
        }
@@ -413,14 +413,14 @@ static void gb_svc_process_intf_hotplug(struct gb_operation *operation)
                                   GB_DEVICE_ID_MODULES_START, 0, GFP_KERNEL);
        if (device_id < 0) {
                ret = device_id;
-               dev_err(&svc->dev, "failed to allocate device id for interface %hhu: %d\n",
+               dev_err(&svc->dev, "failed to allocate device id for interface %u: %d\n",
                                intf_id, ret);
                goto destroy_interface;
        }
 
        ret = gb_svc_intf_device_id(svc, intf_id, device_id);
        if (ret) {
-               dev_err(&svc->dev, "failed to set device id %hhu for interface %hhu: %d\n",
+               dev_err(&svc->dev, "failed to set device id %u for interface %u: %d\n",
                                device_id, intf_id, ret);
                goto ida_put;
        }
@@ -431,14 +431,14 @@ static void gb_svc_process_intf_hotplug(struct gb_operation *operation)
        ret = gb_svc_route_create(svc, svc->ap_intf_id, GB_DEVICE_ID_AP,
                                  intf_id, device_id);
        if (ret) {
-               dev_err(&svc->dev, "failed to create route to interface %hhu (device id %hhu): %d\n",
+               dev_err(&svc->dev, "failed to create route to interface %u (device id %u): %d\n",
                                intf_id, device_id, ret);
                goto svc_id_free;
        }
 
        ret = gb_interface_init(intf, device_id);
        if (ret) {
-               dev_err(&svc->dev, "failed to initialize interface %hhu (device id %hhu): %d\n",
+               dev_err(&svc->dev, "failed to initialize interface %u (device id %u): %d\n",
                                intf_id, device_id, ret);
                goto destroy_route;
        }
@@ -474,7 +474,7 @@ static void gb_svc_process_intf_hot_unplug(struct gb_operation *operation)
 
        intf = gb_interface_find(hd, intf_id);
        if (!intf) {
-               dev_warn(&svc->dev, "could not find hot-unplug interface %hhu\n",
+               dev_warn(&svc->dev, "could not find hot-unplug interface %u\n",
                                intf_id);
                return;
        }