Re: [PULL]

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

On Fri, 19 Dec 2008 11:28:25 +0100
Janne Grunau <janne-dvb@xxxxxxxxx> wrote:

> On Friday 19 December 2008 05:26:45 Alan Nisota wrote:
> > Mauro Carvalho Chehab wrote:
> > > On Fri, 19 Dec 2008 03:23:52 +0100
> > >> There is a problem with the existing code though. cmd is allocated on
> > >> the stack. Some arches can't use aarays from stack with USB transfers.
> > >
> > > Very true.
> >
> > Please tell me what you'd like me to do.
> > The patch I've provided is no worse that what we've been using for the
> > past few years without issue.
> For this patch nothing. 

Yes. Since this is a separated issue, a separated patch is the proper way to address it.

> Stack memory works for USB transfers on x86. 

Not quite true. From my own experiments, even on x86, you may hit some troubles.

One approach to fix this is to allocate a buffer for urb control messages
together with the allocated struct.

Something like:

@@ -19,6 +19,7 @@
 struct gp8psk_fe_state {
 	struct dvb_frontend fe;
 	struct dvb_usb_device *d;
+	unsigned char buf[80];
 	u8 lock;
 	u16 snr;
 	unsigned long next_status_check;

Then, convert all usb control IN/OUT operations by something like this:

@@ -172,8 +173,9 @@
 	/* These commands are certainly wrong */
 	cmd = (burst == SEC_MINI_A) ? 0x00 : 0x01;
+	memcpy(st->buf, &cmd, 1);
 	if (gp8psk_usb_out_op(st->d,SEND_DISEQC_COMMAND, cmd, 0,
-			&cmd, 0)) {
+			st->buf, 0)) {
 		return -EINVAL;
 	return 0;

Notice that the above is not optimized, since you'll need to add extra code before every call to gp8psk_output_out_op (and also on gp8psk_input_out_op).

A better approach would be to move  struct gp8psk_fe_state definition to
gp8psk.h, and pass it as a parameter for gp8psk_usb_out_po() and
gp8psk_usb_in_op(), having the memcpy operations happening inside the functions.

> Since the patch does not change this it can and should be applied unmodified.

Hmm... There are lots of coding style violations there. Could you please fix them before I pull it?


v4l-dvb-maintainer mailing list

[Linux Media]     [Older V4L]     [Linux DVB]     [Video Disk Recorder]     [Asterisk]     [Photo]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Free Photo Albums]     [Fedora Users]     [Fedora Women]     [ALSA Users]     [ALSA Devel]     [SSH]     [Linux USB]

Add to Google Powered by Linux

Google PageRank Checking tool