Message ID | 20220224160020.2630632-1-m.tretter@pengutronix.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | fixup! media: i2c: isl7998x: Add driver for Intersil ISL7998x | expand |
On Thu, Feb 24, 2022 at 05:00:20PM +0100, Michael Tretter wrote: > Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> > --- > drivers/media/i2c/isl7998x.c | 12 +++++------- > 1 file changed, 5 insertions(+), 7 deletions(-) > > diff --git a/drivers/media/i2c/isl7998x.c b/drivers/media/i2c/isl7998x.c > index df124a0b401c..67ff1f508717 100644 > --- a/drivers/media/i2c/isl7998x.c > +++ b/drivers/media/i2c/isl7998x.c > @@ -551,12 +551,11 @@ static unsigned int isl7998x_norm_to_val(v4l2_std_id norm) > { > unsigned int i; > > - if (norm == V4L2_STD_UNKNOWN) > - return ISL7998X_REG_PX_DEC_SDT_STANDARD_UNKNOWN; > - > for (i = 0; i < ARRAY_SIZE(isl7998x_std_res); i++) > if (isl7998x_std_res[i].norm & norm) > break; > + if (i == ARRAY_SIZE(isl7998x_std_res)) > + return ISL7998X_REG_PX_DEC_SDT_STANDARD_UNKNOWN; > > return isl7998x_std_res[i].id; > } > @@ -565,13 +564,12 @@ static const struct isl7998x_mode *isl7998x_norm_to_mode(v4l2_std_id norm) > { > unsigned int i; > > - /* Use NTSC default resolution during standard detection */ > - if (norm == V4L2_STD_UNKNOWN) > - return &supported_modes[1]; > - > for (i = 0; i < ARRAY_SIZE(isl7998x_std_res); i++) > if (isl7998x_std_res[i].norm & norm) > break; > + /* Use NTSC default resolution during standard detection */ > + if (i == ARRAY_SIZE(isl7998x_std_res)) > + return &supported_modes[1]; > > return isl7998x_std_res[i].mode; > } Thanks!
diff --git a/drivers/media/i2c/isl7998x.c b/drivers/media/i2c/isl7998x.c index df124a0b401c..67ff1f508717 100644 --- a/drivers/media/i2c/isl7998x.c +++ b/drivers/media/i2c/isl7998x.c @@ -551,12 +551,11 @@ static unsigned int isl7998x_norm_to_val(v4l2_std_id norm) { unsigned int i; - if (norm == V4L2_STD_UNKNOWN) - return ISL7998X_REG_PX_DEC_SDT_STANDARD_UNKNOWN; - for (i = 0; i < ARRAY_SIZE(isl7998x_std_res); i++) if (isl7998x_std_res[i].norm & norm) break; + if (i == ARRAY_SIZE(isl7998x_std_res)) + return ISL7998X_REG_PX_DEC_SDT_STANDARD_UNKNOWN; return isl7998x_std_res[i].id; } @@ -565,13 +564,12 @@ static const struct isl7998x_mode *isl7998x_norm_to_mode(v4l2_std_id norm) { unsigned int i; - /* Use NTSC default resolution during standard detection */ - if (norm == V4L2_STD_UNKNOWN) - return &supported_modes[1]; - for (i = 0; i < ARRAY_SIZE(isl7998x_std_res); i++) if (isl7998x_std_res[i].norm & norm) break; + /* Use NTSC default resolution during standard detection */ + if (i == ARRAY_SIZE(isl7998x_std_res)) + return &supported_modes[1]; return isl7998x_std_res[i].mode; }
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> --- drivers/media/i2c/isl7998x.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)