Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp226784imm; Thu, 21 Jun 2018 17:13:06 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKdRMFm6rN0nekgSIjFrwtolv4tdM34CgOF6rt1yME35/LDhVJKW3GlEpBeBTsmBGntYQ82 X-Received: by 2002:a63:384c:: with SMTP id h12-v6mr24266107pgn.230.1529626386737; Thu, 21 Jun 2018 17:13:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529626386; cv=none; d=google.com; s=arc-20160816; b=xX3xlKFR7571cbaG/1UjAZBOpuBPIZP/csNqjOKyoF6xD6sDDXCJ6alCODMzHyX7G+ QdbrCVho7iUNQRAk8rS/qGgMugglD3jLaXkeVzpW3NThWLH42eBSFNccsfJJPUtWxeP2 hqIVnvLRJSa3tlgnFjpJSr3a/GiSZk+q10RSovvu9/vWb4q33zsAio4YOmF49BlSh5SJ n1sZ/3mbp2bGx9znAk4jRZEVr79Z+Hsxsgr5KPQiUAjbz5ueOy7AUwZjArn+TSXD4qDp bALuid6Li3HgzdJaDUC7uGG5ccXjKeMlLO64tDy8P5htY9nbonKdlT8U7RAdffrffYHT solw== 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:dkim-signature:arc-authentication-results; bh=dpqMzOO+MA0d5Ip/zqvb+MeBogZmJp/F2060yG6uOSU=; b=RwPbzntc1qXJ8uFgA9y77sYyKTYappNhPlPXh5nuU03r8qmdDW/TPA9pd8UZVhUZE9 0hzprK3PHwxA7LAPR4YE0qhawPth4eo4OOX5Ul3P8RSVe5F2J73q3I1IE58h4wmQIOZj PVKV5LCdMhdg0//wc/RljmZYoXapNwsrO3SG+x5xRArjhMEYCRYNVkzkKv4IrgRg+uIH Zxyh6nS++PhJHpX7PG5VQngqRgEd73ihq28g144wPcDxMuTRXjAAz3GY4Yakd9jwl2Jt hsgM88fDJ8waKilswFM6tlpjcLmKprHncUiYvXBb5zrfxlxJtyytSLUhnknn8F0Lcw6v vRcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ctoTiyYl; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z3-v6si5865133plb.246.2018.06.21.17.12.52; Thu, 21 Jun 2018 17:13:06 -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=@gmail.com header.s=20161025 header.b=ctoTiyYl; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934079AbeFVALw (ORCPT + 99 others); Thu, 21 Jun 2018 20:11:52 -0400 Received: from mail-pl0-f65.google.com ([209.85.160.65]:42494 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932397AbeFVALu (ORCPT ); Thu, 21 Jun 2018 20:11:50 -0400 Received: by mail-pl0-f65.google.com with SMTP id w17-v6so2515527pll.9; Thu, 21 Jun 2018 17:11:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=dpqMzOO+MA0d5Ip/zqvb+MeBogZmJp/F2060yG6uOSU=; b=ctoTiyYlLsUJAfPTKfKbpOqxEHrG+mRA44fxnwb6HN6R17UJRkmDYt0zLWm35J5T5T vbWWr6hTXG7Tc/78GvTg2DNlj5g/Unt5Vtj/RYMHGPtj1cLxG0koIkpyJDjI+RI5QKlQ RleU0DESOx6ZmaklzNQW22axUGQZ20tA1IK3hKMpc/BeoYvBZ2GIvhs/5QVKQOuWBiD+ nFHOuVq32yGQ18bgH30tlRF6fky6WO7641Fa1XmR6rjLD6IGAlV8hvWtDJdw6Vxw94Ff r52lQ1r0PXi6GLxdesPIxBDDmIg5ZnLfyQi8zCMrYpDBIce02j51eImhlNU4jszdrWgd oEMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=dpqMzOO+MA0d5Ip/zqvb+MeBogZmJp/F2060yG6uOSU=; b=RYj2j6sXNErzk79H6svgiz0Mek4AQLT0Blz5Tu+XjRo2FyFBMXmKb4VVTyX4UO54nA f/pb1HMuKXusYhf3WDvJgPDj7WboFwpI+j9pl6jC8o2SmKvLGV6iTD5fM6Di/5nIBw4w w8PVV+7BTXw3gPgRj4qfqBYl2SlHGXN06YJTzCXro1wbWgllqjw0KtcTMXnzo4bJ0clA W2s7onhSuiQ6V+PNCQ4Ot9lJuCtDp7Q9p48HX3uqQstRgf1rFbf8Sqevh+bFRQ++bUca NDCvbAp/kCjnLqKyuOfRW7PTZmHZ8KHBmb7Rz5qxhzZ/RHOLrhuM4/OrciOZNcoFDilB T1MQ== X-Gm-Message-State: APt69E0wVOPEl8RPFsttNK95lsvMIvFH+/gx/WAgyDlbSIEfmaOD3t24 mOvulRHMfXvWr4vKXQntGxI= X-Received: by 2002:a17:902:7686:: with SMTP id m6-v6mr30982384pll.340.1529626309548; Thu, 21 Jun 2018 17:11:49 -0700 (PDT) Received: from dtor-ws ([2620:0:1000:1511:8de6:27a8:ed13:2ef5]) by smtp.gmail.com with ESMTPSA id t68-v6sm10253235pfe.91.2018.06.21.17.11.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Jun 2018 17:11:48 -0700 (PDT) Date: Thu, 21 Jun 2018 17:11:46 -0700 From: Dmitry Torokhov To: Janusz Krzysztofik Cc: Tony Lindgren , Aaro Koskinen , "David S . Miller " , Mauro Carvalho Chehab , Greg Kroah-Hartman , Andrew Morton , Randy Dunlap , Linus Walleij , Mark Brown , Liam Girdwood , linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org, linux-input@vger.kernel.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 10/10] Input: ams_delta_serio: Get FIQ buffer from platform_data Message-ID: <20180622001146.GG79890@dtor-ws> References: <20180609140224.32606-1-jmkrzyszt@gmail.com> <20180621224128.17623-1-jmkrzyszt@gmail.com> <20180621224128.17623-10-jmkrzyszt@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180621224128.17623-10-jmkrzyszt@gmail.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 22, 2018 at 12:41:28AM +0200, Janusz Krzysztofik wrote: > Instead of exporting the FIQ buffer symbol to be used in > ams-delta-serio driver, pass it to the driver as platform_data. > > Signed-off-by: Janusz Krzysztofik Input bits look good. Acked-by: Dmitry Torokhov > --- > Changelog: > v2: rebased on v4.18-rc1, no conflicts > > arch/arm/mach-omap1/ams-delta-fiq.c | 6 +++--- > arch/arm/mach-omap1/board-ams-delta.c | 8 ++++++++ > drivers/input/serio/ams_delta_serio.c | 20 +++++++++++++------- > include/linux/platform_data/ams-delta-fiq.h | 4 ---- > 4 files changed, 24 insertions(+), 14 deletions(-) > > diff --git a/arch/arm/mach-omap1/ams-delta-fiq.c b/arch/arm/mach-omap1/ams-delta-fiq.c > index 82ca4246a5e4..b0dc7ddf5877 100644 > --- a/arch/arm/mach-omap1/ams-delta-fiq.c > +++ b/arch/arm/mach-omap1/ams-delta-fiq.c > @@ -40,8 +40,7 @@ static struct fiq_handler fh = { > * keystrokes received from the qwerty keyboard. See > * for details of offsets. > */ > -unsigned int fiq_buffer[1024]; > -EXPORT_SYMBOL(fiq_buffer); > +static unsigned int fiq_buffer[1024]; > > static struct irq_chip *irq_chip; > static struct irq_data *irq_data[16]; > @@ -203,9 +202,10 @@ void __init ams_delta_init_fiq(struct gpio_chip *chip, > val = omap_readl(OMAP_IH1_BASE + offset) | 1; > omap_writel(val, OMAP_IH1_BASE + offset); > > - /* Initialize serio device IRQ resource */ > + /* Initialize serio device IRQ resource and platform_data */ > serio->resource[0].start = gpiod_to_irq(clk); > serio->resource[0].end = serio->resource[0].start; > + serio->dev.platform_data = fiq_buffer; > > /* > * Since FIQ handler performs handling of GPIO registers for > diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c > index 84177ba3e39a..772892487827 100644 > --- a/arch/arm/mach-omap1/board-ams-delta.c > +++ b/arch/arm/mach-omap1/board-ams-delta.c > @@ -520,6 +520,14 @@ static struct resource ams_delta_serio_resources[] = { > static struct platform_device ams_delta_serio_device = { > .name = "ams-delta-serio", > .id = PLATFORM_DEVID_NONE, > + .dev = { > + /* > + * Initialize .platform_data explicitly with NULL to > + * indicate it is going to be used. It will be replaced > + * with FIQ buffer address as soon as FIQ is initialized. > + */ > + .platform_data = NULL, > + }, > .num_resources = ARRAY_SIZE(ams_delta_serio_resources), > .resource = ams_delta_serio_resources, > }; > diff --git a/drivers/input/serio/ams_delta_serio.c b/drivers/input/serio/ams_delta_serio.c > index c1f8226f172e..f8663d7891f2 100644 > --- a/drivers/input/serio/ams_delta_serio.c > +++ b/drivers/input/serio/ams_delta_serio.c > @@ -37,6 +37,7 @@ MODULE_LICENSE("GPL"); > struct ams_delta_serio { > struct serio *serio; > struct regulator *vcc; > + unsigned int *fiq_buffer; > }; > > static int check_data(struct serio *serio, int data) > @@ -66,22 +67,23 @@ static int check_data(struct serio *serio, int data) > static irqreturn_t ams_delta_serio_interrupt(int irq, void *dev_id) > { > struct ams_delta_serio *priv = dev_id; > - int *circ_buff = &fiq_buffer[FIQ_CIRC_BUFF]; > + int *circ_buff = &priv->fiq_buffer[FIQ_CIRC_BUFF]; > int data, dfl; > u8 scancode; > > - fiq_buffer[FIQ_IRQ_PEND] = 0; > + priv->fiq_buffer[FIQ_IRQ_PEND] = 0; > > /* > * Read data from the circular buffer, check it > * and then pass it on the serio > */ > - while (fiq_buffer[FIQ_KEYS_CNT] > 0) { > + while (priv->fiq_buffer[FIQ_KEYS_CNT] > 0) { > > - data = circ_buff[fiq_buffer[FIQ_HEAD_OFFSET]++]; > - fiq_buffer[FIQ_KEYS_CNT]--; > - if (fiq_buffer[FIQ_HEAD_OFFSET] == fiq_buffer[FIQ_BUF_LEN]) > - fiq_buffer[FIQ_HEAD_OFFSET] = 0; > + data = circ_buff[priv->fiq_buffer[FIQ_HEAD_OFFSET]++]; > + priv->fiq_buffer[FIQ_KEYS_CNT]--; > + if (priv->fiq_buffer[FIQ_HEAD_OFFSET] == > + priv->fiq_buffer[FIQ_BUF_LEN]) > + priv->fiq_buffer[FIQ_HEAD_OFFSET] = 0; > > dfl = check_data(priv->serio, data); > scancode = (u8) (data >> 1) & 0xFF; > @@ -116,6 +118,10 @@ static int ams_delta_serio_init(struct platform_device *pdev) > if (!priv) > return -ENOMEM; > > + priv->fiq_buffer = pdev->dev.platform_data; > + if (!priv->fiq_buffer) > + return -EINVAL; > + > priv->vcc = devm_regulator_get(&pdev->dev, "vcc"); > if (IS_ERR(priv->vcc)) { > err = PTR_ERR(priv->vcc); > diff --git a/include/linux/platform_data/ams-delta-fiq.h b/include/linux/platform_data/ams-delta-fiq.h > index dc0f835ea918..cf4589ccb720 100644 > --- a/include/linux/platform_data/ams-delta-fiq.h > +++ b/include/linux/platform_data/ams-delta-fiq.h > @@ -55,8 +55,4 @@ > > #define FIQ_CIRC_BUFF 30 /*Start of circular buffer */ > > -#ifndef __ASSEMBLER__ > -extern unsigned int fiq_buffer[]; > -#endif > - > #endif > -- > 2.16.4 > -- Dmitry