Re: [PATCH] usb: gadget: fix code so the warnings disappear

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 04, 2011 at 10:44:23AM +0200, Sebastian Andrzej Siewior wrote:
> Use proper printf length modifier for the dma_addr_t thingy. It is cast
> to u64 since dma_addr_t can be > 32bit on 32bit archs.
> 
> |usb/gadget/net2272.c: In function 'net2272_kick_dma':
> |usb/gadget/net2272.c:740:2: warning: format '%08x' expects type 'long unsigned int', but argument 6 has type 'dma_addr_t'
> |usb/gadget/net2272.c: In function 'net2272_queue':
> |usb/gadget/net2272.c:859:2: warning: format '%08x' expects type 'unsigned int', but argument 8 has type 'dma_addr_t'
> |usb/gadget/ci13xxx_udc.c: In function 'show_registers':
> |usb/gadget/ci13xxx_udc.c:1242:1: warning: the frame size of 2064 bytes is larger than 1024 bytes
> |usb/gadget/fusb300_udc.c: In function â??fusb300_fill_idma_prdtblâ??:
> |usb/gadget/fusb300_udc.c:1074:12: warning: cast from pointer to integer of different size
> |usb/gadget/fusb300_udc.c: At top level:
> |usb/gadget/fusb300_udc.c:771:13: warning: â??fusb300_wrfifoâ?? defined but not used
> |usb/gadget/fusb300_udc.c:1027:13: warning: â??fusb300_set_ep_bycntâ?? defined but not used
> |usb/gadget/langwell_udc.c: In function 'queue_dtd':
> |usb/gadget/langwell_udc.c:596:79: warning: cast from pointer to integer of different size
> |usb/gadget/langwell_udc.c: In function 'langwell_ep_dequeue':
> |usb/gadget/langwell_udc.c:922:11: warning: cast from pointer to integer of different size
> |usb/gadget/langwell_udc.c: In function 'langwell_udc_probe':
> |usb/gadget/langwell_udc.c:3274:2: warning: format '%d' expects type 'int', but argument 4 has type 'size_t'
> |usb/gadget/langwell_udc.c:3289:2: warning: format '%d' expects type 'int', but argument 4 has type 'size_t'
> |usb/gadget/langwell_udc.c: In function 'langwell_udc_resume':
> |usb/gadget/langwell_udc.c:3473:2: warning: format '%d' expects type 'int', but argument 4 has type 'size_t'
> |usb/gadget/langwell_udc.c:3487:2: warning: format '%d' expects type 'int', but argument 4 has type 'size_t'
> 
> fusb300_udc is a little more:
> - remove pointer u32 abuse in fusb300_fill_idma_prdtbl(). It is assigned
>   the dma_addr to a pointer and then back. Poor families may have to
>   recycle variables but we don't
> - don't free req.buf in error case. We don't do it in the ok case so it
>   is probably wring to do it in error case.
> - return in error case. There is no reason to continue without data and
>   performing ops on an invalid pointer.
> - The if (d) statement is bogus since an invalid DMA pointer is ~0 on
>   some architecutres. And since we return for the invalid case we don't
>   need it.
> - #if 0 unused code. If +2 cycles it is still there then I'm going to
>   nuke it. If it is required due to broken DMA engine make an
>   platform_data option.
> 
> Both, langwell and fusb depend on not PHYS_ADDR_T_64BIT since they don't
> handle the larger addr space correctly. This should be fixed for them if
> they wish to work properly on bigmem kernels.
> 
> Cc: Mike Frysinger <vapier@xxxxxxxxxx>
> Cc: Pavankumar Kondeti <pkondeti@xxxxxxxxxxxxxx>
> Cc: Yuan-Hsin Chen <yhchen@xxxxxxxxxxxxxxxx>
> Cc: Alan Cox <alan@xxxxxxxxxxxxxxx>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>

NAK, too much in one patch :-(

> Greg, are all of them addressed?
> 
>  drivers/usb/gadget/Kconfig        |    2 ++
>  drivers/usb/gadget/ci13xxx_udc.c  |   12 ++++++++++--
>  drivers/usb/gadget/fusb300_udc.c  |   26 +++++++++++---------------
>  drivers/usb/gadget/langwell_udc.c |   12 ++++++------
>  drivers/usb/gadget/net2272.c      |    8 ++++----
>  5 files changed, 33 insertions(+), 27 deletions(-)
> 
> diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
> index 46a253a..b0594d9 100644
> --- a/drivers/usb/gadget/Kconfig
> +++ b/drivers/usb/gadget/Kconfig
> @@ -157,6 +157,7 @@ config USB_FSL_USB2
>  
>  config USB_FUSB300
>  	tristate "Faraday FUSB300 USB Peripheral Controller"
> +	depends on !PHYS_ADDR_T_64BIT
>  	select USB_GADGET_DUALSPEED
>  	help
>  	   Faraday usb device controller FUSB300 driver
> @@ -425,6 +426,7 @@ config USB_GOKU
>  config USB_LANGWELL
>  	tristate "Intel Langwell USB Device Controller"
>  	depends on PCI
> +	depends on !PHYS_ADDR_T_64BIT

I would rather not. what if Intel comes up with a PCIe card to aid
development with this controller ?

> diff --git a/drivers/usb/gadget/fusb300_udc.c b/drivers/usb/gadget/fusb300_udc.c
> index 06353e7..277ebaa 100644
> --- a/drivers/usb/gadget/fusb300_udc.c
> +++ b/drivers/usb/gadget/fusb300_udc.c
> @@ -767,6 +767,7 @@ static void fusb300_rdfifo(struct fusb300_ep *ep,
>  	} while (!reg);
>  }
>  
> +#if 0
>  /* write data to fifo */
>  static void fusb300_wrfifo(struct fusb300_ep *ep,
>  			   struct fusb300_request *req)
> @@ -816,6 +817,7 @@ static void fusb300_wrfifo(struct fusb300_ep *ep,
>  		i++;
>  	} while (!reg);
>  }
> +#endif
>  
>  static u8 fusb300_get_epnstall(struct fusb300 *fusb300, u8 ep)
>  {
> @@ -1024,6 +1026,7 @@ static int setup_packet(struct fusb300 *fusb300, struct usb_ctrlrequest *ctrl)
>  	return ret;
>  }
>  
> +#if 0
>  static void fusb300_set_ep_bycnt(struct fusb300_ep *ep, u32 bycnt)
>  {
>  	struct fusb300 *fusb300 = ep->fusb300;
> @@ -1034,6 +1037,7 @@ static void fusb300_set_ep_bycnt(struct fusb300_ep *ep, u32 bycnt)
>  
>  	iowrite32(reg, fusb300->reg + FUSB300_OFFSET_EPFFR(ep->epnum));
>  }
> +#endif

I would rather remove the dead code. I'm sure there are people keeping
local patches to invert the if 0 crap so they can test PIO mode. It
would better if they would send us a proper patch making that runtime
selectable.

-- 
balbi

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux