Commit 869fd502 authored by Roman Kiryanov's avatar Roman Kiryanov Committed by Greg Kroah-Hartman

platform: goldfish: pipe: Replace an array of 1 with a variable

There is no reason to have an array of 1.
Signed-off-by: default avatarRoman Kiryanov <rkir@google.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d23069a5
...@@ -205,7 +205,7 @@ struct goldfish_pipe_dev { ...@@ -205,7 +205,7 @@ struct goldfish_pipe_dev {
unsigned char __iomem *base; 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) static int goldfish_cmd_locked(struct goldfish_pipe *pipe, enum PipeCmdCode cmd)
{ {
...@@ -564,12 +564,12 @@ static struct goldfish_pipe *signalled_pipes_pop_front( ...@@ -564,12 +564,12 @@ static struct goldfish_pipe *signalled_pipes_pop_front(
static void goldfish_interrupt_task(unsigned long unused) 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 */ /* Iterate over the signalled pipes and wake them one by one */
struct goldfish_pipe *pipe; struct goldfish_pipe *pipe;
int wakes; 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) { if (wakes & PIPE_WAKE_CLOSED) {
pipe->flags = 1 << BIT_CLOSED_ON_HOST; pipe->flags = 1 << BIT_CLOSED_ON_HOST;
} else { } else {
...@@ -607,7 +607,7 @@ static irqreturn_t goldfish_pipe_interrupt(int irq, void *dev_id) ...@@ -607,7 +607,7 @@ static irqreturn_t goldfish_pipe_interrupt(int irq, void *dev_id)
unsigned long flags; unsigned long flags;
struct goldfish_pipe_dev *dev = dev_id; struct goldfish_pipe_dev *dev = dev_id;
if (dev != pipe_dev) if (dev != &goldfish_pipe_dev)
return IRQ_NONE; return IRQ_NONE;
/* Request the signalled pipes from the device */ /* Request the signalled pipes from the device */
...@@ -672,7 +672,7 @@ static int get_free_pipe_id_locked(struct goldfish_pipe_dev *dev) ...@@ -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) 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; unsigned long flags;
int id; int id;
int status; int status;
...@@ -763,7 +763,7 @@ static const struct file_operations goldfish_pipe_fops = { ...@@ -763,7 +763,7 @@ static const struct file_operations goldfish_pipe_fops = {
.release = goldfish_pipe_release, .release = goldfish_pipe_release,
}; };
static struct miscdevice goldfish_pipe_dev = { static struct miscdevice goldfish_pipe_miscdev = {
.minor = MISC_DYNAMIC_MINOR, .minor = MISC_DYNAMIC_MINOR,
.name = "goldfish_pipe", .name = "goldfish_pipe",
.fops = &goldfish_pipe_fops, .fops = &goldfish_pipe_fops,
...@@ -771,8 +771,8 @@ static struct miscdevice goldfish_pipe_dev = { ...@@ -771,8 +771,8 @@ static struct miscdevice goldfish_pipe_dev = {
static int goldfish_pipe_device_init(struct platform_device *pdev) static int goldfish_pipe_device_init(struct platform_device *pdev)
{ {
struct goldfish_pipe_dev *dev = &goldfish_pipe_dev;
char *page; char *page;
struct goldfish_pipe_dev *dev = pipe_dev;
int err = devm_request_irq(&pdev->dev, dev->irq, int err = devm_request_irq(&pdev->dev, dev->irq,
goldfish_pipe_interrupt, goldfish_pipe_interrupt,
IRQF_SHARED, "goldfish_pipe", dev); IRQF_SHARED, "goldfish_pipe", dev);
...@@ -781,7 +781,7 @@ static int goldfish_pipe_device_init(struct platform_device *pdev) ...@@ -781,7 +781,7 @@ static int goldfish_pipe_device_init(struct platform_device *pdev)
return err; return err;
} }
err = misc_register(&goldfish_pipe_dev); err = misc_register(&goldfish_pipe_miscdev);
if (err) { if (err) {
dev_err(&pdev->dev, "unable to register v2 device\n"); dev_err(&pdev->dev, "unable to register v2 device\n");
return err; return err;
...@@ -830,18 +830,16 @@ static int goldfish_pipe_device_init(struct platform_device *pdev) ...@@ -830,18 +830,16 @@ static int goldfish_pipe_device_init(struct platform_device *pdev)
static void goldfish_pipe_device_deinit(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_miscdev);
kfree(goldfish_pipe_dev.pipes);
misc_deregister(&goldfish_pipe_dev); free_page((unsigned long)goldfish_pipe_dev.buffers);
kfree(dev->pipes);
free_page((unsigned long)dev->buffers);
} }
static int goldfish_pipe_probe(struct platform_device *pdev) static int goldfish_pipe_probe(struct platform_device *pdev)
{ {
int err; int err;
struct resource *r; 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 */ /* not thread safe, but this should not happen */
WARN_ON(dev->base != NULL); WARN_ON(dev->base != NULL);
...@@ -889,7 +887,7 @@ static int goldfish_pipe_probe(struct platform_device *pdev) ...@@ -889,7 +887,7 @@ static int goldfish_pipe_probe(struct platform_device *pdev)
static int goldfish_pipe_remove(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); goldfish_pipe_device_deinit(pdev);
dev->base = NULL; dev->base = NULL;
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment