[linux-dvb] return value when FE_GET_FRONTEND fails?

Johannes Stezenbach js at linuxtv.org
Tue Apr 11 11:41:16 CEST 2006


On Tue, Apr 04, 2006, Trent Piepho wrote:
> I've written initial support (what I can without a datasheet) for the
> FE_GET_FRONTEND ioctl for the or51132 frontend, but I'm not sure what value to
> return on errors.
> 
> I read the current modulation from the chip, but this could fail (i2c error,
> unknown value returned, etc).
> 
> The API doesn't cover what to do if the frontend status can't be read, and
> current frontend drivers are inconsistent.
> 
> cx22700 and cx22702 return EAGAIN on error.  cx24123 and mt312 return
> EREMOTEIO.  mt352 returns EINVAL.  dib3000mb, dib3000mc, and l64781 return 0
> on an error.  The rest of the frontends either:
> 
> A) Have no error conditions.
> B) Don't check for errors or unexpected data from the hardware, usually
>    leaving some parameters uninitialized or with garbage values if an
>    error were to occur.
> C) Check for errors, but don't abort the ioctl or return a failure code.

EAGAIN is certainly wrong. EREMOTEIO is (was?) used in many
i2c/lm_sensors drivers, but IMHO EIO would make more sense.
EINVAL is wrong, too, as it implies the caller passed in
invalid arguments.


Johannes



More information about the linux-dvb mailing list