Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp6199770imm; Mon, 27 Aug 2018 11:25:35 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbOClQ5akgMDfHlOLahySj/fizXtee45iJTJypfNmE7jXvo3elTls5m5t1MAEIR5QjD8qU4 X-Received: by 2002:a63:2f45:: with SMTP id v66-v6mr13025030pgv.91.1535394335608; Mon, 27 Aug 2018 11:25:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535394335; cv=none; d=google.com; s=arc-20160816; b=NLHvcvIQs7wxnCA4JgCDWj6K6VPIBPPgtZm7Od0v4ZKBQpaT7FFljozsQDnyl4l1iv 6PqY8MG3O8UPVTfZR8yvrW8dEDkIM9/9x88D5I0rcSgXvYAWGg1Nbpi5k8g/iXXMYTxF U8FegzHEeSJnFPOVvwNH5W1qW5x56YQ0GNpkCH12T27Nhb0OhLSyHEeC8CixxxwaSoVt e7OFIA5GbCEIA7hHId4SziThhaDbankjXigHwkjbcU8n6fQ4mey5KcDhJf1MFK99tPoT 40Z0Sy0jiuDittPwqpeqdLBmZAdQg5WFmR4D6Gjp14P23XJSCDY8OBx+HSwUz7zt6V5t UMLA== 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=ZBmsTb6IwksazDs4PyROyPhoVAiGchwtF1sGndheJ9k=; b=w5kkWs9dbL49DZu9o9xFQ2WxADAGhAjLfl8Pi/KVosw/lnAhz1eceWRpJP57S3lHqk jKLpdQeS0vpdTbBikdJv27ImJyzpAsQR8MHc/r8fOcNm4Ec1pgvC7pWTYv3stwoZ06oi lDy3SxUUO6N/am6N+KpVL6ajz8iTKVcQFr6Ult8+YsRqZzIXHuNs8xZ5fB5RIZDb6xuf GjVH0Dm8eaw6wzsQdkPQ2LbE7DHdWty6EM3YbXxfeGG+bqPCFmlndVQcZLShAbT1o8sC t45ibxrWaRjbQ06czWgm2gg/lSrD9EUhewjHEfS1OVsKXyXudgB3oc6493GDZ7yvl6Mm QJ2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=uqqZyXj4; 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 31-v6si13054033pgk.95.2018.08.27.11.25.20; Mon, 27 Aug 2018 11:25:35 -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=uqqZyXj4; 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 S1727585AbeH0WLg (ORCPT + 99 others); Mon, 27 Aug 2018 18:11:36 -0400 Received: from mail-io0-f201.google.com ([209.85.223.201]:40138 "EHLO mail-io0-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726895AbeH0WLf (ORCPT ); Mon, 27 Aug 2018 18:11:35 -0400 Received: by mail-io0-f201.google.com with SMTP id p22-v6so14569761ioh.7 for ; Mon, 27 Aug 2018 11:23:54 -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=ZBmsTb6IwksazDs4PyROyPhoVAiGchwtF1sGndheJ9k=; b=uqqZyXj4OPPzAOWXDFegJNbR+zus6oO1ECLnCr+O/jiY9CgCTciazZdNBv1PRVa08r Q/xvwVUgz/Hn0NrE6IFiangdvr8rhOH+rqk2QavNaSJDgjtxTJmyFqMUUWiEnuwRab2J NCcZyUMidFK7xmxbTO8+fhiP1fweRpFF0c1ve9v8TD3Mj12Fg6iFGkeO1jdxQOjCbcKc +Sicn5foPdhnJQ8qH9WONpZ2/sTCQRb/UDXXgFIrJXzK2SJYjfH7USmKYKq2aYL/QMnZ j9+iac1MkHipADxiVFKqOV8/m25SXS9LVbePrLp7ePfDvcDT39RAs0TxSKVVmEHPRVV2 egNQ== 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=ZBmsTb6IwksazDs4PyROyPhoVAiGchwtF1sGndheJ9k=; b=CTZFpBzuBgQ+qUqpC96tX9HvAnHGzS4AMPRYiJRIsPONwuP6KNVBA27EYhYg/nAKre j+DAsXLPCFqk8h+qR/w2VtKz1w1UScreBLCqR2Hw+CgIu+45BXKSrI4dCM23Zdru6lna 5SckCSzphKL+g+bMnv4U/JmDgdPg3T8aMSb4845YR1olivBCwdU9CmwR1WenkMSk0+gi BmWzRZ8EyRvt+0D+oPJnBxGFR+zTWrlICZhEdE2DpOcNcsxLKDcxLpI81b/+5OEQ45k1 GGJJeqJGgefCjSQeUxaSr+Ax5fvxVeL9ukikIx1rH38l8V5iLsb5WWIi6VV1SuzfeROy qRfw== X-Gm-Message-State: APzg51DKTNjL5F5H+VQK9zQuGefujf55MDUBYTJu0Z2LatDHE/kYX+Vc NE+23VmujBMS86E0WNOxJr9k2b2F X-Received: by 2002:a24:a85:: with SMTP id 127-v6mr4677081itw.9.1535394233374; Mon, 27 Aug 2018 11:23:53 -0700 (PDT) Date: Mon, 27 Aug 2018 11:23:02 -0700 In-Reply-To: <20180827182315.126345-1-rkir@google.com> Message-Id: <20180827182315.126345-7-rkir@google.com> Mime-Version: 1.0 References: <20180827182315.126345-1-rkir@google.com> X-Mailer: git-send-email 2.19.0.rc0.228.g281dcd1b4d0-goog Subject: [PATCH 07/20] 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 24e40deb98cc..e9e3e791c0d4 100644 --- a/drivers/platform/goldfish/goldfish_pipe.c +++ b/drivers/platform/goldfish/goldfish_pipe.c @@ -205,7 +205,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) { @@ -564,12 +564,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 { @@ -607,7 +607,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 */ @@ -672,7 +672,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; @@ -763,7 +763,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, @@ -771,8 +771,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); @@ -781,7 +781,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; @@ -830,18 +830,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; /* not thread safe, but this should not happen */ WARN_ON(dev->base != NULL); @@ -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.19.0.rc0.228.g281dcd1b4d0-goog