Re: [PATCH v2 01/10] PCMCIA/i82092: use dev_<level> instead of printk

From: Greg Kroah-Hartman
Date: Tue Dec 10 2019 - 07:49:08 EST


On Tue, Dec 10, 2019 at 12:43:26PM +0100, Simon Geis wrote:
> Improve the log output by using the
> device-aware dev_err()/dev_info() functions. While at it, update one
> remaining printk(KERN_ERR ...) call to the preferred pr_err() call.
>
> Co-developed-by: Lukas Panzer <lukas.panzer@xxxxxx>
> Signed-off-by: Lukas Panzer <lukas.panzer@xxxxxx>
> Signed-off-by: Simon Geis <simon.geis@xxxxxx>
>
> ---
> drivers/pcmcia/i82092.c | 79 ++++++++++++++++++++++++++++++-----------
> 1 file changed, 58 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/pcmcia/i82092.c b/drivers/pcmcia/i82092.c
> index aad8a46605be..ba33293b1a34 100644
> --- a/drivers/pcmcia/i82092.c
> +++ b/drivers/pcmcia/i82092.c
> @@ -92,11 +92,13 @@ static int i82092aa_pci_probe(struct pci_dev *dev, const struct pci_device_id *i
> break;
>
> default:
> - printk(KERN_ERR "i82092aa: Oops, you did something we didn't think of.\n");
> + dev_err(&dev->dev,
> + "i82092aa: Oops, you did something we didn't think of.\n");

You already know the device and driver type (it comes built-into the
dev_err() message), so there's no need to keep the i82092aa everywhere
here, right?

> @@ -417,7 +422,9 @@ static int i82092aa_init(struct pcmcia_socket *sock)
>
> static int i82092aa_get_status(struct pcmcia_socket *socket, u_int *value)
> {
> - unsigned int sock = container_of(socket, struct socket_info, socket)->number;
> + struct socket_info *sock_info = container_of(socket, struct socket_info,
> + socket);
> + unsigned int sock = sock_info->number;


This does not look like a printk cleanup :(

> unsigned int status;
>
> enter("i82092aa_get_status");
> @@ -458,7 +465,9 @@ static int i82092aa_get_status(struct pcmcia_socket *socket, u_int *value)
>
> static int i82092aa_set_socket(struct pcmcia_socket *socket, socket_state_t *state)
> {
> - unsigned int sock = container_of(socket, struct socket_info, socket)->number;
> + struct socket_info *sock_info = container_of(socket, struct socket_info,
> + socket);
> + unsigned int sock = sock_info->number;

Nor does this :(


> -/* printk("set_io_map: Setting range to %x - %x \n",io->start,io->stop); */
> +/* dev_info(&sock_info->dev->dev,
> + * "set_io_map: Setting range to %x - %x\n",
> + * io->start, io->stop);
> + */

Just delete commented out lines.

> -/* printk("set_mem_map: Setting map %i range to %x - %x on socket %i, speed is %i, active = %i \n",map, region.start,region.end,sock,mem->speed,mem->flags & MAP_ACTIVE); */
> +/* dev_info(&sock_info->dev->dev,
> + * "set_mem_map: Setting map %i range to %x - %x on socket %i, "
> + * "speed is %i, active = %i\n", map,
> + * region.start, region.end, sock,mem->speed,
> + * mem->flags & MAP_ACTIVE);
> + */

same here.

> /* write the start address */
> base = I365_MEM(map);
> @@ -669,10 +700,16 @@ static int i82092aa_set_mem_map(struct pcmcia_socket *socket, struct pccard_mem_
> if (mem->flags & MAP_WRPROT)
> i |= I365_MEM_WRPROT;
> if (mem->flags & MAP_ATTRIB) {
> -/* printk("requesting attribute memory for socket %i\n",sock);*/
> +/* dev_info(&sock_info->dev->dev,
> + * "requesting attribute memory for socket %i\n",
> + * sock);
> + */

And here and elsewhere. They were just debugging lines.

thanks,

greg k-h