Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1082410imm; Fri, 14 Sep 2018 10:53:04 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbN4Y/nMvYk9gUoKUda5CUBazJqP+X0IH8HusY2i4GizFl1OnXRbw/CZVH5g9EDIZFidiYl X-Received: by 2002:a62:da0b:: with SMTP id c11-v6mr13781336pfh.68.1536947584026; Fri, 14 Sep 2018 10:53:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536947583; cv=none; d=google.com; s=arc-20160816; b=IK3XA6FwpwgB51VHEX6lYEBHCiGTjHbG52VHzShO9EZ9OhZiglIZjO9dCCelRotmSd QE8LtQPqPfZxqQVPsVMw08FbfvEmlXBxx28Jk7PsRClLmOvn9x2TkbPLUn93v95MKv42 bPOnXTaJAzy4h7ZtBNXQVqoGeV3X/yMUoBUoqqKGi8rokVViCxyNmuXx8aeB1GimD1s4 bPOZ/3/J3Z31Q29c0efIH/6XnDjhIAw683rF0vtIgCvFJYgtw/efsriCDepTUsB14LUt wiCFadd8LbLhAlIJHL9ky1rl7vm34SXjlNiKdopBqMeXiUwvvGZawKIa7ABY+I/cAGT6 hlFQ== 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:references :mime-version:message-id:in-reply-to:date:dkim-signature; bh=KxOD7cpoHpP0etCc+j6bQ9uyj2TSRlPsUmZMd9SZNsI=; b=zN2ZHYyUIneRjHG5xUo0EOgTh7FuafrOiIfQHvnqu308B0l2um9Ge0gNAkUEWNdgBL bJT+doSL9ICiPdo7Oc4W3WvGAlXoM5I/ITmT4aS3+A8hVw8LHb/PeUAzNiHTpDAntEeQ JpSmOUuwFcuYjyL8qAP9N1dLv92XOo0abQuLj3xtPTcmcxHaofkZirQt0OHBB6vM6wrv j5QkKVuouQmFvrQIVvCvVOq2/eeUZ3nd8ZAUiWTZnspWjWM5pTiYG8FLSZTR9pPUEQ9w IBNSXy+3co+Mld5gWu35/S0o3/UDtJffX8Pp2h0VL5q7wbhoiSK90vknFZSLu9XK+h1M v5ZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=ZArG+zUS; 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 x189-v6si7630783pgd.1.2018.09.14.10.52.49; Fri, 14 Sep 2018 10:53:03 -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=ZArG+zUS; 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 S1728323AbeINXHv (ORCPT + 99 others); Fri, 14 Sep 2018 19:07:51 -0400 Received: from mail-pf1-f201.google.com ([209.85.210.201]:46238 "EHLO mail-pf1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726902AbeINXHu (ORCPT ); Fri, 14 Sep 2018 19:07:50 -0400 Received: by mail-pf1-f201.google.com with SMTP id x85-v6so4993116pfe.13 for ; Fri, 14 Sep 2018 10:52:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=KxOD7cpoHpP0etCc+j6bQ9uyj2TSRlPsUmZMd9SZNsI=; b=ZArG+zUSP5KrLEv/WjuHwdgndosOm0xyQhT64flaIkrYUZJNGYKHmrRlAHNcAu7bqs ERqKheRyshk5lq0X//3mjv8PDWD2Mvu+yBPC9b0UKJmQ9Ayiqjki8VXf5fWGnLIXFW9M 8tUkb06pcusdVIICxBDoTt3Ce1ejGG7x7Vss0BwfTpRX5/nYpKPa4l127Ws1yvUAn+GC kskryMfodvd9C+Ib/wDKfiHIowz+mZIsez8GTy43CBHX6l9bccsT/xJeA3OVgBlYWeqU aoDrQFamRHvExnCxXWPTvdaqTQzFY6uxrnnaI+sH+Y5/tByyNzeSGY0GE+4ZwasELpbf rpvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=KxOD7cpoHpP0etCc+j6bQ9uyj2TSRlPsUmZMd9SZNsI=; b=Mz+9VuAVp2HOxGajFhnvSSgfrD7rxv1Hyo/aDdQ4/Y/3fLhLav3Dtf+A6szEfUIswN Npl/rYWpmaAyjspx0HkfKf5ef4jK6YFZfgZAIRK9ye5JKEdnftb47HTSMiQNufWWvz2c R6OPMzaizXnlvrBtuWuY3Kynfk4j5s3bwr6paAQ35uiPB7NPW/6vb1Rm/1AKkZM7UPez byThzLRtbyMMC7iJ7Nhh8TTW9rcsF7fHxMXZktBiDr+ts6i6+myzU8sgPmCdHCpFTbHM jMw66HiN5iXR6ozPKCqLsIePBlj/zM8rmzdc7Ry8joPbZkTvNrBihGbM2ihxxF6WVQI4 CDVA== X-Gm-Message-State: APzg51AXw/JHbq0WsaZrPniBNGBdW943vCnG4dQh6313qvalnh3S0I/T CC4+yaoUEbOst/ZLQzyC16Riy1D/ X-Received: by 2002:a63:8b42:: with SMTP id j63-v6mr675744pge.19.1536947536580; Fri, 14 Sep 2018 10:52:16 -0700 (PDT) Date: Fri, 14 Sep 2018 10:51:08 -0700 In-Reply-To: <20180914175122.21036-1-rkir@google.com> Message-Id: <20180914175122.21036-7-rkir@google.com> Mime-Version: 1.0 References: <20180914175122.21036-1-rkir@google.com> X-Mailer: git-send-email 2.19.0.397.gdd90340f6a-goog Subject: [PATCH 07/21] platform: goldfish: pipe: Remove the goldfish_interrupt_tasklet global variable From: rkir@google.com To: gregkh@linuxfoundation.org Cc: tkjos@google.com, linux-kernel@vger.kernel.org, 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 064a50a7f187..8a5ce7c01f11 100644 --- a/drivers/platform/goldfish/goldfish_pipe.c +++ b/drivers/platform/goldfish/goldfish_pipe.c @@ -242,6 +242,9 @@ struct goldfish_pipe_dev { int version; unsigned char __iomem *base; + /* an irq tasklet to run goldfish_interrupt_task */ + struct tasklet_struct irq_tasklet; + /* DMA info */ size_t dma_alloc_total; }; @@ -618,14 +621,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 { @@ -641,7 +644,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: @@ -684,7 +686,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; } @@ -1108,9 +1110,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; @@ -1162,6 +1169,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.397.gdd90340f6a-goog