From patchwork Sat Mar 10 12:24:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scheller X-Patchwork-Id: 10273449 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id ECE40605CE for ; Sat, 10 Mar 2018 12:24:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CBEFC29AAA for ; Sat, 10 Mar 2018 12:24:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BE6AA29AC9; Sat, 10 Mar 2018 12:24:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4982C29AAA for ; Sat, 10 Mar 2018 12:24:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752131AbeCJMYr (ORCPT ); Sat, 10 Mar 2018 07:24:47 -0500 Received: from mail-wr0-f194.google.com ([209.85.128.194]:34074 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752085AbeCJMYr (ORCPT ); Sat, 10 Mar 2018 07:24:47 -0500 Received: by mail-wr0-f194.google.com with SMTP id o8so11411747wra.1 for ; Sat, 10 Mar 2018 04:24:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=a4zYsjXjMwA1OJ4JXeTundlqexpjesoAw7Yzwfoc7ag=; b=uOU9L5/0JBNeaFN98rui6vXuBlga9ZptuxRBaOTE3dv54/5xmTPfAfjEVl7p+TzGgI ZMfTUHgQUk1W75Fyl0J6vKaABjgq/Q5h7sqG0JeX8+xgXKhqQOBjyAKWZzQ7Kbp1kQwO WxkFvZbvPJyY6lPx7/2iOziNQYy4e2/TxO0bnSdnNDM53UROoVEEU5ysOaQTKnPA+0sq 132rbdvTAr7XF7FjL6/fWwpAXjQZJwcB1+JDhSMWceeftyk0bns2qtbtQp/VU2Mqh+t3 +YtSULJVIfQrJwtU4LU90p7zeEUERRGcfRW3TEnfBGF/wMrqWEodsXrzl9bvHjoD5b20 fCRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=a4zYsjXjMwA1OJ4JXeTundlqexpjesoAw7Yzwfoc7ag=; b=qczdgRHvOlqtDjHdv+QqwRZqMpWqQfRyot8RNCdy2pA8OCSinlGYEKLweDMRHBeLwL wjCy6pA1Y5pxr9pt/O/YlwiEV+dUmKkVl+8m1ErdG8oy8zFVu06PN4nDMvRaGhIuy6HA s1sixejjYL/r1sdC7KzRPrQ8fbSu8vg8KvHSJn64HJVG4V6IthA0hnW2tQhXHnJFXG/d A6q5NKb0AaT/iw9+7/xdWm/fZfwnbk6lbwKh4jA1hy19wShignYkNA9njTOVJzQr4CqW WqVeOXIixvMWSM9o5Y5bQOSYQ/wtbBq1765KLZzdaX77EThR4bWkL/lQ87KcHstb6uMB eK2A== X-Gm-Message-State: AElRT7FcYOE925F6m4yQDGMZkod/YwdgCcvZ/7DToIS8eOSDp45ulVA9 Yv5Csb1SvGraMWEtg/vZkDbdPA== X-Google-Smtp-Source: AG47ELuUzWHTuYgSzcY+5VlVY5zjz8oBDSWmq4HVFYun0yb1w++s9uGM4akalDlnURCke7F22Op8oA== X-Received: by 10.223.132.67 with SMTP id 61mr658884wrf.259.1520684685671; Sat, 10 Mar 2018 04:24:45 -0800 (PST) Received: from dvbdev.wuest.de (ip-84-118-193-200.unity-media.net. [84.118.193.200]) by smtp.gmail.com with ESMTPSA id x107sm3903619wrb.97.2018.03.10.04.24.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 10 Mar 2018 04:24:44 -0800 (PST) From: Daniel Scheller To: linux-media@vger.kernel.org, mchehab@kernel.org, mchehab@s-opensource.com Subject: [PATCH] [media] ttpci: improve printing of encoded MAC address Date: Sat, 10 Mar 2018 13:24:43 +0100 Message-Id: <20180310122443.32652-1-d.scheller.oss@gmail.com> X-Mailer: git-send-email 2.16.1 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Daniel Scheller When loading the budget_av driver for ie. a KNC1 DVB-C TDA10024 card, which makes use of the ttpci eeprom check functionality (that always fails on these cards, but that's no issue at all), this is printed to the kernel log: [ 10.497333] saa7146 (0): dma buffer size 192512 [ 10.497335] dvbdev: DVB: registering new adapter (KNC1 DVB-C TDA10024) [ 10.545007] adapter failed MAC signature check [ 10.545009] encoded MAC from EEPROM was [ 10.545010] ff: [ 10.545011] ff: [ 10.545011] ff: ... [ 10.545021] ff [ 10.832422] budget_av: KNC1-4: MAC addr = 00:09:d6:6d:b3:be with the 'ff' being repeated for a total of 20 times. Improve that by using the %*phC format specifier instead dprintk()'ing every byte of the encoded MAC separately. This obsoletes the int i, and the kernel log looks cleaner: [ 3234.383153] saa7146 (0): dma buffer size 192512 [ 3234.383154] dvbdev: DVB: registering new adapter (KNC1 DVB-C TDA10024) [ 3234.428745] adapter failed MAC signature check [ 3234.428747] encoded MAC from EEPROM was ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff [ 3234.728194] budget_av: KNC1-0: MAC addr = 00:09:d6:6d:b3:be Signed-off-by: Daniel Scheller --- drivers/media/pci/ttpci/ttpci-eeprom.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/media/pci/ttpci/ttpci-eeprom.c b/drivers/media/pci/ttpci/ttpci-eeprom.c index 9534f29c1ffd..78c7a6589be5 100644 --- a/drivers/media/pci/ttpci/ttpci-eeprom.c +++ b/drivers/media/pci/ttpci/ttpci-eeprom.c @@ -138,7 +138,7 @@ static int ttpci_eeprom_read_encodedMAC(struct i2c_adapter *adapter, u8 * encode int ttpci_eeprom_parse_mac(struct i2c_adapter *adapter, u8 *proposed_mac) { - int ret, i; + int ret; u8 encodedMAC[20]; u8 decodedMAC[6]; @@ -153,11 +153,8 @@ int ttpci_eeprom_parse_mac(struct i2c_adapter *adapter, u8 *proposed_mac) ret = getmac_tt(decodedMAC, encodedMAC); if( ret != 0 ) { dprintk("adapter failed MAC signature check\n"); - dprintk("encoded MAC from EEPROM was " ); - for(i=0; i<19; i++) { - dprintk( "%.2x:", encodedMAC[i]); - } - dprintk("%.2x\n", encodedMAC[19]); + dprintk("encoded MAC from EEPROM was %*phC", + (int)sizeof(encodedMAC), &encodedMAC); eth_zero_addr(proposed_mac); return ret; }