Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp211078ybg; Tue, 2 Jun 2020 21:49:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz2ZNemA9MwYSwmOqDSx+ZU40pBfrdX/mY9efotZueX2O7OVY9FfUNHY8bWYcVowJOsMnWF X-Received: by 2002:a17:906:8492:: with SMTP id m18mr25752427ejx.168.1591159760605; Tue, 02 Jun 2020 21:49:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591159760; cv=none; d=google.com; s=arc-20160816; b=bRQhpl31ZGFOQ2EoQQ4Gkhe+3Nd+WHVRtHgjSkzEhmoADIwZG/ZURcYCPGl1nNirHo rPa2dePyyhsdCpL/5MAh41AzVxHVNlOs2Zam0QjJGRrfM4XO8Dam2kfU/OuRTLUXapCm uF5t2gTZF5Q2l2tWl8Rs4Y1XnWx9TPeLXn80kqTOKqluj2ONywY3MMefuoa4J/BD5/iq ZeH8JdWWruz7xBJPW7MqOo+dKQ2U2ql7aNPhmLvocFoWIFrNMRL2Et2XhLJrB2Sqa+Rc NLVKNmXV40SkzljKyPHLN5l7fVGraQzxF8QwJ8B3DxamQL3i+S930kwiiCKGhBU5dOqO 0wuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=5HyznCRSqZKzp8yxYccefdnyUnHkOKLPSiD7FrX1pVE=; b=dmkfL46DRlvg5p5t4mf5wlQTY/EIrmLp4JsVm03QJFoUh5MqoYjeQRY2hAESnU2l4H WUtrB1PvqdywkDf26W1ykOPv9/XrK2+SjMnAYVAgv4XsFUHq7Nxda/QZ5u0iUHD5om2P WP3hxlGHbh8QiPo/O43qiOAP6tNVKQf1UwMCWequZAiw6GfJGFSSHAYbg8wviqdABhog o8wMBQaua/HqKS9F3l48pyD+FeC+F1Y1vlB0F866fv9o1i1EtCPLcDEXIfgaiHmbfnt2 1e+YKrRMEF0PcvwJ9zQlv7wtTZP6reNK+Uom1Dz4AwdH6WPTSlERX8eCOasihvXFIWvf b+gQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OUe25Cg2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q8si457872edn.403.2020.06.02.21.48.57; Tue, 02 Jun 2020 21:49:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OUe25Cg2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725854AbgFCErH (ORCPT + 99 others); Wed, 3 Jun 2020 00:47:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725275AbgFCErH (ORCPT ); Wed, 3 Jun 2020 00:47:07 -0400 Received: from mail-lj1-x242.google.com (mail-lj1-x242.google.com [IPv6:2a00:1450:4864:20::242]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D1A4C05BD43 for ; Tue, 2 Jun 2020 21:47:07 -0700 (PDT) Received: by mail-lj1-x242.google.com with SMTP id e4so1018483ljn.4 for ; Tue, 02 Jun 2020 21:47:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=5HyznCRSqZKzp8yxYccefdnyUnHkOKLPSiD7FrX1pVE=; b=OUe25Cg22WDYpRQ3XCaRcJ8nvIFDL++1wJ/8vhdCEGylPavhoKCvOcfB8UqmXCEEzm QAaJcNA0prtyQ4Ns5VW0t1iHhGEm4e2XLP+ankfK8QmKgzY5kgO00Chd5xwIoaDWSLdk Eia05lSaRZaSnrPlDc2RZ0iEM0bykCtNo2IGVdBBeP4tgWzqnItxIFYExBPCFbYjxos7 OAl9WiwYvn8Aq2u1ZqRqWMmS/j/WO1Rf6RhsDH4VRnz3uEyFQqv3epIy+2b7loQ5ejTq v3D/h2pdRkV/2t6joCyzshZ5JXZm658VhLGhQADOK0CoMox9NFKdr35dzQ2+wAUqMZIQ FrCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5HyznCRSqZKzp8yxYccefdnyUnHkOKLPSiD7FrX1pVE=; b=suIU/QamLA3Z2PdGpx+QTvCEVUgJDUQ6c2suekQNj5zkBUXeItnv9G+xAq+RWIvZly 1QzB1Oa3592C100OyIiGLMGbg3u4n1Pz4ygg+Ua2JZvFrZlfqP4ht/DC3I3ywSKuGU47 FhhGzSn32zFSIGR6h7MhIvhEJreEoRC04BZB3GPtRnPTYO0nAhcVFHI4mZwvCNeaJuhu MNtP8jQJxeA8TK2i3gv9WAEkRaH/eVLc96jkQP6OI/0th6hctHeXzxBPaLPmOgF+65N8 h91mNxOgEP9YZ55HM20I2da4INcpa/UBVoSr5DPJz7+14WbD6WCt7C4Y4mnrviuYEVL0 YLeg== X-Gm-Message-State: AOAM532nK1XE3JzI9DwqP/sfdsUYZJD7ebtF/vsGcvpApQjZ98ayx/76 x5RYLCcuwSR6c8NaXp+iPC/3oITMFyrXf+EQBYQRYg== X-Received: by 2002:a05:651c:1103:: with SMTP id d3mr1171214ljo.110.1591159625236; Tue, 02 Jun 2020 21:47:05 -0700 (PDT) MIME-Version: 1.0 References: <1590751607-29676-1-git-send-email-sumit.garg@linaro.org> <1590751607-29676-2-git-send-email-sumit.garg@linaro.org> In-Reply-To: From: Sumit Garg Date: Wed, 3 Jun 2020 10:16:53 +0530 Message-ID: Subject: Re: [PATCH v4 1/4] kdb: Re-factor kdb_printf() message write code To: Doug Anderson Cc: Daniel Thompson , kgdb-bugreport@lists.sourceforge.net, Jason Wessel , Petr Mladek , Sergey Senozhatsky , Greg Kroah-Hartman , Jiri Slaby , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 3 Jun 2020 at 03:02, Doug Anderson wrote: > > Hi, > > On Fri, May 29, 2020 at 4:27 AM Sumit Garg wrote: > > > > Re-factor kdb_printf() message write code in order to avoid duplication > > of code and thereby increase readability. > > > > Signed-off-by: Sumit Garg > > --- > > kernel/debug/kdb/kdb_io.c | 61 +++++++++++++++++++++++++---------------------- > > 1 file changed, 32 insertions(+), 29 deletions(-) > > > > diff --git a/kernel/debug/kdb/kdb_io.c b/kernel/debug/kdb/kdb_io.c > > index 924bc92..e46f33e 100644 > > --- a/kernel/debug/kdb/kdb_io.c > > +++ b/kernel/debug/kdb/kdb_io.c > > @@ -542,6 +542,33 @@ static int kdb_search_string(char *searched, char *searchfor) > > return 0; > > } > > > > +static void kdb_io_write(char *cp, int len) > > nit: "const char *" just to make it obvious that we don't modify the string? > > > > +{ > > + if (len == 0) > > + return; > > Remove the above check. It's double-overkill. Not only did you just > check in kdb_msg_write() but also the while loop below will do a > "no-op" just fine even without your check. > I will get rid of kdb_io_write() as per Daniel's comment on patch #4. > > > + > > + while (len--) { > > + dbg_io_ops->write_char(*cp); > > + cp++; > > + } > > +} > > + > > +static void kdb_msg_write(char *msg, int msg_len) > > nit: "const char *" just to make it obvious that we don't modify the string? > Okay. > > Other than those small things, this looks nice to me. Feel free to > add my Reviewed-by tag once small things are fixed. > Thanks. -Sumit > > -Doug