diff mbox series

media: i2c: alvium-csi2: adjust code style for alvium driver

Message ID 20231212125319.732390-1-tomm.merciai@gmail.com (mailing list archive)
State New, archived
Headers show
Series media: i2c: alvium-csi2: adjust code style for alvium driver | expand

Commit Message

Tommaso Merciai Dec. 12, 2023, 12:53 p.m. UTC
Make some formatting changes to fix issues generated by
checkpatch.pl script

cmd:
 - ./scripts/checkpatch.pl --strict --max-line-length=80

Signed-off-by: Tommaso Merciai <tomm.merciai@gmail.com>
---
 drivers/media/i2c/alvium-csi2.c | 143 ++++++++++++++++++--------------
 1 file changed, 80 insertions(+), 63 deletions(-)

Comments

Sakari Ailus Dec. 13, 2023, 9:28 a.m. UTC | #1
On Tue, Dec 12, 2023 at 01:53:19PM +0100, Tommaso Merciai wrote:
> Make some formatting changes to fix issues generated by
> checkpatch.pl script
> 
> cmd:
>  - ./scripts/checkpatch.pl --strict --max-line-length=80
> 
> Signed-off-by: Tommaso Merciai <tomm.merciai@gmail.com>

Thanks, Tommaso. I've squashed this to the driver patch as I needed to
rework some patches in the branch anyway.
Tommaso Merciai Dec. 13, 2023, 10:34 a.m. UTC | #2
Hi Sakari,

On Wed, Dec 13, 2023 at 09:28:11AM +0000, Sakari Ailus wrote:
> On Tue, Dec 12, 2023 at 01:53:19PM +0100, Tommaso Merciai wrote:
> > Make some formatting changes to fix issues generated by
> > checkpatch.pl script
> > 
> > cmd:
> >  - ./scripts/checkpatch.pl --strict --max-line-length=80
> > 
> > Signed-off-by: Tommaso Merciai <tomm.merciai@gmail.com>
> 
> Thanks, Tommaso. I've squashed this to the driver patch as I needed to
> rework some patches in the branch anyway.

No problem :) Nice plan.
Thanks for let me know.

Regards,
Tommaso

> 
> -- 
> Sakari Ailus
diff mbox series

Patch

diff --git a/drivers/media/i2c/alvium-csi2.c b/drivers/media/i2c/alvium-csi2.c
index cff2b67247a7..95da5c3287b4 100644
--- a/drivers/media/i2c/alvium-csi2.c
+++ b/drivers/media/i2c/alvium-csi2.c
@@ -356,7 +356,8 @@  static int alvium_write_hshake(struct alvium_dev *alvium, u32 reg, u64 val)
 	read_poll_timeout(alvium_read, hshake_bit,
 			  ((hshake_bit & BCRM_HANDSHAKE_W_DONE_EN_BIT) == 1),
 			  15000, 45000, true,
-			  alvium, REG_BCRM_WRITE_HANDSHAKE_RW, &hshake_bit, &ret);
+			  alvium, REG_BCRM_WRITE_HANDSHAKE_RW,
+			  &hshake_bit, &ret);
 	if (ret) {
 		dev_err(dev, "poll bit[0] = 1, hshake reg fail\n");
 		return ret;
@@ -373,7 +374,8 @@  static int alvium_write_hshake(struct alvium_dev *alvium, u32 reg, u64 val)
 	read_poll_timeout(alvium_read, hshake_bit,
 			  ((hshake_bit & BCRM_HANDSHAKE_W_DONE_EN_BIT) == 0),
 			  15000, 45000, true,
-			  alvium, REG_BCRM_WRITE_HANDSHAKE_RW, &hshake_bit, &ret);
+			  alvium, REG_BCRM_WRITE_HANDSHAKE_RW,
+			  &hshake_bit, &ret);
 	if (ret) {
 		dev_err(dev, "poll bit[0] = 0, hshake reg fail\n");
 		return ret;
@@ -404,10 +406,14 @@  static int alvium_get_fw_version(struct alvium_dev *alvium)
 	u64 spec, maj, min, pat;
 	int ret = 0;
 
-	ret = alvium_read(alvium, REG_BCRM_DEVICE_FW_SPEC_VERSION_R, &spec, &ret);
-	ret = alvium_read(alvium, REG_BCRM_DEVICE_FW_MAJOR_VERSION_R, &maj, &ret);
-	ret = alvium_read(alvium, REG_BCRM_DEVICE_FW_MINOR_VERSION_R, &min, &ret);
-	ret = alvium_read(alvium, REG_BCRM_DEVICE_FW_PATCH_VERSION_R, &pat, &ret);
+	ret = alvium_read(alvium, REG_BCRM_DEVICE_FW_SPEC_VERSION_R,
+			  &spec, &ret);
+	ret = alvium_read(alvium, REG_BCRM_DEVICE_FW_MAJOR_VERSION_R,
+			  &maj, &ret);
+	ret = alvium_read(alvium, REG_BCRM_DEVICE_FW_MINOR_VERSION_R,
+			  &min, &ret);
+	ret = alvium_read(alvium, REG_BCRM_DEVICE_FW_PATCH_VERSION_R,
+			  &pat, &ret);
 	if (ret)
 		return ret;
 
@@ -509,7 +515,8 @@  static void alvium_print_avail_feat(struct alvium_dev *alvium)
 	dev_dbg(dev, "feature acq_abort: %u\n", alvium->avail_ft.acq_abort);
 	dev_dbg(dev, "feature acq_fr: %u\n", alvium->avail_ft.acq_fr);
 	dev_dbg(dev, "feature fr_trigger: %u\n", alvium->avail_ft.fr_trigger);
-	dev_dbg(dev, "feature exp_acq_line: %u\n", alvium->avail_ft.exp_acq_line);
+	dev_dbg(dev, "feature exp_acq_line: %u\n",
+		alvium->avail_ft.exp_acq_line);
 }
 
 static void alvium_print_avail_bayer(struct alvium_dev *alvium)
@@ -627,12 +634,13 @@  static int alvium_set_csi_clk(struct alvium_dev *alvium)
 	u64 csi_clk;
 	int ret;
 
-	csi_clk = clamp(alvium->ep.link_frequencies[0], (u64)alvium->min_csi_clk,
-			(u64)alvium->max_csi_clk);
+	csi_clk = clamp(alvium->ep.link_frequencies[0],
+			(u64)alvium->min_csi_clk, (u64)alvium->max_csi_clk);
 
 	if (alvium->ep.link_frequencies[0] != (u64)csi_clk) {
-		dev_warn(dev, "requested csi clock (%llu MHz) out of range [%u, %u]"
-			 "Adjusted to %llu\n", alvium->ep.link_frequencies[0],
+		dev_warn(dev,
+			 "requested csi clock (%llu MHz) out of range [%u, %u] Adjusted to %llu\n",
+			 alvium->ep.link_frequencies[0],
 			 alvium->min_csi_clk, alvium->max_csi_clk, csi_clk);
 	}
 
@@ -1023,44 +1031,44 @@  static int alvium_get_avail_mipi_data_format(struct alvium_dev *alvium)
 
 	avail_fmt = (struct alvium_avail_mipi_fmt *)&val;
 
-	alvium->is_mipi_fmt_avail[ALVIUM_BIT_YUV420_8_LEG]
-				  = avail_fmt->yuv420_8_leg;
-	alvium->is_mipi_fmt_avail[ALVIUM_BIT_YUV420_8]
-				  = avail_fmt->yuv420_8;
-	alvium->is_mipi_fmt_avail[ALVIUM_BIT_YUV420_10]
-				  = avail_fmt->yuv420_10;
-	alvium->is_mipi_fmt_avail[ALVIUM_BIT_YUV420_8_CSPS]
-				  = avail_fmt->yuv420_8_csps;
-	alvium->is_mipi_fmt_avail[ALVIUM_BIT_YUV420_10_CSPS]
-				  = avail_fmt->yuv420_10_csps;
-	alvium->is_mipi_fmt_avail[ALVIUM_BIT_YUV422_8]
-				  = avail_fmt->yuv422_8;
-	alvium->is_mipi_fmt_avail[ALVIUM_BIT_YUV422_10]
-				  = avail_fmt->yuv422_10;
-	alvium->is_mipi_fmt_avail[ALVIUM_BIT_RGB888]
-				  = avail_fmt->rgb888;
-	alvium->is_mipi_fmt_avail[ALVIUM_BIT_RGB666]
-				  = avail_fmt->rgb666;
-	alvium->is_mipi_fmt_avail[ALVIUM_BIT_RGB565]
-				  = avail_fmt->rgb565;
-	alvium->is_mipi_fmt_avail[ALVIUM_BIT_RGB555]
-				  = avail_fmt->rgb555;
-	alvium->is_mipi_fmt_avail[ALVIUM_BIT_RGB444]
-				  = avail_fmt->rgb444;
-	alvium->is_mipi_fmt_avail[ALVIUM_BIT_RAW6]
-				  = avail_fmt->raw6;
-	alvium->is_mipi_fmt_avail[ALVIUM_BIT_RAW7]
-				  = avail_fmt->raw7;
-	alvium->is_mipi_fmt_avail[ALVIUM_BIT_RAW8]
-				  = avail_fmt->raw8;
-	alvium->is_mipi_fmt_avail[ALVIUM_BIT_RAW10]
-				  = avail_fmt->raw10;
-	alvium->is_mipi_fmt_avail[ALVIUM_BIT_RAW12]
-				  = avail_fmt->raw12;
-	alvium->is_mipi_fmt_avail[ALVIUM_BIT_RAW14]
-				  = avail_fmt->raw14;
-	alvium->is_mipi_fmt_avail[ALVIUM_BIT_JPEG]
-				  = avail_fmt->jpeg;
+	alvium->is_mipi_fmt_avail[ALVIUM_BIT_YUV420_8_LEG] =
+				  avail_fmt->yuv420_8_leg;
+	alvium->is_mipi_fmt_avail[ALVIUM_BIT_YUV420_8] =
+				  avail_fmt->yuv420_8;
+	alvium->is_mipi_fmt_avail[ALVIUM_BIT_YUV420_10] =
+				  avail_fmt->yuv420_10;
+	alvium->is_mipi_fmt_avail[ALVIUM_BIT_YUV420_8_CSPS] =
+				  avail_fmt->yuv420_8_csps;
+	alvium->is_mipi_fmt_avail[ALVIUM_BIT_YUV420_10_CSPS] =
+				  avail_fmt->yuv420_10_csps;
+	alvium->is_mipi_fmt_avail[ALVIUM_BIT_YUV422_8] =
+				  avail_fmt->yuv422_8;
+	alvium->is_mipi_fmt_avail[ALVIUM_BIT_YUV422_10] =
+				  avail_fmt->yuv422_10;
+	alvium->is_mipi_fmt_avail[ALVIUM_BIT_RGB888] =
+				  avail_fmt->rgb888;
+	alvium->is_mipi_fmt_avail[ALVIUM_BIT_RGB666] =
+				  avail_fmt->rgb666;
+	alvium->is_mipi_fmt_avail[ALVIUM_BIT_RGB565] =
+				  avail_fmt->rgb565;
+	alvium->is_mipi_fmt_avail[ALVIUM_BIT_RGB555] =
+				  avail_fmt->rgb555;
+	alvium->is_mipi_fmt_avail[ALVIUM_BIT_RGB444] =
+				  avail_fmt->rgb444;
+	alvium->is_mipi_fmt_avail[ALVIUM_BIT_RAW6] =
+				  avail_fmt->raw6;
+	alvium->is_mipi_fmt_avail[ALVIUM_BIT_RAW7] =
+				  avail_fmt->raw7;
+	alvium->is_mipi_fmt_avail[ALVIUM_BIT_RAW8] =
+				  avail_fmt->raw8;
+	alvium->is_mipi_fmt_avail[ALVIUM_BIT_RAW10] =
+				  avail_fmt->raw10;
+	alvium->is_mipi_fmt_avail[ALVIUM_BIT_RAW12] =
+				  avail_fmt->raw12;
+	alvium->is_mipi_fmt_avail[ALVIUM_BIT_RAW14] =
+				  avail_fmt->raw14;
+	alvium->is_mipi_fmt_avail[ALVIUM_BIT_JPEG] =
+				  avail_fmt->jpeg;
 
 	alvium_print_avail_mipi_fmt(alvium);
 
@@ -1078,8 +1086,8 @@  static int alvium_setup_mipi_fmt(struct alvium_dev *alvium)
 		if (!alvium->is_mipi_fmt_avail[alvium_csi2_fmts[fmt].fmt_av_bit])
 			continue;
 
-		if ((!alvium_csi2_fmts[fmt].is_raw) ||
-		    (alvium->is_bay_avail[alvium_csi2_fmts[fmt].bay_av_bit]))
+		if (!alvium_csi2_fmts[fmt].is_raw ||
+		    alvium->is_bay_avail[alvium_csi2_fmts[fmt].bay_av_bit])
 			sz++;
 	}
 
@@ -1095,9 +1103,10 @@  static int alvium_setup_mipi_fmt(struct alvium_dev *alvium)
 		if (!alvium->is_mipi_fmt_avail[alvium_csi2_fmts[fmt].fmt_av_bit])
 			continue;
 
-		if ((!alvium_csi2_fmts[fmt].is_raw) ||
-		    (alvium->is_bay_avail[alvium_csi2_fmts[fmt].bay_av_bit])) {
-			alvium->alvium_csi2_fmt[avail_fmt_cnt] = alvium_csi2_fmts[fmt];
+		if (!alvium_csi2_fmts[fmt].is_raw ||
+		    alvium->is_bay_avail[alvium_csi2_fmts[fmt].bay_av_bit]) {
+			alvium->alvium_csi2_fmt[avail_fmt_cnt] =
+				alvium_csi2_fmts[fmt];
 			avail_fmt_cnt++;
 		}
 	}
@@ -1300,7 +1309,8 @@  static int alvium_set_ctrl_exposure(struct alvium_dev *alvium, int exposure_ns)
 	return 0;
 }
 
-static int alvium_set_ctrl_blue_balance_ratio(struct alvium_dev *alvium, int blue)
+static int alvium_set_ctrl_blue_balance_ratio(struct alvium_dev *alvium,
+					      int blue)
 {
 	struct device *dev = &alvium->i2c_client->dev;
 	int ret;
@@ -1667,8 +1677,10 @@  static int alvium_set_frame_interval(struct alvium_dev *alvium,
 	min_fr = alvium->min_fr;
 	max_fr = alvium->max_fr;
 
-	dev_dbg(dev, "fi->interval.numerator = %d\n", fi->interval.numerator);
-	dev_dbg(dev, "fi->interval.denominator = %d\n", fi->interval.denominator);
+	dev_dbg(dev, "fi->interval.numerator = %d\n",
+		fi->interval.numerator);
+	dev_dbg(dev, "fi->interval.denominator = %d\n",
+		fi->interval.denominator);
 
 	req_fr = (u64)((fi->interval.denominator * USEC_PER_SEC) /
 		       fi->interval.numerator);
@@ -2114,10 +2126,11 @@  static int alvium_ctrl_init(struct alvium_dev *alvium)
 
 	/* Auto/manual exposure */
 	if (alvium->avail_ft.auto_exp) {
-		ctrls->auto_exp = v4l2_ctrl_new_std_menu(hdl, ops,
-							 V4L2_CID_EXPOSURE_AUTO,
-							 V4L2_EXPOSURE_MANUAL, 0,
-							 V4L2_EXPOSURE_AUTO);
+		ctrls->auto_exp =
+			v4l2_ctrl_new_std_menu(hdl, ops,
+					       V4L2_CID_EXPOSURE_AUTO,
+					       V4L2_EXPOSURE_MANUAL, 0,
+					       V4L2_EXPOSURE_AUTO);
 		v4l2_ctrl_auto_cluster(2, &ctrls->auto_exp, 1, true);
 	}
 
@@ -2188,10 +2201,14 @@  static int alvium_ctrl_init(struct alvium_dev *alvium)
 						     alvium->dft_sharp);
 
 	if (alvium->avail_ft.rev_x)
-		ctrls->hflip = v4l2_ctrl_new_std(hdl, ops, V4L2_CID_HFLIP, 0, 1, 1, 0);
+		ctrls->hflip = v4l2_ctrl_new_std(hdl, ops,
+						 V4L2_CID_HFLIP,
+						 0, 1, 1, 0);
 
 	if (alvium->avail_ft.rev_y)
-		ctrls->vflip = v4l2_ctrl_new_std(hdl, ops, V4L2_CID_VFLIP, 0, 1, 1, 0);
+		ctrls->vflip = v4l2_ctrl_new_std(hdl, ops,
+						 V4L2_CID_VFLIP,
+						 0, 1, 1, 0);
 
 	if (hdl->error) {
 		ret = hdl->error;