Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp111713ybi; Thu, 1 Aug 2019 15:38:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqwfI12LXfIXGTZ56bCWCRk5BQpnm6hv8+Rosc/B9spHrut2hQxdwZN7s76/YtzbXfmHMSrG X-Received: by 2002:a17:902:925:: with SMTP id 34mr127415117plm.334.1564699135589; Thu, 01 Aug 2019 15:38:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564699135; cv=none; d=google.com; s=arc-20160816; b=U0DdiQccZfW5xrdmjUlr0gLb5ZNg7v5ghaS071W1S1HxNtJJdixFcanvACdyMi+VUY W/gQlPXYkC304y/mJjeeWsQs+64zUK3a+M8kZm5Tnbkd5FxAPb3kW5jvjExB9owWyJQc EAcq1fbib9OyQZucad+OzXe1DPfMSmOSeL+EYrDsaI9fDbKNbHhQ/G9PF+eZv+BqY6HD BRvJ/nG/Q2PcqbDkeR2vF0Im4F6YajM9Vdt3kLq1bkmvk6FVuGC/pLKvh5mgFZ8ipnef BUz1Hu/H3MXgHCPqe5sVlQ2lklRmtq3vGAW/B5J1ZC2wAmuA1sW+ytNVDhMzhjH+un75 ZPAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:from:subject:cc:to:message-id:date; bh=gb8Qw9ZeCSpIGkaDzdHPTi6RtWhpSr+690uxwxGh8xE=; b=q/gju8L2wG4f76L7Xli3mvDEpgp05IbI3zMKB1fJhtYfyUzmajR88d5wyKq6aUTvsh X98NHKkbJ1jg13q02EpabRRrKW2w7sT94zDqDFHNnTfxhOV2b99ih1g4FbeYWIGKAM2L wylseiC4+Y5Z4CXR5AX4TbO6zaznCOL7VqStPRPxgtUrBK/RbKuThxsuTlC7BFAb0k6g C0uqDk1iDsTkW6tDWST7CkQDtTapUAb6YwAqCuumKkCzQhTX7iadsnVRz3AfELE95WYY eeeTiqY2s25iFArndd5y1jHgjbZSj6/5vdXZP3jGulgYN4hTHBBzpRyHNDG0YQvE5CCw 2yGw== ARC-Authentication-Results: i=1; mx.google.com; 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 q2si34651119plh.59.2019.08.01.15.38.40; Thu, 01 Aug 2019 15:38: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; 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 S1732968AbfHAQ1u (ORCPT + 99 others); Thu, 1 Aug 2019 12:27:50 -0400 Received: from shards.monkeyblade.net ([23.128.96.9]:56624 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729293AbfHAQ1u (ORCPT ); Thu, 1 Aug 2019 12:27:50 -0400 Received: from localhost (unknown [IPv6:2603:3004:624:eb00::2d06]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id CB304153EF902; Thu, 1 Aug 2019 09:27:48 -0700 (PDT) Date: Thu, 01 Aug 2019 12:27:45 -0400 (EDT) Message-Id: <20190801.122745.9301893283319822.davem@davemloft.net> To: avifishman70@gmail.com Cc: venture@google.com, yuenn@google.com, benjaminfair@google.com, robh+dt@kernel.org, mark.rutland@arm.com, gregkh@linuxfoundation.org, tmaimon77@gmail.com, tali.perry1@gmail.com, openbmc@lists.ozlabs.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, tglx@linutronix.de Subject: Re: [PATCH v1 2/2] net: npcm: add NPCM7xx EMC 10/100 Ethernet driver From: David Miller In-Reply-To: <20190801072611.27935-3-avifishman70@gmail.com> References: <20190801072611.27935-1-avifishman70@gmail.com> <20190801072611.27935-3-avifishman70@gmail.com> X-Mailer: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Thu, 01 Aug 2019 09:27:49 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Avi Fishman Date: Thu, 1 Aug 2019 10:26:11 +0300 > +#Eternet 10/100 EMC "Ethernet" > +#ifdef CONFIG_NPCM7XX_EMC_ETH_DEBUG > +#define DEBUG > +#endif Please don't control the DEBUG define in this way. > +#if defined CONFIG_NPCM7XX_EMC_ETH_DEBUG || defined CONFIG_DEBUG_FS > +#define REG_PRINT(reg_name) {t = scnprintf(next, size, "%-10s = %08X\n", \ > + #reg_name, readl(ether->reg + (reg_name))); size -= t; next += t; } > +#define DUMP_PRINT(f, x...) {t = scnprintf(next, size, f, ## x); size -= t; \ > + next += t; } Really, get rid of this custom debugging infrastructure and just use generic facilities the kernel has for this, as designed. > +static int npcm7xx_info_dump(char *buf, int count, struct net_device *netdev) > +{ > + struct npcm7xx_ether *ether = netdev_priv(netdev); > + struct npcm7xx_txbd *txbd; > + struct npcm7xx_rxbd *rxbd; > + unsigned long flags; > + unsigned int i, cur, txd_offset, rxd_offset; > + char *next = buf; > + unsigned int size = count; > + int t; > + int is_locked = spin_is_locked(ðer->lock); Reverse christmas tree (longest to shortest) ordering for local variables please. Audit your entire submission for this problem.