Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1891382imm; Tue, 2 Oct 2018 16:11:07 -0700 (PDT) X-Google-Smtp-Source: ACcGV604YGTVZF97mWQl4FJFJhYijdQVI0e+mdxXnCM66fs81l3VmwaQFTdKYhaDyCLWXNb7ZHSv X-Received: by 2002:a63:3842:: with SMTP id h2-v6mr16288150pgn.300.1538521867580; Tue, 02 Oct 2018 16:11:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538521867; cv=none; d=google.com; s=arc-20160816; b=gZwDh7cOvmJgCHg7d0TuNzVX8YleIcpFIOAiDed6DVmrkjha9Uo+IWsVtByAHQOIr3 qNc8KIgkdO2fMnWjPWmRVDr2QAIJ/gN7Yd7HzXpQDwbloo35CGM5xXPjgW9hRdbJYWVA lzR2nyWswLPTNeowtSsAe6me2zvuwODW/TytjD3Axo+czx8TAXOz+UXaZbOdiRhKFGof Ic1wg5ICwdmBDKPIQ37uQhdp1lAEjjttMmip3OKbBH/U3E+faFnLJzVHBUBFEPbxg956 /myYJR5ZuZqbgAUzwz1wAlc41s3bKMgnsxSFa/g/34ewnc4g1n/GxczA5jPjyfyFDSj/ DHPg== 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=v1/PuiYfXT6aW7CBjL7YO5ci4U91JrGo4Hi2aBBjbu4=; b=kV0pDAIE/392/60Sfs1vG4L6rt8bYZhOvNVW/jwsFcttdzHnyHUjHOi868gOQu7H+4 OllPYyWho4Fa4nYyrqFN+AIwghvHgAAXTyL+vj6fY3tTH4VGP9+q/xtrSwjXrCXYB+SV EDuzaXgU5VDwaeUuN9tzZLNdmowV4nGwEt6hUlQaTFtNWtG5dpXtwlRif9pUc6Uc3pGz c/OHuKj0qBmgbKTu5sr2Tb4p6H9ykRtR/vQl+OZAhKMTKfzU16bxZkh5tnQ9Ntf8kvhg vpCw53ne6gSs0mfuRmaPTuUurgmAfhAfINcpFvhYweydDDAcOTHWnrXgm+JsvKxqol42 4bYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="S/EGNlSl"; 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 q23-v6si16380626pgq.483.2018.10.02.16.10.52; Tue, 02 Oct 2018 16:11:07 -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="S/EGNlSl"; 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 S1727398AbeJCF4S (ORCPT + 99 others); Wed, 3 Oct 2018 01:56:18 -0400 Received: from mail-io1-f74.google.com ([209.85.166.74]:33695 "EHLO mail-io1-f74.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725198AbeJCF4S (ORCPT ); Wed, 3 Oct 2018 01:56:18 -0400 Received: by mail-io1-f74.google.com with SMTP id c5-v6so3856657ioa.0 for ; Tue, 02 Oct 2018 16:10:33 -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=v1/PuiYfXT6aW7CBjL7YO5ci4U91JrGo4Hi2aBBjbu4=; b=S/EGNlSlHqqGdAhWPXDmQyDxYkihn7gQPUQwMqnRb1WP6dwajZH6xi1LmaDtKGqToq R4bdt3FVkjIXX+9DWoCAwoItrTqM6nzDvCV/U4iMAEMzEeJ39Oq0FdT5NeDGg21golNC LsKEUXBN0Q48XjxF8VxwMoLxC3UCym5j7YYIL4xKAp2mxnhGb0Zwf21wzMN8DyT3RBFo WTVC6fLLx7AaoqNEHyF9tK8apI/Zf78iP+cDZ2UCHBUrcbdmGbFK4EvhXQGAKz2XjP/a FIPcIgVPkPfZjV0MlUbryoBikXWn+DQZahdN6u7MJjPm/KsY5zcFXW14hkWqCxh/wLXw vdDQ== 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=v1/PuiYfXT6aW7CBjL7YO5ci4U91JrGo4Hi2aBBjbu4=; b=ThNil7mdk3ycGNgPDRHDCZPmRw+UYVyfaMuFK5fVZ72CP2ygzz1blSMK1jUoLC5zRU ImRTOGbsOqFQBs9FRtCVc5bvLx4b31VuMhkPGWnD3eFRt2K9suNEAF5KWia9Q8c9Ewps eX4PoixNQ0tvGOYwXicDVq7rfd5Q0TURJY+ksrOGA7S+TPk7sNGbZKDS4hW3J6CRrIG6 SQi3GYFnJkCibWdzMuUejpgAnEuClBis6l7Qkot6kvnAWo70nhdQn/IkRGN5NdYowL5m 1msZJI6Zm0pwIJc2LYpFdn7xYWxHlZ+t1R36MCShXmxtwvb3SMDwNaaz8vSYkmJj5p5l 0sVA== X-Gm-Message-State: ABuFfoiE76dLq6uOwsMkW1NIhLJ76PQM4kxXIgRpuM/ZllPmWa6YAqNN 1OwRxua5rba3d5/eNWH58yNEqGv3 X-Received: by 2002:a24:2414:: with SMTP id f20-v6mr16044275ita.0.1538521833179; Tue, 02 Oct 2018 16:10:33 -0700 (PDT) Date: Tue, 2 Oct 2018 16:10:23 -0700 In-Reply-To: <20181002231024.58408-1-rkir@google.com> Message-Id: <20181002231024.58408-2-rkir@google.com> Mime-Version: 1.0 References: <20181002231024.58408-1-rkir@google.com> X-Mailer: git-send-email 2.19.0.605.g01d371f741-goog Subject: [PATCH v2 02/15] platform: goldfish: pipe: Move the file-scope goldfish_pipe_miscdev variable into the driver state 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 move mutable file-scope variables into the driver state. This change will help to introduce another version of the pipe driver (with different state) for the older host interface or having several instances of this device. Signed-off-by: Roman Kiryanov --- Changes in v2: - Updated the commit message. 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 ba9aede17d57..8ca709b45e1f 100644 --- a/drivers/platform/goldfish/goldfish_pipe.c +++ b/drivers/platform/goldfish/goldfish_pipe.c @@ -211,6 +211,8 @@ struct goldfish_pipe_dev { /* an irq tasklet to run goldfish_interrupt_task */ struct tasklet_struct irq_tasklet; + + struct miscdevice miscdev; }; static struct goldfish_pipe_dev goldfish_pipe_dev; @@ -785,11 +787,14 @@ static const struct file_operations goldfish_pipe_fops = { .release = goldfish_pipe_release, }; -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) { @@ -815,7 +820,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; @@ -860,7 +866,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.605.g01d371f741-goog