diff options
author | Roman Kiryanov <rkir@google.com> | 2018-08-27 11:23:06 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-09-14 15:31:30 +0200 |
commit | 610a72b70733b6d5b7d3a1ee93f2e6daa2742ef3 (patch) | |
tree | 6ed14e1fa92e0acd5cb0ee0e7fc4ade35a16a86a /drivers/platform/goldfish | |
parent | 2ed43e53e35907456389dc9d8733d2221e6ec0e7 (diff) | |
download | linux-stable-610a72b70733b6d5b7d3a1ee93f2e6daa2742ef3.tar.gz linux-stable-610a72b70733b6d5b7d3a1ee93f2e6daa2742ef3.tar.bz2 linux-stable-610a72b70733b6d5b7d3a1ee93f2e6daa2742ef3.zip |
platform: goldfish: pipe: Replace two code blocks with a function call
Two function calls look cleaner because the function introduces
takes case of all bit shifting and casting.
Signed-off-by: Roman Kiryanov <rkir@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/platform/goldfish')
-rw-r--r-- | drivers/platform/goldfish/goldfish_pipe.c | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/drivers/platform/goldfish/goldfish_pipe.c b/drivers/platform/goldfish/goldfish_pipe.c index 3d28a9be5722..e3c09ff7867a 100644 --- a/drivers/platform/goldfish/goldfish_pipe.c +++ b/drivers/platform/goldfish/goldfish_pipe.c @@ -776,6 +776,14 @@ static struct miscdevice goldfish_pipe_miscdev = { .fops = &goldfish_pipe_fops, }; +static void write_pa_addr(void *addr, void __iomem *portl, void __iomem *porth) +{ + const unsigned long paddr = __pa(addr); + + writel(upper_32_bits(paddr), porth); + writel(lower_32_bits(paddr), portl); +} + static int goldfish_pipe_device_init(struct platform_device *pdev) { struct goldfish_pipe_dev *dev = &goldfish_pipe_dev; @@ -816,22 +824,17 @@ static int goldfish_pipe_device_init(struct platform_device *pdev) } /* Send the buffer addresses to the host */ - { - u64 paddr = __pa(&dev->buffers->signalled_pipe_buffers); - - writel((u32)(unsigned long)(paddr >> 32), - dev->base + PIPE_REG_SIGNAL_BUFFER_HIGH); - writel((u32)(unsigned long)paddr, - dev->base + PIPE_REG_SIGNAL_BUFFER); - writel((u32)MAX_SIGNALLED_PIPES, - dev->base + PIPE_REG_SIGNAL_BUFFER_COUNT); - - paddr = __pa(&dev->buffers->open_command_params); - writel((u32)(unsigned long)(paddr >> 32), - dev->base + PIPE_REG_OPEN_BUFFER_HIGH); - writel((u32)(unsigned long)paddr, - dev->base + PIPE_REG_OPEN_BUFFER); - } + write_pa_addr(&dev->buffers->signalled_pipe_buffers, + dev->base + PIPE_REG_SIGNAL_BUFFER, + dev->base + PIPE_REG_SIGNAL_BUFFER_HIGH); + + writel((u32)MAX_SIGNALLED_PIPES, + dev->base + PIPE_REG_SIGNAL_BUFFER_COUNT); + + write_pa_addr(&dev->buffers->open_command_params, + dev->base + PIPE_REG_OPEN_BUFFER, + dev->base + PIPE_REG_OPEN_BUFFER_HIGH); + return 0; } |