Re: [PATCH 8/9] platform: goldfish: pipe: Replace pr_ with dev_ for logging

From: Joe Perches
Date: Tue Aug 14 2018 - 09:27:05 EST


On Mon, 2018-08-13 at 16:38 -0700, rkir@xxxxxxxxxx wrote:
> dev_ is preferred if struct device is available.
[]
> diff --git a/drivers/platform/goldfish/goldfish_pipe.c b/drivers/platform/goldfish/goldfish_pipe.c
[]
> @@ -384,6 +384,7 @@ static ssize_t goldfish_pipe_read_write(struct file *filp,
> int count = 0, ret = -EINVAL;
> unsigned long address, address_end, last_page;
> unsigned int last_page_size;
> + struct device *pdev_dev;
>
> /* If the emulator already closed the pipe, no need to go further */
> if (unlikely(test_bit(BIT_CLOSED_ON_HOST, &pipe->flags)))
> @@ -401,6 +402,8 @@ static ssize_t goldfish_pipe_read_write(struct file *filp,
> last_page = (address_end - 1) & PAGE_MASK;
> last_page_size = ((address_end - 1) & ~PAGE_MASK) + 1;
>
> + pdev_dev = pipe->dev->pdev_dev;
> +
> while (address < address_end) {
> s32 consumed_size;
> int status;
> @@ -433,7 +436,8 @@ static ssize_t goldfish_pipe_read_write(struct file *filp,
> * err.
> */
> if (status != PIPE_ERROR_AGAIN)
> - pr_info_ratelimited("goldfish_pipe: backend error %d on %s\n",
> + dev_err_ratelimited(pdev_dev,
> + "goldfish_pipe: backend error %d on %s\n",
> status, is_write ? "write" : "read");
> break;
> }

Wouldn't it be simpler to use pipe->dev->pdev_dev here instead
of creating and assigning a probably unused use-once pointer?

What does the output look like now?

Is the "pipe->dev->pdev_dev->name" then "goldfish_pipe: " output
useful?