Re: [PATCH v2 2/2] USB: OHCI: pxa27x:fix code warnig and errors

From: Greg Kroah-Hartman
Date: Sun Dec 11 2016 - 02:11:13 EST


On Sat, Dec 10, 2016 at 11:08:45PM +0000, csmanjuvijay@xxxxxxxxx wrote:
> From: Manjunath Goudar <csmanjuvijay@xxxxxxxxx>
>
> This patch will fix the checkpatch.pl following errors:
> WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ...
> then dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
> ERROR: space prohibited after that open parenthesis '('
> ERROR: space prohibited before that close parenthesis ')'
>
> Signed-off-by: Manjunath Goudar <csmanjuvijay@xxxxxxxxx>
> Cc: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>
> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> Cc: linux-usb@xxxxxxxxxxxxxxx
> Cc: linux-kernel@xxxxxxxxxxxxxxx
>
> ---
> changelog V1->V2:
> Have fixed the printk warning.
> drivers/usb/host/ohci-pxa27x.c | 16 +++++++++-------
> 1 file changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c
> index c73e1ae..350e384 100644
> --- a/drivers/usb/host/ohci-pxa27x.c
> +++ b/drivers/usb/host/ohci-pxa27x.c
> @@ -138,12 +138,15 @@ struct pxa27x_ohci {
> * PMM_PERPORT_MODE -- PMM per port switching mode
> * Ports are powered individually.
> */
> -static int pxa27x_ohci_select_pmm(struct pxa27x_ohci *pxa_ohci, int mode)
> +static int pxa27x_ohci_select_pmm(struct pxa27x_ohci *pxa_ohci,
> + struct device *dev)

Eeek, no!

Stop and look at what you did here. Why would you want to include 2
struct device pointers in a function, when they really point to the same
thing? That makes no sense at all.

I appreciate general code cleanups, but please, get some experience in C
and how the kernel handles the driver model before trying to make
changes like this. You can't just blindly make coding style changes and
expect them to be correct without that knowledge.

If you want to make coding style fixes, please practice on the
drivers/staging/ area. The maintainer of that code is much more
forgiving and not grumpy when stuff like this happens...

thanks,

greg k-h