Re: [PATCH] PXA27x UDC driver.

From: Rodolfo Giometti
Date: Tue Jul 10 2007 - 11:48:45 EST


On Thu, Jun 28, 2007 at 02:29:49PM -0700, Andrew Morton wrote:
> >
> > +
> > +static int
> > +write_packet(volatile u32 * uddr, struct pxa27x_request *req, unsigned max)
>
> Please review Documentation/volatile-considered-harmful.txt

The attibute volatile here is necessary in order to avoid getting the
following warnings from the compiler:

CC drivers/usb/gadget/pxa27x_udc.o
drivers/usb/gadget/pxa27x_udc.c: In function `write_ep0_fifo':
drivers/usb/gadget/pxa27x_udc.c:512: warning: passing arg 1 of `write_packet' discards qualifiers from pointer target type
drivers/usb/gadget/pxa27x_udc.c: In function `pxa27x_ep_alloc':
drivers/usb/gadget/pxa27x_udc.c:1206: warning: assignment discards qualifiers from pointer target type
drivers/usb/gadget/pxa27x_udc.c:1207: warning: assignment discards qualifiers from pointer target type
drivers/usb/gadget/pxa27x_udc.c:1208: warning: assignment discards qualifiers from pointer target type
drivers/usb/gadget/pxa27x_udc.c:1209: warning: assignment discards qualifiers from pointer target type
drivers/usb/gadget/pxa27x_udc.c: At top level:
drivers/usb/gadget/pxa27x_udc.c:2159: warning: initialization discards qualifiers from pointer target type
drivers/usb/gadget/pxa27x_udc.c:2160: warning: initialization discards qualifiers from pointer target type

This because the variables reg_* are assigned as:

.reg_udccsr = &UDCCSR0

where UDCCSR0 are defined as:

#define UDCCSR0 __REG(0x40600100) /* UDC Control/Status register - Endpoint 0 */

and:

define __REG(x) (*((volatile u32 *)io_p2v(x)))

Do you know how I can resolve this?

Thanks in advance,

Rodolfo

--

GNU/Linux Solutions e-mail: giometti@xxxxxxxxxxxx
Linux Device Driver giometti@xxxxxxxxx
Embedded Systems giometti@xxxxxxxx
UNIX programming phone: +39 349 2432127
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/