From patchwork Tue Sep 3 12:32:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 2853211 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 994789F3DC for ; Tue, 3 Sep 2013 12:33:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BE17E2031C for ; Tue, 3 Sep 2013 12:33:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8695E20303 for ; Tue, 3 Sep 2013 12:33:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759909Ab3ICMc5 (ORCPT ); Tue, 3 Sep 2013 08:32:57 -0400 Received: from mga02.intel.com ([134.134.136.20]:25967 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754408Ab3ICMcz (ORCPT ); Tue, 3 Sep 2013 08:32:55 -0400 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 03 Sep 2013 05:32:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.89,1014,1367996400"; d="scan'208";a="372708654" Received: from smile.fi.intel.com (HELO smile) ([10.237.72.173]) by orsmga001.jf.intel.com with ESMTP; 03 Sep 2013 05:32:38 -0700 Received: from andy by smile with local (Exim 4.80) (envelope-from ) id 1VGpmS-0004KI-Jl; Tue, 03 Sep 2013 15:32:24 +0300 From: Andy Shevchenko To: David Herrmann , Jiri Kosina , linux-input@vger.kernel.org Cc: Andy Shevchenko Subject: [PATCH] hid-wiimote: print small buffers via %*ph Date: Tue, 3 Sep 2013 15:32:24 +0300 Message-Id: <1378211544-16594-1-git-send-email-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 1.8.4.rc3 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-9.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Instead of passing each byte through stack let's use %*ph specifier to dump buffer as a hex string. Signed-off-by: Andy Shevchenko Acked-by: David Herrmann --- drivers/hid/hid-wiimote-core.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/hid/hid-wiimote-core.c b/drivers/hid/hid-wiimote-core.c index 6602098..ad3ac57 100644 --- a/drivers/hid/hid-wiimote-core.c +++ b/drivers/hid/hid-wiimote-core.c @@ -441,8 +441,7 @@ static __u8 wiimote_cmd_read_ext(struct wiimote_data *wdata, __u8 *rmem) if (ret != 6) return WIIMOTE_EXT_NONE; - hid_dbg(wdata->hdev, "extension ID: %02x:%02x %02x:%02x %02x:%02x\n", - rmem[0], rmem[1], rmem[2], rmem[3], rmem[4], rmem[5]); + hid_dbg(wdata->hdev, "extension ID: %6ph\n", rmem); if (rmem[0] == 0xff && rmem[1] == 0xff && rmem[2] == 0xff && rmem[3] == 0xff && rmem[4] == 0xff && rmem[5] == 0xff) @@ -512,14 +511,12 @@ static bool wiimote_cmd_read_mp(struct wiimote_data *wdata, __u8 *rmem) if (ret != 6) return false; - hid_dbg(wdata->hdev, "motion plus ID: %02x:%02x %02x:%02x %02x:%02x\n", - rmem[0], rmem[1], rmem[2], rmem[3], rmem[4], rmem[5]); + hid_dbg(wdata->hdev, "motion plus ID: %6ph\n", rmem); if (rmem[5] == 0x05) return true; - hid_info(wdata->hdev, "unknown motion plus ID: %02x:%02x %02x:%02x %02x:%02x\n", - rmem[0], rmem[1], rmem[2], rmem[3], rmem[4], rmem[5]); + hid_info(wdata->hdev, "unknown motion plus ID: %6ph\n", rmem); return false; } @@ -535,8 +532,7 @@ static __u8 wiimote_cmd_read_mp_mapped(struct wiimote_data *wdata) if (ret != 6) return WIIMOTE_MP_NONE; - hid_dbg(wdata->hdev, "mapped motion plus ID: %02x:%02x %02x:%02x %02x:%02x\n", - rmem[0], rmem[1], rmem[2], rmem[3], rmem[4], rmem[5]); + hid_dbg(wdata->hdev, "mapped motion plus ID: %6ph\n", rmem); if (rmem[0] == 0xff && rmem[1] == 0xff && rmem[2] == 0xff && rmem[3] == 0xff && rmem[4] == 0xff && rmem[5] == 0xff) @@ -1128,9 +1124,8 @@ static void wiimote_init_hotplug(struct wiimote_data *wdata) wiimote_ext_unload(wdata); if (exttype == WIIMOTE_EXT_UNKNOWN) { - hid_info(wdata->hdev, "cannot detect extension; %02x:%02x %02x:%02x %02x:%02x\n", - extdata[0], extdata[1], extdata[2], - extdata[3], extdata[4], extdata[5]); + hid_info(wdata->hdev, "cannot detect extension; %6ph\n", + extdata); } else if (exttype == WIIMOTE_EXT_NONE) { spin_lock_irq(&wdata->state.lock); wdata->state.exttype = WIIMOTE_EXT_NONE;