Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1082541imm; Fri, 14 Sep 2018 10:53:12 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbgNHCzl3sRZm5r2WS6V9eUbqAnfr2exOON1B9SB9AzN+gRdiPPVcPMA+a6zxt2KMw3cTd7 X-Received: by 2002:a17:902:740a:: with SMTP id g10-v6mr13611785pll.22.1536947592619; Fri, 14 Sep 2018 10:53:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536947592; cv=none; d=google.com; s=arc-20160816; b=E72ohtPcUxHttqOw8M/f5VQGIXjklVu17XNonHNOo2CsJ8Vj/NyWz/n30MwfN9EE/d EEMnePn9jPiyEzv3deZRc6xiWlKx5epsS9pydC5IpCe0OQ1s9Q4OjxHiTe3Ph0bGJduf ECvh0t/fVMp6e7+zxpdp7Htb/eiuYBWaL3PFAyRJLyfGZNK29XhMaimrrVWTay/MGRM4 yxM/96MKSL4WwNT6GeA4AytmCYfAA2zaDR5TcGQXLdL321lWJSth6u+2D7n30UynNlpw +y7iAXwKXmpah8MaxqJ8pUOv8iztpnCQzP/fUwfvFhL4WoqFNTMtvqFu+9JJcREpcW2U DCDQ== 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=CX5wLBZla2yAn71djUxLcYeQ8kWWWoMXBJ0sXHF5X4k=; b=r3pxUIPt0GmiFyQ6y7lW6MK9xTmvT0nuGpfKdLiL+RqGQJGUdCY0PIciKFU+fDsyZc FLeIc5nFLUJT9CK+UaDI5PamVUO3clhtl7C6r/UkjA3IgE+WbpSvyNrL05Yhn3gCN0E7 DsbxeoNEfjZ2Eofi+QEWMmCj9gN0Hv4+2eUI1BTjPs41zvDiiPCRDE223JDsxExUfiSv NyboPTAk6DApURjSaz/MyjTMoCGQ3UP1rU72REGKDxdpaCUdyPelZrBN5rti+Ctlv+Xf mHSL6WaJm6p6yinULRRw4pOH+JtLutRewkH+KoK2HlSOeOIBEBri68Nm11Upg058JGBk /hMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Td6lJVZu; 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 186-v6si7867870pff.270.2018.09.14.10.52.57; Fri, 14 Sep 2018 10:53:12 -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=Td6lJVZu; 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 S1728347AbeINXHz (ORCPT + 99 others); Fri, 14 Sep 2018 19:07:55 -0400 Received: from mail-ua1-f73.google.com ([209.85.222.73]:48251 "EHLO mail-ua1-f73.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726902AbeINXHy (ORCPT ); Fri, 14 Sep 2018 19:07:54 -0400 Received: by mail-ua1-f73.google.com with SMTP id i4-v6so3090991ual.15 for ; Fri, 14 Sep 2018 10:52:21 -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=CX5wLBZla2yAn71djUxLcYeQ8kWWWoMXBJ0sXHF5X4k=; b=Td6lJVZuxK6zJ9XAx5XfsVsNF7mL6rIM6eFUOHUf+YZ9DcUkNjy3NKYdPDBjgTT8uc YKi1SaDE1tnWr3vtzOjv918scQoXTCHOSJb9fEioGxl9E2iKI3hjVSZ82e/6C7GZQiZu QXmouVZHFZDt/ht8ZeOIXJprnnS4SJAObVRYzabuq8LXxTUxZLxvVOw0QY83Z17nn11B 10QystdOPb+eu8dAXfIEAGfe7hM4+jOMYqPs2SFxW07u3xlvp+H612ZGhm2sgjSoVCgg Re9GnQ7qmN3bqhoaG1zQmKm50vDm+5nvU3hGM61crGXTwePokD51bEiZa7QJEDiv4g3x uRbA== 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=CX5wLBZla2yAn71djUxLcYeQ8kWWWoMXBJ0sXHF5X4k=; b=hCJkmypSv9RpUJUJcUksq6SApo8oZo7Orieivg8DogQUr7Hn7qDlqJjZgF2sr/E3pL DbwKCkZ7v6PNKes2QS2kgRV15xUy6JmJIwrawjXGp+usLLH2H68QEA4MhBm9PaXY4ARv I1qmVq8Pb7HbNixqt4orcc14aqVcsrDd9b31DuQlC63aug4t8DDF+cBZg/n/G0Nxgkdt QAKaIpvf3OI/Fef3D7+E8QeUIP0JxoFnbZ5eX6Zc4FzT6bzVE8MyMptU54QdhXncQG84 Uqdyl1I87PyGu0Fo/1iRiAdgf0JeQ1+j1rhkgVS5tfDZ6qmSyg1nrfFqGURwrsSPB1WR l/Aw== X-Gm-Message-State: APzg51Any8XFHM0AvF7oGkB/VrgB8rFDgq0qEnCFNEZrIMsNZPEGXAat VWpZA328i9e+8eCK/hEyx5gtUgmH X-Received: by 2002:ab0:4b64:: with SMTP id i36-v6mr2548353uaf.22.1536947540890; Fri, 14 Sep 2018 10:52:20 -0700 (PDT) Date: Fri, 14 Sep 2018 10:51:09 -0700 In-Reply-To: <20180914175122.21036-1-rkir@google.com> Message-Id: <20180914175122.21036-8-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 08/21] platform: goldfish: pipe: Remove the goldfish_pipe_miscdev 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 | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/platform/goldfish/goldfish_pipe.c b/drivers/platform/goldfish/goldfish_pipe.c index 8a5ce7c01f11..53832e46ad1a 100644 --- a/drivers/platform/goldfish/goldfish_pipe.c +++ b/drivers/platform/goldfish/goldfish_pipe.c @@ -245,6 +245,8 @@ struct goldfish_pipe_dev { /* an irq tasklet to run goldfish_interrupt_task */ struct tasklet_struct irq_tasklet; + struct miscdevice miscdev; + /* DMA info */ size_t dma_alloc_total; }; @@ -1093,11 +1095,14 @@ static const struct file_operations goldfish_pipe_fops = { .compat_ioctl = goldfish_dma_ioctl, }; -static struct miscdevice goldfish_pipe_miscdev = { - .minor = MISC_DYNAMIC_MINOR, - .name = "goldfish_pipe", - .fops = &goldfish_pipe_fops, -}; +static void init_miscdevice(struct miscdevice *miscdev) +{ + memset(miscdev, 0, sizeof(*miscdev)); + + miscdev->minor = MISC_DYNAMIC_MINOR; + miscdev->name = "goldfish_pipe"; + miscdev->fops = &goldfish_pipe_fops; +} static void write_pa_addr(void *addr, void __iomem *portl, void __iomem *porth) { @@ -1123,7 +1128,8 @@ static int goldfish_pipe_device_init(struct platform_device *pdev) return err; } - err = misc_register(&goldfish_pipe_miscdev); + init_miscdevice(&dev->miscdev); + err = misc_register(&dev->miscdev); if (err) { dev_err(&pdev->dev, "unable to register v2 device\n"); return err; @@ -1168,7 +1174,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); + misc_deregister(&goldfish_pipe_dev.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