[linux-dvb] 64-bit warnings when compiling v4l-dvb

Peter Beutner p.beutner at gmx.net
Wed Dec 7 22:55:27 CET 2005

Johannes Stezenbach schrieb:
> Thanks for the report. See also:
> http://linuxtv.org/pipermail/linux-dvb/2005-October/005630.html
> I haven't had time to look into it, and still would welcome
> patches from others to fix these issues.

It's not really an issue(besides the compiler warning).

The problem is:
err = fe->ops->dishnetwork_send_legacy_command(fe, (unsigned int)parg);
                                                  ^^^^^^^^^^^^^^^^ (where parg is void*)

But parg is never greater than 32bit in this case because we misuse the pointer to pass an
integer, so casting from a 64bit pointer to 32bit integer doesn't harm here. We know that
but the compiler doesn't know ;)

We could write it as:

err = fe->ops->dishnetwork_send_legacy_command(fe, (unsigned long)parg);

which shuts up the warnung, and the compiler then automatically casts from long->int.
But which isn't really nice either imo.
Or to make it clearer:

unsigned long val = (unsigned long) parg;
err = fe->ops->dishnetwork_send_legacy_command(fe, (unsigned int)val);

which is even more ugly.

Or convert dishnetwork_send_legacy_command in all to drivers to accept a long instead of
an int.Don't know if it's worth the effort though.
Or just live with the warning ;)

Dunno which way you would prefer?
The other warnings are all the same kind of problem.


More information about the linux-dvb mailing list