Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2f3db927 authored by Viresh Kumar's avatar Viresh Kumar Committed by Greg Kroah-Hartman
Browse files

greybus: don't use %h and %hh for printing short and char variables



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: default avatarJohan Hovold <johan@hovoldconsulting.com>
Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: default avatarJohan Hovold <johan@hovoldconsulting.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 4aac6c5a
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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;
+3 −3
Original line number Diff line number Diff line
@@ -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;
+2 −2
Original line number Diff line number Diff line
@@ -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);
		}
	}
+1 −1
Original line number Diff line number Diff line
@@ -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;
	}
}
+1 −1
Original line number Diff line number Diff line
@@ -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);

Loading