Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1852761imm; Tue, 2 Oct 2018 15:21:26 -0700 (PDT) X-Google-Smtp-Source: ACcGV60SJTKB6Ybacj0qQYvbCuZBRpOFxbO8cKOBp90PrpuYNqPzvrcwGTkUQFX8/olvgop0oodb X-Received: by 2002:a62:c08b:: with SMTP id g11-v6mr18364312pfk.72.1538518886164; Tue, 02 Oct 2018 15:21:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538518886; cv=none; d=google.com; s=arc-20160816; b=cVcUfZKzoinI8kO7/2jwR5Uip/5ZddEHXNRJ8McKqBw1wlIOBmpd5r3FaE2WzCafz8 1Y8wK+4/2RKD17nYYykStpeX8PPTY160efsEcdE0glo88raTtBCCYOe0OGEB9lQCduxK qEA1fPa14wD/4U9u+5Wvbh8qL/WLqNV4yPJ7YoawPr2sh4hXqTXScDDRd1dEh6k6DN7e O6bHGVkblfkzBhcJZIEWeGdflr4VcwjTBXIaBeGL89GjhEXJgiP/pZeI201Ui3spnjl6 +1pOCMgKllhquyik4EjZMEPOobI+lTWskzppndTuTmcUc6V7KTOgMLUmel6IO/Kc4m1Q qvfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:mime-version :message-id:date:dkim-signature; bh=h/vg1U5Bs8q6OZJRNNuW9qMPUzJCrOG2DRsiFTiSuxg=; b=Yeo8Y/Ms8/bBwS6U/YtZucNEuKDPFiD+ETRJyg+0K8wbTH6StwEfC74fhNwOSQD3xg 2g/eTrlf0ixi6jEOFSDd6ubDSHwObFLb4rs1J3nb+KpfIknk0lzQCFNIs3LRCS9ngxY5 vzhGQXB2eDVzFtfMLYJpK64D+sxmoTPwWcxBqNR3cckugdKPLAl2+SLharzf7xxeb/jK YYvYvefULQkW4fxVJpLIhnrvqsSaV27UpZI1qQGzGzH1uF0MnkcnKAW8zTemP/clbQTB PRq+v1vhMfZ0J2y027AhWKdbAcJFAFNXdHTvXJ12wsyYmtl1nhZt4+p6DTUa3gvj1Mb7 /IMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=LW4PUxZq; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 92-v6si18252717plw.81.2018.10.02.15.21.11; Tue, 02 Oct 2018 15:21:26 -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=@google.com header.s=20161025 header.b=LW4PUxZq; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726943AbeJCFFm (ORCPT + 99 others); Wed, 3 Oct 2018 01:05:42 -0400 Received: from mail-it1-f202.google.com ([209.85.166.202]:57164 "EHLO mail-it1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725198AbeJCFFm (ORCPT ); Wed, 3 Oct 2018 01:05:42 -0400 Received: by mail-it1-f202.google.com with SMTP id i188-v6so4951005itf.6 for ; Tue, 02 Oct 2018 15:20:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=h/vg1U5Bs8q6OZJRNNuW9qMPUzJCrOG2DRsiFTiSuxg=; b=LW4PUxZq2JH2KEm+rSDCjo+9bvgoDlhGOy3o2+ubHC8RD/Uy9KWjWCOszNYx7thqlu dNzhTcs1dp2VXN1ZHzn/Wy2LBXzAxYn+TgjO3lU+dvE5qOoDqj5avfYgXmrI/NASGqem +s3Llz3mUhGyGH/QzVfxHzR5il50dydPyELYEuQCMTnxiOSPLayUBKtylEN29VzaT4Ba K1NwNNuyNAP23MirXqKzOpzgpTu0UhZTrrz7I8Sg6jD0kYNGfp/lQwM5ClWKataYXwx6 rmOaeFO/3oNY+LMb8fcEYwUxz467935kTs2YdREF2oyPbRMB1U8bGkjTOwj9k0OKnMgb 1P2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=h/vg1U5Bs8q6OZJRNNuW9qMPUzJCrOG2DRsiFTiSuxg=; b=LdTz/1uWB8Oejgxa5zXe5XoMZjMVv8RYiBqtbtdYPBl2E4rZJEgJsiEXp7YiGs6tAk deNbzXvBzfIpiMi4Kn3BT/hMeeaiA8ZXw2DRxtfW81eDsTI8cHtYD5XrTNn8Ecwe2Bu3 ZZ6QOEp8k5dvsBxPhsYZ2KOCxMv7Ly62EQHb7RKSkN/AUgvpx2Var4Q+/zsiHnI+tx0m aHuhrtMiTdI84ldtJBkPKhx2j1SPXnZ4AAEYT0ojX+1Md+Fo/fh6ufiYNlGatt8Y5jJK DOR7dVwVAjcGozTlqbHZnmf1M7xEy9c4z4liMv0YiDxgtVJKMmwDypzE0Vb72qdcEJ/P 7Acg== X-Gm-Message-State: ABuFfog1fyPPCW6Kj3RPUbjfz0gw1OdKEaaRrNzSTbmgZrEqqZ5wvcYu frJ4d+gCRUIAk0MNZHI4RT6/NQPi X-Received: by 2002:a24:d49:: with SMTP id 70-v6mr3487202itx.5.1538518807438; Tue, 02 Oct 2018 15:20:07 -0700 (PDT) Date: Tue, 2 Oct 2018 15:18:49 -0700 Message-Id: <20181002221903.19476-1-rkir@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.19.0.605.g01d371f741-goog Subject: [PATCH 01/15] platform: goldfish: pipe: Remove the goldfish_interrupt_tasklet global variable From: rkir@google.com To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, tkjos@google.com, Roman Kiryanov 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 From: Roman Kiryanov This is a series of patches to remove mutable global variables to introduce another version of the pipe driver for the older host interface. I don't want to have two driver states where only one is used. Signed-off-by: Roman Kiryanov --- drivers/platform/goldfish/goldfish_pipe.c | 24 +++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/drivers/platform/goldfish/goldfish_pipe.c b/drivers/platform/goldfish/goldfish_pipe.c index 56665e879e5a..ba9aede17d57 100644 --- a/drivers/platform/goldfish/goldfish_pipe.c +++ b/drivers/platform/goldfish/goldfish_pipe.c @@ -208,6 +208,9 @@ struct goldfish_pipe_dev { int irq; int version; unsigned char __iomem *base; + + /* an irq tasklet to run goldfish_interrupt_task */ + struct tasklet_struct irq_tasklet; }; static struct goldfish_pipe_dev goldfish_pipe_dev; @@ -582,14 +585,14 @@ static struct goldfish_pipe *signalled_pipes_pop_front( return pipe; } -static void goldfish_interrupt_task(unsigned long unused) +static void goldfish_interrupt_task(unsigned long dev_addr) { /* Iterate over the signalled pipes and wake them one by one */ + struct goldfish_pipe_dev *dev = (struct goldfish_pipe_dev *)dev_addr; struct goldfish_pipe *pipe; int wakes; - while ((pipe = signalled_pipes_pop_front(&goldfish_pipe_dev, &wakes)) != - NULL) { + while ((pipe = signalled_pipes_pop_front(dev, &wakes)) != NULL) { if (wakes & PIPE_WAKE_CLOSED) { pipe->flags = 1 << BIT_CLOSED_ON_HOST; } else { @@ -605,7 +608,6 @@ static void goldfish_interrupt_task(unsigned long unused) wake_up_interruptible(&pipe->wake_queue); } } -static DECLARE_TASKLET(goldfish_interrupt_tasklet, goldfish_interrupt_task, 0); /* * The general idea of the interrupt handling: @@ -648,7 +650,7 @@ static irqreturn_t goldfish_pipe_interrupt(int irq, void *dev_id) spin_unlock_irqrestore(&dev->lock, flags); - tasklet_schedule(&goldfish_interrupt_tasklet); + tasklet_schedule(&dev->irq_tasklet); return IRQ_HANDLED; } @@ -800,9 +802,14 @@ static void write_pa_addr(void *addr, void __iomem *portl, void __iomem *porth) static int goldfish_pipe_device_init(struct platform_device *pdev) { struct goldfish_pipe_dev *dev = &goldfish_pipe_dev; - int err = devm_request_irq(&pdev->dev, dev->irq, - goldfish_pipe_interrupt, - IRQF_SHARED, "goldfish_pipe", dev); + int err; + + tasklet_init(&dev->irq_tasklet, &goldfish_interrupt_task, + (unsigned long)dev); + + err = devm_request_irq(&pdev->dev, dev->irq, + goldfish_pipe_interrupt, + IRQF_SHARED, "goldfish_pipe", dev); if (err) { dev_err(&pdev->dev, "unable to allocate IRQ for v2\n"); return err; @@ -854,6 +861,7 @@ static int goldfish_pipe_device_init(struct platform_device *pdev) static void goldfish_pipe_device_deinit(struct platform_device *pdev) { misc_deregister(&goldfish_pipe_miscdev); + tasklet_kill(&goldfish_pipe_dev.irq_tasklet); kfree(goldfish_pipe_dev.pipes); free_page((unsigned long)goldfish_pipe_dev.buffers); } -- 2.19.0.605.g01d371f741-goog