@@ -723,22 +723,19 @@ static int tuner_remove(struct i2c_client *client)
*/
/**
- * check_mode - Verify if tuner supports the requested mode
+ * supported_mode - Verify if tuner supports the requested mode
* @t: a pointer to the module's internal struct_tuner
*
* This function checks if the tuner is capable of tuning analog TV,
* digital TV or radio, depending on what the caller wants. If the
- * tuner can't support that mode, it returns -EINVAL. Otherwise, it
- * returns 0.
+ * tuner can't support that mode, it returns false. Otherwise, it
+ * returns true.
* This function is needed for boards that have a separate tuner for
* radio (like devices with tea5767).
*/
-static inline int check_mode(struct tuner *t, enum v4l2_tuner_type mode)
+static bool supported_mode(struct tuner *t, enum v4l2_tuner_type mode)
{
- if ((1 << mode & t->mode_mask) == 0)
- return -EINVAL;
-
- return 0;
+ return 1 << mode & t->mode_mask;
}
/**
@@ -759,7 +756,7 @@ static int set_mode_freq(struct i2c_client *client, struct tuner *t,
struct analog_demod_ops *analog_ops = &t->fe.ops.analog_ops;
if (mode != t->mode) {
- if (check_mode(t, mode) == -EINVAL) {
+ if (!supported_mode(t, mode)) {
tuner_dbg("Tuner doesn't support mode %d. "
"Putting tuner to sleep\n", mode);
t->standby = true;
@@ -1138,7 +1135,7 @@ static int tuner_g_frequency(struct v4l2_subdev *sd, struct v4l2_frequency *f)
struct tuner *t = to_tuner(sd);
struct dvb_tuner_ops *fe_tuner_ops = &t->fe.ops.tuner_ops;
- if (check_mode(t, f->type) == -EINVAL)
+ if (!supported_mode(t, f->type))
return 0;
f->type = t->mode;
if (fe_tuner_ops->get_frequency && !t->standby) {
@@ -1161,7 +1158,7 @@ static int tuner_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt)
struct analog_demod_ops *analog_ops = &t->fe.ops.analog_ops;
struct dvb_tuner_ops *fe_tuner_ops = &t->fe.ops.tuner_ops;
- if (check_mode(t, vt->type) == -EINVAL)
+ if (!supported_mode(t, vt->type))
return 0;
vt->type = t->mode;
if (analog_ops->get_afc)