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>
This commit is contained in:
Родитель
2ed43e53e3
Коммит
610a72b707
|
@ -776,6 +776,14 @@ static struct miscdevice goldfish_pipe_miscdev = {
|
||||||
.fops = &goldfish_pipe_fops,
|
.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)
|
static int goldfish_pipe_device_init(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct goldfish_pipe_dev *dev = &goldfish_pipe_dev;
|
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 */
|
/* Send the buffer addresses to the host */
|
||||||
{
|
write_pa_addr(&dev->buffers->signalled_pipe_buffers,
|
||||||
u64 paddr = __pa(&dev->buffers->signalled_pipe_buffers);
|
dev->base + PIPE_REG_SIGNAL_BUFFER,
|
||||||
|
dev->base + PIPE_REG_SIGNAL_BUFFER_HIGH);
|
||||||
|
|
||||||
writel((u32)(unsigned long)(paddr >> 32),
|
writel((u32)MAX_SIGNALLED_PIPES,
|
||||||
dev->base + PIPE_REG_SIGNAL_BUFFER_HIGH);
|
dev->base + PIPE_REG_SIGNAL_BUFFER_COUNT);
|
||||||
writel((u32)(unsigned long)paddr,
|
|
||||||
dev->base + PIPE_REG_SIGNAL_BUFFER);
|
write_pa_addr(&dev->buffers->open_command_params,
|
||||||
writel((u32)MAX_SIGNALLED_PIPES,
|
dev->base + PIPE_REG_OPEN_BUFFER,
|
||||||
dev->base + PIPE_REG_SIGNAL_BUFFER_COUNT);
|
dev->base + PIPE_REG_OPEN_BUFFER_HIGH);
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче