diff mbox series

[v2,7/8] ACPI: property: Skip MIPI property table without "mipi-img" prefix

Message ID 20230123134617.265382-8-sakari.ailus@linux.intel.com (mailing list archive)
State Superseded, archived
Headers show
Series ACPI _CRS CSI-2 and MIPI DisCo for Imaging support | expand

Commit Message

Sakari Ailus Jan. 23, 2023, 1:46 p.m. UTC
For all _DSD properties, skip going through the MIPI DisCo for Imaging
property name substitution table if the property doesn't have "mipi-img-"
prefix.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
 drivers/acpi/mipi.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

Comments

Andy Shevchenko Jan. 23, 2023, 3:27 p.m. UTC | #1
On Mon, Jan 23, 2023 at 03:46:16PM +0200, Sakari Ailus wrote:
> For all _DSD properties, skip going through the MIPI DisCo for Imaging
> property name substitution table if the property doesn't have "mipi-img-"
> prefix.

...

> -	{ "mipi-img-lens-focus", "lens-focus" },
> -	{ "mipi-img-flash-leds", "flash-leds" },
> -	{ "mipi-img-clock-frequency", "clock-frequency" },
> -	{ "mipi-img-led-max-current", "led-max-microamp" },
> -	{ "mipi-img-flash-max-current", "flash-max-microamp" },
> -	{ "mipi-img-flash-max-timeout", "flash-max-timeout-us" },
> +	{ MIPI_IMG_PREFIX "lens-focus", "lens-focus" },
> +	{ MIPI_IMG_PREFIX "flash-leds", "flash-leds" },
> +	{ MIPI_IMG_PREFIX "clock-frequency", "clock-frequency" },
> +	{ MIPI_IMG_PREFIX "led-max-current", "led-max-microamp" },
> +	{ MIPI_IMG_PREFIX "flash-max-current", "flash-max-microamp" },
> +	{ MIPI_IMG_PREFIX "flash-max-timeout", "flash-max-timeout-us" },

I don't thing it ads to the readability, so I don't know why this (part of the)
change is needed.
Sakari Ailus Jan. 24, 2023, 3:54 p.m. UTC | #2
On Mon, Jan 23, 2023 at 05:27:46PM +0200, Andy Shevchenko wrote:
> On Mon, Jan 23, 2023 at 03:46:16PM +0200, Sakari Ailus wrote:
> > For all _DSD properties, skip going through the MIPI DisCo for Imaging
> > property name substitution table if the property doesn't have "mipi-img-"
> > prefix.
> 
> ...
> 
> > -	{ "mipi-img-lens-focus", "lens-focus" },
> > -	{ "mipi-img-flash-leds", "flash-leds" },
> > -	{ "mipi-img-clock-frequency", "clock-frequency" },
> > -	{ "mipi-img-led-max-current", "led-max-microamp" },
> > -	{ "mipi-img-flash-max-current", "flash-max-microamp" },
> > -	{ "mipi-img-flash-max-timeout", "flash-max-timeout-us" },
> > +	{ MIPI_IMG_PREFIX "lens-focus", "lens-focus" },
> > +	{ MIPI_IMG_PREFIX "flash-leds", "flash-leds" },
> > +	{ MIPI_IMG_PREFIX "clock-frequency", "clock-frequency" },
> > +	{ MIPI_IMG_PREFIX "led-max-current", "led-max-microamp" },
> > +	{ MIPI_IMG_PREFIX "flash-max-current", "flash-max-microamp" },
> > +	{ MIPI_IMG_PREFIX "flash-max-timeout", "flash-max-timeout-us" },
> 
> I don't thing it ads to the readability, so I don't know why this (part of the)
> change is needed.

Ok, I'll drop this chunk.
Andy Shevchenko Jan. 24, 2023, 4:41 p.m. UTC | #3
On Tue, Jan 24, 2023 at 05:54:00PM +0200, Sakari Ailus wrote:
> On Mon, Jan 23, 2023 at 05:27:46PM +0200, Andy Shevchenko wrote:
> > On Mon, Jan 23, 2023 at 03:46:16PM +0200, Sakari Ailus wrote:

...

> > > -	{ "mipi-img-lens-focus", "lens-focus" },
> > > -	{ "mipi-img-flash-leds", "flash-leds" },
> > > -	{ "mipi-img-clock-frequency", "clock-frequency" },
> > > -	{ "mipi-img-led-max-current", "led-max-microamp" },
> > > -	{ "mipi-img-flash-max-current", "flash-max-microamp" },
> > > -	{ "mipi-img-flash-max-timeout", "flash-max-timeout-us" },
> > > +	{ MIPI_IMG_PREFIX "lens-focus", "lens-focus" },
> > > +	{ MIPI_IMG_PREFIX "flash-leds", "flash-leds" },
> > > +	{ MIPI_IMG_PREFIX "clock-frequency", "clock-frequency" },
> > > +	{ MIPI_IMG_PREFIX "led-max-current", "led-max-microamp" },
> > > +	{ MIPI_IMG_PREFIX "flash-max-current", "flash-max-microamp" },
> > > +	{ MIPI_IMG_PREFIX "flash-max-timeout", "flash-max-timeout-us" },
> > 
> > I don't thing it ads to the readability, so I don't know why this (part of the)
> > change is needed.
> 
> Ok, I'll drop this chunk.

Thank you. What you can do, though, is to make the second list on the same
column (in the previous patch) if you consider it would be better.
Sakari Ailus Jan. 25, 2023, 8:25 a.m. UTC | #4
On Tue, Jan 24, 2023 at 06:41:14PM +0200, Andy Shevchenko wrote:
> On Tue, Jan 24, 2023 at 05:54:00PM +0200, Sakari Ailus wrote:
> > On Mon, Jan 23, 2023 at 05:27:46PM +0200, Andy Shevchenko wrote:
> > > On Mon, Jan 23, 2023 at 03:46:16PM +0200, Sakari Ailus wrote:
> 
> ...
> 
> > > > -	{ "mipi-img-lens-focus", "lens-focus" },
> > > > -	{ "mipi-img-flash-leds", "flash-leds" },
> > > > -	{ "mipi-img-clock-frequency", "clock-frequency" },
> > > > -	{ "mipi-img-led-max-current", "led-max-microamp" },
> > > > -	{ "mipi-img-flash-max-current", "flash-max-microamp" },
> > > > -	{ "mipi-img-flash-max-timeout", "flash-max-timeout-us" },
> > > > +	{ MIPI_IMG_PREFIX "lens-focus", "lens-focus" },
> > > > +	{ MIPI_IMG_PREFIX "flash-leds", "flash-leds" },
> > > > +	{ MIPI_IMG_PREFIX "clock-frequency", "clock-frequency" },
> > > > +	{ MIPI_IMG_PREFIX "led-max-current", "led-max-microamp" },
> > > > +	{ MIPI_IMG_PREFIX "flash-max-current", "flash-max-microamp" },
> > > > +	{ MIPI_IMG_PREFIX "flash-max-timeout", "flash-max-timeout-us" },
> > > 
> > > I don't thing it ads to the readability, so I don't know why this (part of the)
> > > change is needed.
> > 
> > Ok, I'll drop this chunk.
> 
> Thank you. What you can do, though, is to make the second list on the same
> column (in the previous patch) if you consider it would be better.

Yes, makes sense.
diff mbox series

Patch

diff --git a/drivers/acpi/mipi.c b/drivers/acpi/mipi.c
index 9177170952104..3cb698b094ac1 100644
--- a/drivers/acpi/mipi.c
+++ b/drivers/acpi/mipi.c
@@ -681,16 +681,18 @@  void acpi_init_swnodes(struct acpi_device *device)
 	device->fwnode.secondary = software_node_fwnode(ads->nodes);
 }
 
+#define MIPI_IMG_PREFIX "mipi-img-"
+
 static const struct mipi_disco_prop {
 	const char *mipi_prop;
 	const char *dt_prop;
 } mipi_disco_props[] = {
-	{ "mipi-img-lens-focus", "lens-focus" },
-	{ "mipi-img-flash-leds", "flash-leds" },
-	{ "mipi-img-clock-frequency", "clock-frequency" },
-	{ "mipi-img-led-max-current", "led-max-microamp" },
-	{ "mipi-img-flash-max-current", "flash-max-microamp" },
-	{ "mipi-img-flash-max-timeout", "flash-max-timeout-us" },
+	{ MIPI_IMG_PREFIX "lens-focus", "lens-focus" },
+	{ MIPI_IMG_PREFIX "flash-leds", "flash-leds" },
+	{ MIPI_IMG_PREFIX "clock-frequency", "clock-frequency" },
+	{ MIPI_IMG_PREFIX "led-max-current", "led-max-microamp" },
+	{ MIPI_IMG_PREFIX "flash-max-current", "flash-max-microamp" },
+	{ MIPI_IMG_PREFIX "flash-max-timeout", "flash-max-timeout-us" },
 };
 
 /**
@@ -706,6 +708,9 @@  void acpi_properties_prepare_mipi(union acpi_object *elements)
 {
 	unsigned int i;
 
+	if (!str_has_prefix(elements[0].string.pointer, MIPI_IMG_PREFIX))
+		return;
+
 	/* Replace MIPI DisCo for Imaging property names with DT equivalents. */
 	for (i = 0; i < ARRAY_SIZE(mipi_disco_props); i++) {
 		if (!strcmp(mipi_disco_props[i].mipi_prop,