media: imx274: consolidate per-mode data in imx274_frmfmt
authorLuca Ceresoli <luca@lucaceresoli.net>
Mon, 11 Jun 2018 11:35:33 +0000 (07:35 -0400)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Wed, 4 Jul 2018 11:25:08 +0000 (07:25 -0400)
commit96a2c731a4e661470d3a0a39d5efc792a22c7bba
treef0f44008004a0b25e7e78d86c4fb82a9eab46df5
parent438ac1fd5e1e132782795ba474b97fffbc79bbd5
media: imx274: consolidate per-mode data in imx274_frmfmt

Data about the implemented readout modes is partially stored in
imx274_formats[], the rest is scattered in several arrays. The latter
are then accessed using the mode index, e.g.:

  min_frame_len[priv->mode_index]

Consolidate all these data in imx274_formats[], and store a pointer to
the selected mode (i.e. imx274_formats[priv->mode_index]) in the main
device struct. This way code to use these data becomes more readable,
e.g.:

  priv->mode->min_frame_len

This removes lots of scaffolding code and keeps data about each mode
in a unique place.

Also remove a parameter to imx274_mode_regs() that is now unused.

While this adds the mode pointer to the device struct, it does not
remove the mode_index from it because mode_index is still used in two
dev_dbg() calls.  This will be handled in a follow-up commit.

Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/i2c/imx274.c