Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2013349yba; Mon, 15 Apr 2019 03:09:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqwKMENjE+KVpZFLrShYH5uaZjKKdocqqj2AA3IsW4Jhp0FqFAJQEiQAm29ED/+eJQE6/ULJ X-Received: by 2002:a17:902:e704:: with SMTP id co4mr33775562plb.30.1555322995992; Mon, 15 Apr 2019 03:09:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555322995; cv=none; d=google.com; s=arc-20160816; b=vk/jACpyxrZXQIEHkAnG2EOdS1T2/MICYWIxYfizceCF+wb2TdYzQB6EIYnU/VPKan pJb7lJMncLfGwRuOczLf2Buexp6nedrTKMyUcU4/ftZlK7orHTss1fWuO3qGtH4ISuRU s12sYz+uIVzyI+CcUEJkkqVHK2IY2/be6kG+4Dbkt64IdJKpkfIAoKOqoEP/0TkDh8vS ePe7RBnAh9DpG85eKqz6qvvLEK1MJh18IXBFEIliR12SWKqeLg2gWJ5fTAePgyOgRaFv tCkE2J1aa2RzkHg9NJyY5xgTy0UsXI3qHrbcVzMxOl2mrirUTeXhIsuaDOy/IlhppDQw /FZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language:thread-index :content-transfer-encoding:mime-version:message-id:date:subject :in-reply-to:references:cc:to:from:dkim-signature; bh=jBnwa5USPpoMQONRhBbKGlPlRC+X5DONJrcElJTE9kM=; b=HDNp0eSeoIo01824yYRJwml98MeJu9tdO442w+pWY/GlUc4X0jboGcL1G2F7LgEjs4 ujnaxNOq8ZK6fp7/kf/fxDqhfDPZH6DWPFEvaC3J2jF8H9pL2fByGAdWTpIJhn9hG/FK Di8lYTCuDjW0X4JqdpTESSZR6ym2KP5EYqamUtJ/TwctHSlF4dmhVDwaNKj+e7tFOt// GlpNxarrkdjymwxNsscmC2aqtiJgmjrUZnKk5FM3JJwyK9VKx3MSPfnJlVBCEPwaGBRJ gKhKGU+muRKSd4sW2Y9ULE27+GdqgIZgqB55Tvyatqsp/qLfsgBR7gtAOm72ZeG4J30T JNlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@d-silva.org header.s=201810a header.b=kMNWUtJJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 92si25905667pli.8.2019.04.15.03.09.38; Mon, 15 Apr 2019 03:09:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@d-silva.org header.s=201810a header.b=kMNWUtJJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727140AbfDOKH2 (ORCPT + 99 others); Mon, 15 Apr 2019 06:07:28 -0400 Received: from ushosting.nmnhosting.com ([167.160.173.127]:43656 "EHLO ushosting.nmnhosting.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725794AbfDOKH2 (ORCPT ); Mon, 15 Apr 2019 06:07:28 -0400 Received: from mail2.nmnhosting.com (unknown [202.169.106.97]) by ushosting.nmnhosting.com (Postfix) with ESMTPS id 1806F2F28FBB; Mon, 15 Apr 2019 06:07:24 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=d-silva.org; s=201810a; t=1555322845; bh=t09Knx8R5HfcZX8J+2yfarnsGrDTECfqtExsbS+W1mE=; h=From:To:Cc:References:In-Reply-To:Subject:Date:From; b=kMNWUtJJGkTY37RBDPDNzpNbgYjTzzev5jSu074WJF5x66i6AzjklMQxc6s1vuDdt KYzD05HCHCN0gSIYihNVo9Wz7JiCsnV6X5NAtdjm0RRJ3bPZhkxLKbxcp1ew5KfhwT AqD2U30GGY10GbGL2mTFTi2dWxmNdSY71M7B0aNHo/c30iH4AMUaHcwz58+ch5KG8Y Yj4n/ITZrdch1b3fEhvbXOd8HJxP10TthIaYRl3tHRNo4FM4JXm4tbi9lzwbo/+zKA XyR/hnhc/dndRGyR9PCq5pdt0/EeG7wc8yyKJJa6F3/tK/Tbq11GRcmg/nYfySL/P8 bA0qzdtOwOgSjhBVcgWBj/VzXn9mqR4niQFtQ6wqgZqJG6JcL68/KxvXcwHgkH/qAB vGzRoD883zXi/7dHV1uO1rW9n0PiriDz3M+EwetK82bGUqWPRBwd23M4ZFTYP9UGye pn7BZ+27NnxvDiShGlJyX95T01CjQD7AOuBIQkHv4LpuT9Sg/nPst8lpv890sYLrBW jn2mCeOXCD0vzxYMZcIG/Reb0GpYEOnUHM+ULPnF/XuaoTnzM1Rwqgdd1hi4YXyi1+ UJalVDCCuJjWGujnF+4H0xFvIuI96v2ExzZ08tneQ23n3dOoYWwRJu7yUgf3ZFbOEM hNg++l+W72BaPPeRkPUOdYx4= Received: from Hawking (ntp.lan [10.0.1.1]) (authenticated bits=0) by mail2.nmnhosting.com (8.15.2/8.15.2) with ESMTPSA id x3FA7BdX038442 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 15 Apr 2019 20:07:12 +1000 (AEST) (envelope-from alastair@d-silva.org) From: "Alastair D'Silva" To: "'Petr Mladek'" Cc: "'Alastair D'Silva'" , "'Jani Nikula'" , "'Joonas Lahtinen'" , "'Rodrigo Vivi'" , "'David Airlie'" , "'Daniel Vetter'" , "'Karsten Keil'" , "'Jassi Brar'" , "'Tom Lendacky'" , "'David S. Miller'" , "'Jose Abreu'" , "'Kalle Valo'" , "'Stanislaw Gruszka'" , "'Benson Leung'" , "'Enric Balletbo i Serra'" , "'James E.J. Bottomley'" , "'Martin K. Petersen'" , "'Greg Kroah-Hartman'" , "'Alexander Viro'" , "'Sergey Senozhatsky'" , "'Steven Rostedt'" , "'Andrew Morton'" , , , , , , , , , , References: <20190410031720.11067-1-alastair@au1.ibm.com> <20190410031720.11067-4-alastair@au1.ibm.com> <20190412141211.lvnz6wb7mwkykmxf@pathway.suse.cz> <093301d4f187$da0756a0$8e1603e0$@d-silva.org> <20190415092424.qos7d54nbyr5hphu@pathway.suse.cz> In-Reply-To: <20190415092424.qos7d54nbyr5hphu@pathway.suse.cz> Subject: RE: [PATCH 3/4] lib/hexdump.c: Replace ascii bool in hex_dump_to_buffer with flags Date: Mon, 15 Apr 2019 20:07:10 +1000 Message-ID: <0da301d4f373$01d5bb80$05813280$@d-silva.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQMagew30YCVD5mEhyHx4HPts9xr1ALvlgN3AdorRAgCCza9VAHVj+h+o2yMYSA= Content-Language: en-au X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.2 (mail2.nmnhosting.com [10.0.1.20]); Mon, 15 Apr 2019 20:07:19 +1000 (AEST) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > -----Original Message----- > From: Petr Mladek > Sent: Monday, 15 April 2019 7:24 PM > To: Alastair D'Silva > Cc: 'Alastair D'Silva' ; 'Jani Nikula' > ; 'Joonas Lahtinen' > ; 'Rodrigo Vivi' ; > 'David Airlie' ; 'Daniel Vetter' ; 'Karsten > Keil' ; 'Jassi Brar' ; 'Tom > Lendacky' ; 'David S. Miller' > ; 'Jose Abreu' ; 'Kalle > Valo' ; 'Stanislaw Gruszka' ; > 'Benson Leung' ; 'Enric Balletbo i Serra' > ; 'James E.J. Bottomley' > ; 'Martin K. Petersen' ; > 'Greg Kroah-Hartman' ; 'Alexander Viro' > ; 'Sergey Senozhatsky' > ; 'Steven Rostedt' > ; 'Andrew Morton' ; > intel-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org; linux- > kernel@vger.kernel.org; netdev@vger.kernel.org; > ath10k@lists.infradead.org; linux-wireless@vger.kernel.org; linux- > scsi@vger.kernel.org; linux-fbdev@vger.kernel.org; > devel@driverdev.osuosl.org; linux-fsdevel@vger.kernel.org > Subject: Re: [PATCH 3/4] lib/hexdump.c: Replace ascii bool in > hex_dump_to_buffer with flags > > On Sat 2019-04-13 09:31:27, Alastair D'Silva wrote: > > > -----Original Message----- > > > From: Petr Mladek > > > Sent: Saturday, 13 April 2019 12:12 AM > > > To: Alastair D'Silva > > > Cc: alastair@d-silva.org; Jani Nikula ; > > Joonas > > > Lahtinen ; Rodrigo Vivi > > > ; David Airlie ; Daniel > > > Vetter ; Karsten Keil ; Jassi > > > Brar ; Tom Lendacky > > > ; David S. Miller > ; > > > Jose Abreu ; Kalle Valo > > > ; Stanislaw Gruszka ; > > > Benson Leung ; Enric Balletbo i Serra > > > ; James E.J. Bottomley > > > ; Martin K. Petersen > > > ; Greg Kroah-Hartman > > > ; Alexander Viro > > > ; Sergey Senozhatsky > > > ; Steven Rostedt > > > ; Andrew Morton foundation.org>; > > > intel- gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org; > > > linux- kernel@vger.kernel.org; netdev@vger.kernel.org; > > > ath10k@lists.infradead.org; linux-wireless@vger.kernel.org; linux- > > > scsi@vger.kernel.org; linux-fbdev@vger.kernel.org; > > > devel@driverdev.osuosl.org; linux-fsdevel@vger.kernel.org > > > Subject: Re: [PATCH 3/4] lib/hexdump.c: Replace ascii bool in > > > hex_dump_to_buffer with flags > > > > > > On Wed 2019-04-10 13:17:19, Alastair D'Silva wrote: > > > > From: Alastair D'Silva > > > > > > > > In order to support additional features in hex_dump_to_buffer, > > > > replace the ascii bool parameter with flags. > > > > > > > > Signed-off-by: Alastair D'Silva > > > > --- > > > > drivers/gpu/drm/i915/intel_engine_cs.c | 2 +- > > > > drivers/isdn/hardware/mISDN/mISDNisar.c | 6 ++++-- > > > > drivers/mailbox/mailbox-test.c | 2 +- > > > > drivers/net/ethernet/amd/xgbe/xgbe-drv.c | 2 +- > > > > drivers/net/ethernet/synopsys/dwc-xlgmac-common.c | 2 +- > > > > drivers/net/wireless/ath/ath10k/debug.c | 3 ++- > > > > drivers/net/wireless/intel/iwlegacy/3945-mac.c | 2 +- > > > > drivers/platform/chrome/wilco_ec/debugfs.c | 3 ++- > > > > drivers/scsi/scsi_logging.c | 8 +++----- > > > > drivers/staging/fbtft/fbtft-core.c | 2 +- > > > > fs/seq_file.c | 3 ++- > > > > include/linux/printk.h | 2 +- > > > > lib/hexdump.c | 15 ++++++++------- > > > > lib/test_hexdump.c | 5 +++-- > > > > 14 files changed, 31 insertions(+), 26 deletions(-) > > > > > > > > diff --git a/drivers/gpu/drm/i915/intel_engine_cs.c > > > > b/drivers/gpu/drm/i915/intel_engine_cs.c > > > > index 49fa43ff02ba..fb133e729f9a 100644 > > > > --- a/drivers/gpu/drm/i915/intel_engine_cs.c > > > > +++ b/drivers/gpu/drm/i915/intel_engine_cs.c > > > > @@ -1318,7 +1318,7 @@ static void hexdump(struct drm_printer *m, > > > > const > > > void *buf, size_t len) > > > > WARN_ON_ONCE(hex_dump_to_buffer(buf + pos, len - > > > pos, > > > > rowsize, sizeof(u32), > > > > line, sizeof(line), > > > > - false) >= sizeof(line)); > > > > + 0) >= sizeof(line)); > > > > > > It might be more clear when we define: > > > > > > #define HEXDUMP_BINARY 0 > > > > This feels unnecessary, and weird. Omitting the flag won't disable the > > hex output (as expected), and if you don't want hex output why call > > hexdump in the first place? > > Why do we have HEXDUMP_ASCII then? > Why is the above funtion not using HEXDUMP_ASCII? > Who would call it with (HEXDUMP_ASCII | HEXDUMP_BINARY)? The ASCII flag controls the optional ASCII output, and replaces the boolean that existed prior. A user would enable it in the same situations where they currently pass true for the ascii parameter. In the above example the author only wants the hex output, while in other situations, both hex & ASCII output is desirable. If you just want ASCII output, the caller should just use a printk or one of it's wrappers. -- Alastair D'Silva mob: 0423 762 819 skype: alastair_dsilva msn: alastair@d-silva.org blog: http://alastair.d-silva.org Twitter: @EvilDeece