mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: rkir@google.com
To: gregkh@linuxfoundation.org
Cc: linux-kernel@vger.kernel.org, tkjos@google.com,
	Roman Kiryanov <rkir@google.com>
Subject: [PATCH 07/20] platform: goldfish: pipe: Replace an array of 1 with a variable
Date: Mon, 27 Aug 2018 11:23:02 -0700	[thread overview]
Message-ID: <20180827182315.126345-7-rkir@google.com> (raw)
In-Reply-To: <20180827182315.126345-1-rkir@google.com>

From: Roman Kiryanov <rkir@google.com>

There is no reason to have an array of 1.

Signed-off-by: Roman Kiryanov <rkir@google.com>
---
 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


  parent reply	other threads:[~2018-08-27 18:23 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-27 18:22 [PATCH 01/20] platform: goldfish: pipe: Fix comments to fit 80 columns rkir
2018-08-27 18:22 ` [PATCH 02/20] platform: goldfish: pipe: Update license rkir
2018-08-27 18:22 ` [PATCH 03/20] platform: goldfish: pipe: Move an opening brace to the next line rkir
2018-08-27 18:22 ` [PATCH 04/20] platform: goldfish: pipe: Separate the host interface to a separate header rkir
2018-09-14 13:29   ` Greg KH
2018-08-27 18:23 ` [PATCH 05/20] platform: goldfish: pipe: Update the comment for GFP_ATOMIC rkir
2018-08-27 18:23 ` [PATCH 06/20] platform: goldfish: pipe: Fail compilation if structs are too large rkir
2018-08-27 18:23 ` rkir [this message]
2018-09-14 13:30   ` [PATCH 07/20] platform: goldfish: pipe: Replace an array of 1 with a variable Greg KH
2018-09-14 16:42     ` Roman Kiryanov
2018-09-14 19:20       ` Greg KH
2018-08-27 18:23 ` [PATCH 08/20] platform: goldfish: pipe: Replace pr_ with dev_ for logging rkir
2018-08-27 18:23 ` [PATCH 09/20] platform: goldfish: pipe: Add blank lines to separate struct members rkir
2018-08-27 18:23 ` [PATCH 10/20] platform: goldfish: pipe: Remove a redundant variable rkir
2018-08-27 18:23 ` [PATCH 11/20] platform: goldfish: pipe: Replace two code blocks with a function call rkir
2018-08-27 18:23 ` [PATCH 12/20] platform: goldfish: pipe: Remove reduntant casting rkir
2018-08-27 18:23 ` [PATCH 13/20] platform: goldfish: pipe: Remove a blank line before '}' rkir
2018-08-27 18:23 ` [PATCH 14/20] platform: goldfish: pipe: Rename 'wakeBit' to 'wake_bit' rkir
2018-08-27 18:23 ` [PATCH 15/20] platform: goldfish: pipe: Remove reduntant casting to (void) rkir
2018-08-27 18:23 ` [PATCH 16/20] platform: goldfish: pipe: Rename goldfish_x to goldfish_pipe_x rkir
2018-08-27 18:23 ` [PATCH 17/20] platform: goldfish: pipe: Fix lines to not end an opening bracket rkir
2018-08-27 18:23 ` [PATCH 18/20] platform: goldfish: pipe: Fix alignment to match parenthesis rkir
2018-08-27 18:23 ` [PATCH 19/20] platform: goldfish: pipe: Move logical ops to the end of the prev line rkir
2018-08-27 18:23 ` [PATCH 20/20] platform: goldfish: pipe: Replace "x==NULL" to "!x" rkir

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180827182315.126345-7-rkir@google.com \
    --to=rkir@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tkjos@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome