Received: by 2002:a4a:311b:0:0:0:0:0 with SMTP id k27-v6csp3698871ooa; Mon, 13 Aug 2018 16:41:32 -0700 (PDT) X-Google-Smtp-Source: AA+uWPyBK0kqngqK9aeI3/ktegCKwZmxBVYAImKyqg4bgBdID34bdFoHcjsnLT/LnWUlcFa2PzC+ X-Received: by 2002:a62:51:: with SMTP id 78-v6mr20873644pfa.135.1534203691714; Mon, 13 Aug 2018 16:41:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534203691; cv=none; d=google.com; s=arc-20160816; b=0lRj3k01yZ0FR6OyY+jm0jEm1pWaCvAQaOQCM9trLmZ7iqoslwrLTCl7ER3FWBfMHv gJIzQ9g9RJqEvpMnk3WadjIdTbNEj3C3WLwRZPaDP2k0TZDO3Cc4m0zhiYCoaQSAI7F7 qh7XkGv0WOCCFbupuVM1Javmo8kiOzItaErUdDUiAv4ElXbXRm9SYwhwc1FpSAEvNaDk iyDPFE+WxTKeU2MUJZD2K82K9fbj0pLqqWrEjvwev/9dNR9qTGXromLCx86ccSgD8e5o wnok9Vu+lh3RC26zP05zTs3PXB1Y7QCN5z1pE0k+sf3a1LCRGdhA+8ishWRuoky7czEx 3jJw== 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 :arc-authentication-results; bh=tzPHKZnCJ+ysZhgRFXOoFa6MhY0aa5NF9i/foceaBQA=; b=d/3geLkz1Ge9GuGl8ebbcveL0daoUDqJQvq8Itb7HygnaIoZR5dvnBFuHbruaHi94r hXqTGmHnqXjvi4fTGwjgMJd0B1UPvND98vi27iNNoj2mzoY1gHlj1ArraQxg05Up1/Le wSYs0CbYsmVKt0yrp6FAY/BKDdydd1/sJKf7NdWST2ZDGhgYtZjGGl55xR7n/XzX2n/d Zte/+Wz2hvgxOkRcuPKHKY/MCicdoGuOSA5xcPHjWfR9Ljiw3R5+KU0qUlhBqWm7o65z 8I8XdDxKmxQCad/cJyLI3UCGSOGIDgZJLBq1YHfNsbNrzZKOXW0E2IO+btlApoqtNzvi Th4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=sJDsVwIp; 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 r24-v6si18872548pgo.295.2018.08.13.16.41.17; Mon, 13 Aug 2018 16:41:31 -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=sJDsVwIp; 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 S1732576AbeHNCYI (ORCPT + 99 others); Mon, 13 Aug 2018 22:24:08 -0400 Received: from mail-yw1-f73.google.com ([209.85.161.73]:34588 "EHLO mail-yw1-f73.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729947AbeHNCYI (ORCPT ); Mon, 13 Aug 2018 22:24:08 -0400 Received: by mail-yw1-f73.google.com with SMTP id p127-v6so24449225ywg.1 for ; Mon, 13 Aug 2018 16:39:39 -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=tzPHKZnCJ+ysZhgRFXOoFa6MhY0aa5NF9i/foceaBQA=; b=sJDsVwIpub1rr1iDwlMoSvz6S1OxX1bgwFy735hoIJ1yiVXWYaZZGYWU6V/DtTvIPV kxzEYqFeatGZa0+bDDUGl8DU/gJYpGwgEeaxCl9MQHR4ExnsBVUUA0NocF/7Q4r3WfpM rcTK/tN6uvAxe1fGOY48c0YDGs2tc25M9WJO+0bvWevgq786HmIbu5CsZWibASa64j1k 9W/GiAguxsIHhq3pgNYznYQhVqa+XPfc6qhls4KcGnefZcLncam35dhRkwMYbNl3iREe 7lqVx3C6vrQjfeYAfUEABA0VSnoxve+kt0GOoxGYc7EbHe17pzTZ5rVyXkL7Ft9hWegh WbvA== 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=tzPHKZnCJ+ysZhgRFXOoFa6MhY0aa5NF9i/foceaBQA=; b=S4ar+w+Rm0hR3dR7FKpRp8lVYBf5F6PfFDPtvr61zIHuDocb6BxQM3Q3FYTKY2ITbg uwnaxCceys9Eur0AvqslILwVvvZaZm4vySGQj+rhMxtpc4V9csIlrpaa6VUy4f3qGGO7 pxmL1iGDzMHQaUQJtMPvasreHtCW0y2p4SM0yPFDiNp9dLnBJN6+qTfyntajHigmk+jK F3zz4AFcKn+q7bRvSmgjW1rOJza+Hs30BywYUb+PecxS1OV0KdJ/CgBuJiuQ3C0YqzBz RENJ+cfGPgqIj7bO8wGEIH2RtyOpuZr4Y+PohlTtXoyQ6AqtlAgY+mBu2+wIkZhgoUd7 WgmQ== X-Gm-Message-State: AOUpUlG+acZtj2iw2MZYYA+huBM7beVkpYps+29MXhMORk3Wn2nPIPqd NbRGjFaJ0/iO+72Cx/XYmv0BSEA8 X-Received: by 2002:a5b:444:: with SMTP id s4-v6mr5473051ybp.58.1534203578928; Mon, 13 Aug 2018 16:39:38 -0700 (PDT) Date: Mon, 13 Aug 2018 16:38:38 -0700 In-Reply-To: <20180813233839.190855-1-rkir@google.com> Message-Id: <20180813233839.190855-7-rkir@google.com> Mime-Version: 1.0 References: <20180813233839.190855-1-rkir@google.com> X-Mailer: git-send-email 2.18.0.865.gffc8e1a3cd6-goog Subject: [PATCH 7/9] platform: goldfish: pipe: Replace an array of 1 with a 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 There is no reason to have an array of 1. Signed-off-by: Roman Kiryanov --- drivers/platform/goldfish/goldfish_pipe.c | 28 +++++++++++------------ 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/drivers/platform/goldfish/goldfish_pipe.c b/drivers/platform/goldfish/goldfish_pipe.c index 5eed4c824a53..6f3fc4b30fba 100644 --- a/drivers/platform/goldfish/goldfish_pipe.c +++ b/drivers/platform/goldfish/goldfish_pipe.c @@ -204,7 +204,7 @@ struct goldfish_pipe_dev { unsigned char __iomem *base; }; -static struct goldfish_pipe_dev pipe_dev[1] = {}; +struct goldfish_pipe_dev goldfish_pipe_dev; static int goldfish_cmd_locked(struct goldfish_pipe *pipe, enum PipeCmdCode cmd) { @@ -563,12 +563,12 @@ static struct goldfish_pipe *signalled_pipes_pop_front( static void goldfish_interrupt_task(unsigned long unused) { - struct goldfish_pipe_dev *dev = pipe_dev; /* Iterate over the signalled pipes and wake them one by one */ struct goldfish_pipe *pipe; int wakes; - while ((pipe = signalled_pipes_pop_front(dev, &wakes)) != NULL) { + while ((pipe = signalled_pipes_pop_front(&goldfish_pipe_dev, &wakes)) != + NULL) { if (wakes & PIPE_WAKE_CLOSED) { pipe->flags = 1 << BIT_CLOSED_ON_HOST; } else { @@ -606,7 +606,7 @@ static irqreturn_t goldfish_pipe_interrupt(int irq, void *dev_id) unsigned long flags; struct goldfish_pipe_dev *dev = dev_id; - if (dev != pipe_dev) + if (dev != &goldfish_pipe_dev) return IRQ_NONE; /* Request the signalled pipes from the device */ @@ -671,7 +671,7 @@ static int get_free_pipe_id_locked(struct goldfish_pipe_dev *dev) */ static int goldfish_pipe_open(struct inode *inode, struct file *file) { - struct goldfish_pipe_dev *dev = pipe_dev; + struct goldfish_pipe_dev *dev = &goldfish_pipe_dev; unsigned long flags; int id; int status; @@ -761,7 +761,7 @@ static const struct file_operations goldfish_pipe_fops = { .release = goldfish_pipe_release, }; -static struct miscdevice goldfish_pipe_dev = { +static struct miscdevice goldfish_pipe_miscdev = { .minor = MISC_DYNAMIC_MINOR, .name = "goldfish_pipe", .fops = &goldfish_pipe_fops, @@ -769,8 +769,8 @@ static struct miscdevice goldfish_pipe_dev = { static int goldfish_pipe_device_init(struct platform_device *pdev) { + struct goldfish_pipe_dev *dev = &goldfish_pipe_dev; char *page; - struct goldfish_pipe_dev *dev = pipe_dev; int err = devm_request_irq(&pdev->dev, dev->irq, goldfish_pipe_interrupt, IRQF_SHARED, "goldfish_pipe", dev); @@ -779,7 +779,7 @@ static int goldfish_pipe_device_init(struct platform_device *pdev) return err; } - err = misc_register(&goldfish_pipe_dev); + err = misc_register(&goldfish_pipe_miscdev); if (err) { dev_err(&pdev->dev, "unable to register v2 device\n"); return err; @@ -828,18 +828,16 @@ static int goldfish_pipe_device_init(struct platform_device *pdev) static void goldfish_pipe_device_deinit(struct platform_device *pdev) { - struct goldfish_pipe_dev *dev = pipe_dev; - - misc_deregister(&goldfish_pipe_dev); - kfree(dev->pipes); - free_page((unsigned long)dev->buffers); + misc_deregister(&goldfish_pipe_miscdev); + kfree(goldfish_pipe_dev.pipes); + free_page((unsigned long)goldfish_pipe_dev.buffers); } static int goldfish_pipe_probe(struct platform_device *pdev) { int err; struct resource *r; - struct goldfish_pipe_dev *dev = pipe_dev; + struct goldfish_pipe_dev *dev = &goldfish_pipe_dev; BUILD_BUG_ON(sizeof(struct goldfish_pipe_command) > PAGE_SIZE); @@ -889,7 +887,7 @@ static int goldfish_pipe_probe(struct platform_device *pdev) static int goldfish_pipe_remove(struct platform_device *pdev) { - struct goldfish_pipe_dev *dev = pipe_dev; + struct goldfish_pipe_dev *dev = &goldfish_pipe_dev; goldfish_pipe_device_deinit(pdev); dev->base = NULL; return 0; -- 2.18.0.865.gffc8e1a3cd6-goog