Skip to contentSkip to conversation

staging: media: atomisp: Deduplicate and reformat atomisp_find_in_fmt_conv_by_atomisp_in_fmt()

PATCH In review Shivani Patel 2 participants 2 messages Nov 18

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: media: atomisp: Deduplicate and reformat atomisp_find_in_fmt_conv_by_atomisp_in_fmt()

atomisp_subdev.h contains duplicate declarations of atomisp_find_in_fmt_conv_by_atomisp_in_fmt() under ISP2400 and ISP2401 comments. Both declare the exact same function with broken formatting (lines ending with open parenthesis, leading spaces, and awkward line breaks).

Furthermore, the definition in atomisp_subdev.c uses the same broken formatting with leading spaces and a line ending with an open parenthesis.

Remove the duplicate declaration in atomisp_subdev.h, place the return type on its own line, and shorten the parameter name to 'fmt' so that the prototype and definition adhere to the 80-character line limit and Linux coding style.

---
 drivers/staging/media/atomisp/pci/atomisp_subdev.c |  6 +++---
 drivers/staging/media/atomisp/pci/atomisp_subdev.h | 10 ++--------
 2 files changed, 5 insertions(+), 11 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_subdev.c +3 -3
index bdd2d9b18..6af8a42a6 100644
@@ -95,13 +95,13 @@ const struct atomisp_in_fmt_conv *atomisp_find_in_fmt_conv(u32 code)
 	return NULL;
 }
 
-const struct atomisp_in_fmt_conv *atomisp_find_in_fmt_conv_by_atomisp_in_fmt(
-    enum atomisp_input_format atomisp_in_fmt)
+const struct atomisp_in_fmt_conv *
+atomisp_find_in_fmt_conv_by_atomisp_in_fmt(enum atomisp_input_format fmt)
 {
 	int i;
 
 	for (i = 0; i < ARRAY_SIZE(atomisp_in_fmt_conv) - 1; i++)
-		if (atomisp_in_fmt_conv[i].atomisp_in_fmt == atomisp_in_fmt)
+		if (atomisp_in_fmt_conv[i].atomisp_in_fmt == fmt)
 			return atomisp_in_fmt_conv + i;
 
 	return NULL;
drivers/staging/media/atomisp/pci/atomisp_subdev.h +2 -8
index b12bb65be..c4a3bce6f 100644
@@ -300,14 +300,8 @@ u32 atomisp_subdev_uncompressed_code(u32 code);
 bool atomisp_subdev_is_compressed(u32 code);
 const struct atomisp_in_fmt_conv *atomisp_find_in_fmt_conv(u32 code);
 
-/* ISP2400 */
-const struct atomisp_in_fmt_conv *atomisp_find_in_fmt_conv_by_atomisp_in_fmt(
-    enum atomisp_input_format atomisp_in_fmt);
-
-/* ISP2401 */
-const struct atomisp_in_fmt_conv
-*atomisp_find_in_fmt_conv_by_atomisp_in_fmt(enum atomisp_input_format
-	atomisp_in_fmt);
+const struct atomisp_in_fmt_conv *
+atomisp_find_in_fmt_conv_by_atomisp_in_fmt(enum atomisp_input_format fmt);
 
 const struct atomisp_in_fmt_conv *atomisp_find_in_fmt_conv_compressed(u32 code);
 bool atomisp_subdev_format_conversion(struct atomisp_sub_device *asd);
Signature · 1 line
2.50.1 (Apple Git-155)
#1 lore raw
Quoted 15 lines · Shivani Patel

atomisp_subdev.h contains duplicate declarations of atomisp_find_in_fmt_conv_by_atomisp_in_fmt() under ISP2400 and ISP2401 comments. Both declare the exact same function with broken formatting (lines ending with open parenthesis, leading spaces, and awkward line breaks).

Furthermore, the definition in atomisp_subdev.c uses the same broken formatting with leading spaces and a line ending with an open parenthesis.

Remove the duplicate declaration in atomisp_subdev.h, place the return type on its own line, and shorten the parameter name to 'fmt' so that the prototype and definition adhere to the 80-character line limit and Linux coding style.

...

drivers/staging/media/atomisp/pci/atomisp_subdev.c const struct atomisp_in_fmt_conv *atomisp_find_in_fmt_conv(u32 code) · line 99

Quoted 2 lines
drivers/staging/media/atomisp/pci/atomisp_subdev.c +2 -0
+const struct atomisp_in_fmt_conv *
+atomisp_find_in_fmt_conv_by_atomisp_in_fmt(enum atomisp_input_format fmt)

Can't we take one more step and drop the duplicate 'atomisp' in the name? The quick suggestion (you can try find a better one) for the name is atomisp_find_in_fmt_conv_by_enum() and also rename atomisp_find_in_fmt_conv() to atomisp_find_in_fmt_conv_by_code().

Also drop stale declaration for atomisp_find_in_fmt_conv_compressed().

Altogether, make a series of the three patches:
- drop duplicate / unused declarations of atomisp_find_in_fmt_conv*() namespace
- rename atomisp_find_in_fmt_conv() to atomisp_find_in_fmt_conv_by_code()
- this patch that renames atomisp_find_in_fmt_conv_by_atomisp_in_fmt() and fixes formatting

Don't forget to add a cover letter.

Signature · 2 lines
With Best Regards,
Andy Shevchenko