Received: by 10.213.65.68 with SMTP id h4csp937087imn; Wed, 14 Mar 2018 04:55:52 -0700 (PDT) X-Google-Smtp-Source: AG47ELuz3G/Xq5aqbF1yqreHOBI6ItcPHjUiCSGydeIGOshqLXkRLLogkSMCVGaCs0ASVuZxM3yC X-Received: by 2002:a17:902:7142:: with SMTP id u2-v6mr3801206plm.257.1521028552661; Wed, 14 Mar 2018 04:55:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521028552; cv=none; d=google.com; s=arc-20160816; b=X1lO1Y+PNjxXdz0UXfDH26CGuQL+glhwW8iYxzYHhNN1o1tHtqIkCJFVRlQwkF2zCa 8AF3dyPHIxEkCD9DHMPy45yW+Zb8ZG6WSML2Vc4blTV4nwfuAUs/LdzQmheF+vT0whtk EtEKIuMZLfsNMgHcbr3Yba7kzaTKHqI0+bowSP1Sm326i9lDMz0MtuFGtisxfZbYMXtg Q0uczn+PfyLkMQO773BH1YkO60nckUZtlMTWCiUWjn58ix0kDNfbwlZYsTf6WrU8ACh3 ynPlYyCoftiYMt2kWpmN77Z1MGwDw9AHlZ9p+t//7Zrl62forRrM7UltAe/giYfTSymi Kz5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=OCqCfzjwjEUdkfcAK2PSU+8vtnt9A/pPpN5qPIvS43w=; b=cgA7Rax0CD7WPNjme7mI05Vrjg/zODjwIpjIRtC1+QRnL3evJyzVsfvcSc3+jpg7HA HOYwMKQhVpY+7H2uIY6qcFEiMwXBXlnDYVCsreQcuS7UTl4REy9ePpGRaGUlPqV8DMpJ 6b2CDsD7lypXkjLF1UP8EiXDU8A64knaQGSKB4BvsvuXYF3GeXP9mEkm7bibrSgysIjE 53VV3AnfFZjwlIsyFXYKQ7jESzVzOBvcX99jYqDNnn+JIfKgq0NmcnT7tcTm4frnoDRP F2Srb3vi1qUZJG1YNnpar3K8jsH5JK1GC5a0/0WpFvV3bz/FsErcpro3b4lnz7Ar0M5F UV3Q== 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 g14si1778821pgn.275.2018.03.14.04.55.38; Wed, 14 Mar 2018 04:55:52 -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 S1751651AbeCNLyU (ORCPT + 99 others); Wed, 14 Mar 2018 07:54:20 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:56032 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751527AbeCNLyS (ORCPT ); Wed, 14 Mar 2018 07:54:18 -0400 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 28EC910B3; Wed, 14 Mar 2018 11:54:18 +0000 (UTC) Date: Wed, 14 Mar 2018 12:54:17 +0100 From: Greg Kroah-Hartman To: "Ooi, Joyce" Cc: Arnd Bergmann , linux-kernel@vger.kernel.org, Ong Hean Loong , Yves Vandervennet Subject: Re: [PATCH] drivers/misc: Add Intel interrupt latency counter driver Message-ID: <20180314115417.GB25368@kroah.com> References: <1521026710-24811-1-git-send-email-joyce.ooi@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1521026710-24811-1-git-send-email-joyce.ooi@intel.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 14, 2018 at 07:25:10PM +0800, Ooi, Joyce wrote: > Adding Intel interrupt latency counter driver support. This driver works > together with the Intel interrupt latency driver soft IP to measure the > time from the interrupt being asserted to the execution of the interrupt > service routine. This driver and soft ip supports for both edge and level > interrupt. > > Signed-off-by: Ooi, Joyce Why has no one else from Intel reviewed this and signed-off on the patch? Please always do that, don't make me do Intel-internal-review :) > --- > .../misc/intel-interrupt-latency-counter.txt | 49 ++++ > drivers/misc/intel_ilc.c | 299 ++++++++++++++++++++ > 2 files changed, 348 insertions(+), 0 deletions(-) > create mode 100644 Documentation/devicetree/bindings/misc/intel-interrupt-latency-counter.txt > create mode 100644 drivers/misc/intel_ilc.c > > diff --git a/Documentation/devicetree/bindings/misc/intel-interrupt-latency-counter.txt b/Documentation/devicetree/bindings/misc/intel-interrupt-latency-counter.txt > new file mode 100644 > index 0000000..9955550 > --- /dev/null > +++ b/Documentation/devicetree/bindings/misc/intel-interrupt-latency-counter.txt You forgot to cc: the correct device tree people :( > --- /dev/null > +++ b/drivers/misc/intel_ilc.c > @@ -0,0 +1,299 @@ > +/* > + * Copyright (C) 2018 Intel Corporation. All rights reserved > + * > + * This program is free software; you can redistribute it and/or modify it > + * under the terms and conditions of the GNU General Public License, > + * version 2, as published by the Free Software Foundation. > + * > + * This program is distributed in the hope it will be useful, but WITHOUT > + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or > + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for > + * more details. > + * > + * You should have received a copy of the GNU General Public License along with > + * this program. If not, see . > + */ Please just use the SPDX single line for this, as documented in the kernel Documentation/ directory. > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#define DRV_NAME "intel_ilc" > +#define CTRL_REG 0x80 > +#define FREQ_REG 0x84 > +#define STP_REG 0x88 > +#define VLD_REG 0x8C > +#define ILC_MAX_PORTS 32 > +#define ILC_FIFO_DEFAULT 32 > +#define ILC_ENABLE 0x01 > +#define CHAR_SIZE 10 > +#define POLL_INTERVAL 1 > +#define GET_PORT_COUNT(_val) ((_val & 0x7C) >> 2) > +#define GET_VLD_BIT(_val, _offset) (((_val) >> _offset) & 0x1) > + > +struct intel_ilc { > + struct platform_device *pdev; > + void __iomem *regs; > + unsigned int port_count; > + unsigned int irq; > + unsigned int channel_offset; > + unsigned int interrupt_channels[ILC_MAX_PORTS]; > + struct kfifo kfifos[ILC_MAX_PORTS]; > + struct device_attribute dev_attr[ILC_MAX_PORTS]; > + struct delayed_work ilc_work; > + char sysfs[ILC_MAX_PORTS][CHAR_SIZE]; > + u32 fifo_depth; > +}; > + > +static int ilc_irq_lookup(struct intel_ilc *ilc, int irq) > +{ > + int i; > + for (i = 0; i < ilc->port_count; i++) { > + if (irq == platform_get_irq(ilc->pdev, i)) > + return i; > + } > + return -EPERM; > +} > + > +static ssize_t ilc_show_counter(struct device *dev, > + struct device_attribute *attr, char *buf) > +{ > + int ret, i, id, fifo_len; > + unsigned int fifo_buf[ILC_MAX_PORTS]; > + char temp[10]; > + struct intel_ilc *ilc = dev_get_drvdata(dev); > + > + fifo_len = 0; > + ret = kstrtouint(attr->attr.name, 0, &id); > + > + for (i = 0; i < ilc->port_count; i++) { > + if (id == (ilc->interrupt_channels[i])) { > + /*Check for kfifo length*/ > + fifo_len = kfifo_len(&ilc->kfifos[i]) > + /sizeof(unsigned int); > + if (fifo_len <= 0) { > + dev_info(&ilc->pdev->dev, "Fifo for interrupt %s is empty\n", > + attr->attr.name); dev_err()? What can someone do with this information? > + return 0; > + } Are you sure you ran checkpatch.pl on this code before sending it out? Please do so. > + /*Read from kfifo*/ > + ret = kfifo_out(&ilc->kfifos[i], &fifo_buf, > + kfifo_len(&ilc->kfifos[i])); > + } > + } > + > + for (i = 0; i < fifo_len; i++) { > + sprintf(temp, "%u\n", fifo_buf[i]); > + strcat(buf, temp); > + } sysfs is "one value per file", which I don't think you are doing here :( Again, go get internal review of your code, this just makes me really grumpy as you have access to resources that not many others do, yet you do not take advantage of it and force the community to do their work for them :( Also, you forgot Documentation/ABI/ entries for all of your new sysfs files, which are requried. Please do all of this and then resend, and I'm going to require multiple signed-off-by: lines from other Intel developers before I will accept this. thanks, greg k-h