Skip to contentSkip to conversation

Make ACPI_PTR() use PTR_IF()

PATCH NAK Sakari Ailus 3 participants 15 messages Aug 28 – Sep 9

Subsystems (12)
lore
Share & tools
lore

Sakari Ailus

author maintainer
#0 lore raw

cover Make ACPI_PTR() use PTR_IF()

Hi all,

This small set makes ACPI_PTR() use PTR_IF() and so enables using ACPI_PTR() on ACPI ID tables without marking the tables with __maybe_unused.

The ipu-bridge patch needs to be merged first as it contains some unsanitary use of ACPI_PTR() and that needs to be merged before the ACPI patch.

I'd take also the ACPI patch via the Media tree if people are happy with the approach. Otherwise there are two dependencies between the ACPI and Media trees.

Sakari Ailus (3):
media: ipu-bridge: Drop redundant ACPI_PTR() usage
ACPI: Use PTR_IF() for ACPI_PTR()
media: i2c: Use ACPI_PTR() for ACPI ID tables

 drivers/media/i2c/ccs/ccs-core.c     |  2 +-
 drivers/media/i2c/cvs/core.c         |  4 ++--
 drivers/media/i2c/gc0310.c           |  2 +-
 drivers/media/i2c/mt9m114.c          |  2 +-
 drivers/media/i2c/ov02e10.c          |  2 +-
 drivers/media/i2c/ov2680.c           |  2 +-
 drivers/media/i2c/ov2740.c           |  2 +-
 drivers/media/i2c/ov5693.c           |  2 +-
 drivers/media/i2c/ov7251.c           |  2 +-
 drivers/media/i2c/ov8865.c           |  2 +-
 drivers/media/i2c/ov9734.c           |  2 +-
 drivers/media/pci/intel/ipu-bridge.c | 17 ++++++++---------
 include/linux/acpi.h                 |  5 ++---
 13 files changed, 22 insertions(+), 24 deletions(-)

base-commit: 56c29fa3ee666197516a231e75aed789ae9c530d

Signature · 1 line
2.47.3
author maintainer
#1 lore raw

PATCH 1/3 media: ipu-bridge: Drop redundant ACPI_PTR() usage

The ipu-bridge depends on CONFIG_ACPI, therefore ACPI_PTR(ptr) always yields ptr. Drop all use of ACPI_PTR() in the ipu-bridge.

---
 drivers/media/pci/intel/ipu-bridge.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)
drivers/media/pci/intel/ipu-bridge.c +8 -9
index f9efa501e8cf..cdd654efd1dd 100644
@@ -17,7 +17,7 @@
 #include <media/ipu-bridge.h>
 #include <media/v4l2-fwnode.h>
 
-#define ADEV_DEV(adev) ACPI_PTR(&((adev)->dev))
+#define ADEV_DEV(adev) &(adev)->dev
 
 /*
  * 92335fcf-3203-4472-af93-7b4453ac29da
@@ -239,12 +239,12 @@ static struct acpi_device *ipu_bridge_get_ivsc_acpi_dev(struct acpi_device *adev
 	for (i = 0; i < ARRAY_SIZE(ivsc_acpi_ids); i++) {
 		const struct acpi_device_id *acpi_id = &ivsc_acpi_ids[i];
 		struct acpi_device *consumer, *ivsc_adev;
-		acpi_handle handle = acpi_device_handle(ACPI_PTR(adev));
+		acpi_handle handle = acpi_device_handle(adev);
 
 		for_each_acpi_dev_match(ivsc_adev, acpi_id->id, NULL, -1)
 			/* camera sensor depends on IVSC in DSDT if exist */
 			for_each_acpi_consumer_dev(ivsc_adev, consumer)
-				if (ACPI_PTR(consumer->handle) == handle) {
+				if (consumer->handle == handle) {
 					acpi_dev_put(consumer);
 					return ivsc_adev;
 				}
@@ -322,8 +322,7 @@ static int ipu_bridge_read_acpi_buffer(struct acpi_device *adev, char *id,
 	acpi_status status;
 	int ret = 0;
 
-	status = acpi_evaluate_object(ACPI_PTR(adev->handle),
-				      id, NULL, &buffer);
+	status = acpi_evaluate_object(adev->handle, id, NULL, &buffer);
 	if (ACPI_FAILURE(status))
 		return -ENODEV;
 
@@ -379,7 +378,7 @@ static enum v4l2_fwnode_orientation ipu_bridge_parse_orientation(struct acpi_dev
 	enum v4l2_fwnode_orientation orientation;
 	struct acpi_pld_info *pld = NULL;
 
-	if (!acpi_get_physical_device_location(ACPI_PTR(adev->handle), &pld)) {
+	if (!acpi_get_physical_device_location(adev->handle, &pld)) {
 		dev_warn(ADEV_DEV(adev), "_PLD call failed, using default orientation\n");
 		return V4L2_FWNODE_ORIENTATION_EXTERNAL;
 	}
@@ -785,7 +784,7 @@ static int ipu_bridge_connect_sensor(const struct ipu_sensor_config *cfg,
 	int ret;
 
 	for_each_acpi_dev_match(adev, cfg->hid, NULL, -1) {
-		if (!ACPI_PTR(adev->status.enabled))
+		if (!adev->status.enabled)
 			continue;
 
 		if (bridge->n_sensors >= IPU_MAX_PORTS) {
@@ -821,7 +820,7 @@ static int ipu_bridge_connect_sensor(const struct ipu_sensor_config *cfg,
 			goto err_free_swnodes;
 		}
 
-		sensor->adev = ACPI_PTR(acpi_dev_get(adev));
+		sensor->adev = acpi_dev_get(adev);
 
 		primary = acpi_fwnode_handle(adev);
 		primary->secondary = fwnode;
@@ -881,7 +880,7 @@ static int ipu_bridge_ivsc_is_ready(void)
 			&ipu_supported_sensors[i];
 
 		for_each_acpi_dev_match(sensor_adev, cfg->hid, NULL, -1) {
-			if (!ACPI_PTR(sensor_adev->status.enabled))
+			if (!sensor_adev->status.enabled)
 				continue;
 
 			adev = ipu_bridge_get_ivsc_acpi_dev(sensor_adev);
Signature · 1 line
2.47.3
maintainer Reviewed-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] media: ipu-bridge: Drop redundant ACPI_PTR() usage

Quoted 5 lines · Sakari Ailus

The ipu-bridge depends on CONFIG_ACPI, therefore ACPI_PTR(ptr) always yields ptr. Drop all use of ACPI_PTR() in the ipu-bridge.

Quoted 81 lines
---
 drivers/media/pci/intel/ipu-bridge.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)
drivers/media/pci/intel/ipu-bridge.c +8 -10
index f9efa501e8cf..cdd654efd1dd 100644
@@ -17,7 +17,7 @@
 #include <media/ipu-bridge.h>
 #include <media/v4l2-fwnode.h>
 
-#define ADEV_DEV(adev) ACPI_PTR(&((adev)->dev))
+#define ADEV_DEV(adev) &(adev)->dev
 
 /*
  * 92335fcf-3203-4472-af93-7b4453ac29da
@@ -239,12 +239,12 @@ static struct acpi_device *ipu_bridge_get_ivsc_acpi_dev(struct acpi_device *adev
        for (i = 0; i < ARRAY_SIZE(ivsc_acpi_ids); i++) {
                const struct acpi_device_id *acpi_id = &ivsc_acpi_ids[i];
                struct acpi_device *consumer, *ivsc_adev;
-               acpi_handle handle = acpi_device_handle(ACPI_PTR(adev));
+               acpi_handle handle = acpi_device_handle(adev);
 
                for_each_acpi_dev_match(ivsc_adev, acpi_id->id, NULL, -1)
                        /* camera sensor depends on IVSC in DSDT if exist */
                        for_each_acpi_consumer_dev(ivsc_adev, consumer)
-                               if (ACPI_PTR(consumer->handle) == handle) {
+                               if (consumer->handle == handle) {
                                        acpi_dev_put(consumer);
                                        return ivsc_adev;
                                }
@@ -322,8 +322,7 @@ static int ipu_bridge_read_acpi_buffer(struct acpi_device *adev, char *id,
        acpi_status status;
        int ret = 0;
 
-       status = acpi_evaluate_object(ACPI_PTR(adev->handle),
-                                     id, NULL, &buffer);
+       status = acpi_evaluate_object(adev->handle, id, NULL, &buffer);
        if (ACPI_FAILURE(status))
                return -ENODEV;
 
@@ -379,7 +378,7 @@ static enum v4l2_fwnode_orientation ipu_bridge_parse_orientation(struct acpi_dev
        enum v4l2_fwnode_orientation orientation;
        struct acpi_pld_info *pld = NULL;
 
-       if (!acpi_get_physical_device_location(ACPI_PTR(adev->handle), &pld)) {
+       if (!acpi_get_physical_device_location(adev->handle, &pld)) {
                dev_warn(ADEV_DEV(adev), "_PLD call failed, using default orientation\n");
                return V4L2_FWNODE_ORIENTATION_EXTERNAL;
        }
@@ -785,7 +784,7 @@ static int ipu_bridge_connect_sensor(const struct ipu_sensor_config *cfg,
        int ret;
 
        for_each_acpi_dev_match(adev, cfg->hid, NULL, -1) {
-               if (!ACPI_PTR(adev->status.enabled))
+               if (!adev->status.enabled)
                        continue;
 
                if (bridge->n_sensors >= IPU_MAX_PORTS) {
@@ -821,7 +820,7 @@ static int ipu_bridge_connect_sensor(const struct ipu_sensor_config *cfg,
                        goto err_free_swnodes;
                }
 
-               sensor->adev = ACPI_PTR(acpi_dev_get(adev));
+               sensor->adev = acpi_dev_get(adev);
 
                primary = acpi_fwnode_handle(adev);
                primary->secondary = fwnode;
@@ -881,7 +880,7 @@ static int ipu_bridge_ivsc_is_ready(void)
                        &ipu_supported_sensors[i];
 
                for_each_acpi_dev_match(sensor_adev, cfg->hid, NULL, -1) {
-                       if (!ACPI_PTR(sensor_adev->status.enabled))
+                       if (!sensor_adev->status.enabled)
                                continue;
 
                        adev = ipu_bridge_get_ivsc_acpi_dev(sensor_adev);
--

2.47.3

author maintainer
#3 lore raw

PATCH 2/3 ACPI: Use PTR_IF() for ACPI_PTR()

In reply to Sakari Ailus

Make ACPI_PTR() use PTR_IF() so __maybe_unused can be dropped from what is being referred to.

---
 include/linux/acpi.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
include/linux/acpi.h +2 -3
index 10d6c6c11bdf..347763282f36 100644
@@ -755,7 +755,6 @@ int acpi_device_modalias(struct device *, char *, int);
 
 struct platform_device *acpi_create_platform_device(struct acpi_device *,
 						    const struct property_entry *);
-#define ACPI_PTR(_ptr)	(_ptr)
 
 static inline void acpi_device_set_enumerated(struct acpi_device *adev)
 {
@@ -1073,8 +1072,6 @@ static inline int acpi_dma_configure_id(struct device *dev,
 	return 0;
 }
 
-#define ACPI_PTR(_ptr)	(NULL)
-
 static inline void acpi_device_set_enumerated(struct acpi_device *adev)
 {
 }
@@ -1152,6 +1149,8 @@ static inline int acpi_mrrm_max_mem_region(void)
 
 #endif	/* !CONFIG_ACPI */
 
+#define ACPI_PTR(_ptr) PTR_IF(IS_BUILTIN(CONFIG_ACPI), _ptr)
+
 #ifdef CONFIG_ACPI_HMAT
 int hmat_get_extended_linear_cache_size(struct resource *backing_res, int nid,
 					resource_size_t *size);
Signature · 1 line
2.47.3
maintainer Acked-by on v1 2/3
#4 lore raw

Re: [PATCH 2/3] ACPI: Use PTR_IF() for ACPI_PTR()

Quoted 5 lines · Sakari Ailus

Make ACPI_PTR() use PTR_IF() so __maybe_unused can be dropped from what is being referred to.

Quoted 37 lines
---
 include/linux/acpi.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
include/linux/acpi.h +2 -4
index 10d6c6c11bdf..347763282f36 100644
@@ -755,7 +755,6 @@ int acpi_device_modalias(struct device *, char *, int);
 
 struct platform_device *acpi_create_platform_device(struct acpi_device *,
                                                    const struct property_entry *);
-#define ACPI_PTR(_ptr) (_ptr)
 
 static inline void acpi_device_set_enumerated(struct acpi_device *adev)
 {
@@ -1073,8 +1072,6 @@ static inline int acpi_dma_configure_id(struct device *dev,
        return 0;
 }
 
-#define ACPI_PTR(_ptr) (NULL)
-
 static inline void acpi_device_set_enumerated(struct acpi_device *adev)
 {
 }
@@ -1152,6 +1149,8 @@ static inline int acpi_mrrm_max_mem_region(void)
 
 #endif /* !CONFIG_ACPI */
 
+#define ACPI_PTR(_ptr) PTR_IF(IS_BUILTIN(CONFIG_ACPI), _ptr)
+
 #ifdef CONFIG_ACPI_HMAT
 int hmat_get_extended_linear_cache_size(struct resource *backing_res, int nid,
                                        resource_size_t *size);
--

2.47.3

#5 lore raw

Re: [PATCH 2/3] ACPI: Use PTR_IF() for ACPI_PTR()

Quoted 10 lines · Rafael J. Wysocki (Intel)
Quoted 5 lines · Sakari Ailus

Make ACPI_PTR() use PTR_IF() so __maybe_unused can be dropped from what is being referred to.

Or do you want me to pick it up?

Quoted 35 lines
Quoted 35 lines
---
 include/linux/acpi.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
include/linux/acpi.h +2 -4
index 10d6c6c11bdf..347763282f36 100644
@@ -755,7 +755,6 @@ int acpi_device_modalias(struct device *, char *, int);
 
 struct platform_device *acpi_create_platform_device(struct acpi_device *,
                                                    const struct property_entry *);
-#define ACPI_PTR(_ptr) (_ptr)
 
 static inline void acpi_device_set_enumerated(struct acpi_device *adev)
 {
@@ -1073,8 +1072,6 @@ static inline int acpi_dma_configure_id(struct device *dev,
        return 0;
 }
 
-#define ACPI_PTR(_ptr) (NULL)
-
 static inline void acpi_device_set_enumerated(struct acpi_device *adev)
 {
 }
@@ -1152,6 +1149,8 @@ static inline int acpi_mrrm_max_mem_region(void)
 
 #endif /* !CONFIG_ACPI */
 
+#define ACPI_PTR(_ptr) PTR_IF(IS_BUILTIN(CONFIG_ACPI), _ptr)
+
 #ifdef CONFIG_ACPI_HMAT
 int hmat_get_extended_linear_cache_size(struct resource *backing_res, int nid,
                                        resource_size_t *size);
--
author maintainer
#6 lore raw

Re: [PATCH 2/3] ACPI: Use PTR_IF() for ACPI_PTR()

Quoted 6 lines · Rafael J. Wysocki (Intel)
Quoted 4 lines · Rafael J. Wysocki (Intel)
Quoted 1 line · Sakari Ailus
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

Make ACPI_PTR() use PTR_IF() so __maybe_unused can be dropped from what is being referred to.

Or do you want me to pick it up?

I'm happy to take it. I wondered if you had an opinion on ACPI_PTR() use in the third patch.

Signature · 1 line
Sakari Ailus
#7 lore raw

Re: [PATCH 2/3] ACPI: Use PTR_IF() for ACPI_PTR()

Quoted 11 lines · Sakari Ailus
Quoted 9 lines · Rafael J. Wysocki (Intel)
Quoted 7 lines · Rafael J. Wysocki (Intel)
Quoted 4 lines · Sakari Ailus

Make ACPI_PTR() use PTR_IF() so __maybe_unused can be dropped from what is being referred to.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Or do you want me to pick it up?

I'm happy to take it.

OK (less work)

Quoted 1 line

I wondered if you had an opinion on ACPI_PTR() use in the third patch.

Not really TBH, sorry.

author maintainer
#8 lore raw

PATCH 3/3 media: i2c: Use ACPI_PTR() for ACPI ID tables

In reply to Sakari Ailus

Add ACPI_PTR() to the ACPI ID tables where missing. The patch has been produced with the following command:

git grep -lP 'acpi_match_table.*=\s*(?!ACPI_PTR)' \
	drivers/media/|while read i; do
	perl -i -pe 's/\.acpi_match_table\s*=\s*\K(\w+),/ACPI_PTR($1),/' $i;

done

---
 drivers/media/i2c/ccs/ccs-core.c | 2 +-
 drivers/media/i2c/cvs/core.c     | 4 ++--
 drivers/media/i2c/gc0310.c       | 2 +-
 drivers/media/i2c/mt9m114.c      | 2 +-
 drivers/media/i2c/ov02e10.c      | 2 +-
 drivers/media/i2c/ov2680.c       | 2 +-
 drivers/media/i2c/ov2740.c       | 2 +-
 drivers/media/i2c/ov5693.c       | 2 +-
 drivers/media/i2c/ov7251.c       | 2 +-
 drivers/media/i2c/ov8865.c       | 2 +-
 drivers/media/i2c/ov9734.c       | 2 +-
 11 files changed, 12 insertions(+), 12 deletions(-)
drivers/media/i2c/ccs/ccs-core.c +1 -1
index 8e25f970fd12..1d68d981d7f2 100644
@@ -3679,7 +3679,7 @@ static const struct dev_pm_ops ccs_pm_ops = {
 
 static struct i2c_driver ccs_i2c_driver = {
 	.driver	= {
-		.acpi_match_table = ccs_acpi_table,
+		.acpi_match_table = ACPI_PTR(ccs_acpi_table),
 		.of_match_table = ccs_of_table,
 		.name = CCS_NAME,
 		.pm = &ccs_pm_ops,
drivers/media/i2c/cvs/core.c +2 -2
index 7486815b16bd..390cd0ff2c6e 100644
@@ -973,7 +973,7 @@ MODULE_DEVICE_TABLE(acpi, intel_cvs_acpi_match);
 static struct i2c_driver cvs_driver = {
 	.driver = {
 		.name = "intel_cvs",
-		.acpi_match_table = intel_cvs_acpi_match,
+		.acpi_match_table = ACPI_PTR(intel_cvs_acpi_match),
 		.pm = pm_ptr(&cvs_pm_ops),
 	},
 	.probe = cvs_probe,
@@ -1000,7 +1000,7 @@ static void cvs_platform_remove(struct platform_device *pdev)
 static struct platform_driver cvs_platform_driver = {
 	.driver = {
 		.name = "cvs_platform",
-		.acpi_match_table = intel_cvs_acpi_match,
+		.acpi_match_table = ACPI_PTR(intel_cvs_acpi_match),
 		.pm = pm_ptr(&cvs_pm_ops),
 	},
 	.probe = cvs_platform_probe,
drivers/media/i2c/gc0310.c +1 -1
index 754e82ad50ae..0f756a250536 100644
@@ -768,7 +768,7 @@ static struct i2c_driver gc0310_driver = {
 	.driver = {
 		.name = "gc0310",
 		.pm = pm_sleep_ptr(&gc0310_pm_ops),
-		.acpi_match_table = gc0310_acpi_match,
+		.acpi_match_table = ACPI_PTR(gc0310_acpi_match),
 	},
 	.probe = gc0310_probe,
 	.remove = gc0310_remove,
drivers/media/i2c/mt9m114.c +1 -1
index e395e2d14e97..65aee72627d7 100644
@@ -2684,7 +2684,7 @@ static struct i2c_driver mt9m114_driver = {
 		.name	= "mt9m114",
 		.pm	= &mt9m114_pm_ops,
 		.of_match_table = mt9m114_of_ids,
-		.acpi_match_table = mt9m114_acpi_ids,
+		.acpi_match_table = ACPI_PTR(mt9m114_acpi_ids),
 	},
 	.probe		= mt9m114_probe,
 	.remove		= mt9m114_remove,
drivers/media/i2c/ov02e10.c +1 -1
index 4a64cba99991..5e1ad6bdaaa1 100644
@@ -939,7 +939,7 @@ static struct i2c_driver ov02e10_i2c_driver = {
 	.driver = {
 		.name = "ov02e10",
 		.pm = pm_sleep_ptr(&ov02e10_pm_ops),
-		.acpi_match_table = ov02e10_acpi_ids,
+		.acpi_match_table = ACPI_PTR(ov02e10_acpi_ids),
 		.of_match_table = ov02e10_of_match,
 	},
 	.probe = ov02e10_probe,
drivers/media/i2c/ov2680.c +1 -1
index 78e63bd1b35b..6dd7f454242a 100644
@@ -1312,7 +1312,7 @@ static struct i2c_driver ov2680_i2c_driver = {
 		.name  = "ov2680",
 		.pm = pm_sleep_ptr(&ov2680_pm_ops),
 		.of_match_table	= ov2680_dt_ids,
-		.acpi_match_table = ov2680_acpi_ids,
+		.acpi_match_table = ACPI_PTR(ov2680_acpi_ids),
 	},
 	.probe		= ov2680_probe,
 	.remove		= ov2680_remove,
drivers/media/i2c/ov2740.c +1 -1
index 39003c1632ad..371f9f394aea 100644
@@ -1470,7 +1470,7 @@ MODULE_DEVICE_TABLE(acpi, ov2740_acpi_ids);
 static struct i2c_driver ov2740_i2c_driver = {
 	.driver = {
 		.name = "ov2740",
-		.acpi_match_table = ov2740_acpi_ids,
+		.acpi_match_table = ACPI_PTR(ov2740_acpi_ids),
 		.pm = pm_sleep_ptr(&ov2740_pm_ops),
 	},
 	.probe = ov2740_probe,
drivers/media/i2c/ov5693.c +1 -1
index 4cc796bbee92..5609c5ba5795 100644
@@ -1409,7 +1409,7 @@ MODULE_DEVICE_TABLE(of, ov5693_of_match);
 static struct i2c_driver ov5693_driver = {
 	.driver = {
 		.name = "ov5693",
-		.acpi_match_table = ov5693_acpi_match,
+		.acpi_match_table = ACPI_PTR(ov5693_acpi_match),
 		.of_match_table = ov5693_of_match,
 		.pm = &ov5693_pm_ops,
 	},
drivers/media/i2c/ov7251.c +1 -1
index 27afc3fc0175..ddd2c91ec057 100644
@@ -1809,7 +1809,7 @@ MODULE_DEVICE_TABLE(acpi, ov7251_acpi_match);
 static struct i2c_driver ov7251_i2c_driver = {
 	.driver = {
 		.of_match_table = ov7251_of_match,
-		.acpi_match_table = ov7251_acpi_match,
+		.acpi_match_table = ACPI_PTR(ov7251_acpi_match),
 		.name  = "ov7251",
 		.pm = &ov7251_pm_ops,
 	},
drivers/media/i2c/ov8865.c +1 -1
index c6d53c3d55ca..b676db6b2a08 100644
@@ -3144,7 +3144,7 @@ static struct i2c_driver ov8865_driver = {
 	.driver = {
 		.name = "ov8865",
 		.of_match_table = ov8865_of_match,
-		.acpi_match_table = ov8865_acpi_match,
+		.acpi_match_table = ACPI_PTR(ov8865_acpi_match),
 		.pm = &ov8865_pm_ops,
 	},
 	.probe = ov8865_probe,
drivers/media/i2c/ov9734.c +1 -1
index 0eaf33807fc9..b37ca79ceaad 100644
@@ -980,7 +980,7 @@ MODULE_DEVICE_TABLE(acpi, ov9734_acpi_ids);
 static struct i2c_driver ov9734_i2c_driver = {
 	.driver = {
 		.name = "ov9734",
-		.acpi_match_table = ov9734_acpi_ids,
+		.acpi_match_table = ACPI_PTR(ov9734_acpi_ids),
 	},
 	.probe = ov9734_probe,
 	.remove = ov9734_remove,
Signature · 1 line
2.47.3
#9 lore raw

Re: [PATCH 3/3] media: i2c: Use ACPI_PTR() for ACPI ID tables

Quoted 7 lines · Sakari Ailus

Add ACPI_PTR() to the ACPI ID tables where missing. The patch has been produced with the following command:

git grep -lP 'acpi_match_table.*=\s*(?!ACPI_PTR)' \
	drivers/media/|while read i; do
	perl -i -pe 's/\.acpi_match_table\s*=\s*\K(\w+),/ACPI_PTR($1),/' $i;

done

NAK.

It doesn't explain why we need that. This also inconsistent with OF type of IDs.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
author maintainer
#10 lore raw

Re: [PATCH 3/3] media: i2c: Use ACPI_PTR() for ACPI ID tables

Hi Andy,

Quoted 9 lines · Andy Shevchenko
Quoted 7 lines · Sakari Ailus

Add ACPI_PTR() to the ACPI ID tables where missing. The patch has been produced with the following command:

git grep -lP 'acpi_match_table.*=\s*(?!ACPI_PTR)' \
	drivers/media/|while read i; do
	perl -i -pe 's/\.acpi_match_table\s*=\s*\K(\w+),/ACPI_PTR($1),/' $i;

done

Quoted 4 lines

NAK.

It doesn't explain why we need that. This also inconsistent with OF type of IDs.

ACPI IDs are used on ACPI only while compatible strings are used on both ACPI and OF. Thus the ACPI ID table is redundant if CONFIG_ACPI is disabled.

Signature · 1 line
Sakari Ailus
#11 lore raw

Re: [PATCH 3/3] media: i2c: Use ACPI_PTR() for ACPI ID tables

Quoted 10 lines · Sakari Ailus
Quoted 9 lines · Andy Shevchenko
Quoted 7 lines · Sakari Ailus

Add ACPI_PTR() to the ACPI ID tables where missing. The patch has been produced with the following command:

git grep -lP 'acpi_match_table.*=\s*(?!ACPI_PTR)' \
	drivers/media/|while read i; do
	perl -i -pe 's/\.acpi_match_table\s*=\s*\K(\w+),/ACPI_PTR($1),/' $i;

done

Quoted 8 lines
Quoted 4 lines

NAK.

It doesn't explain why we need that. This also inconsistent with OF type of IDs.

ACPI IDs are used on ACPI only while compatible strings are used on both ACPI and OF. Thus the ACPI ID table is redundant if CONFIG_ACPI is disabled.

They may be informative for the cases when on the working say OF system I can get the IDs for ACPI based platforms at run-time.

Also you just save a couple of dozens of bytes. This is peanuts and unneeded churn. Again, here is my formal

In case you want to override that, please keep it in the commit message (among other tags). And yes, we have such a tag in the Git history of Linux kernel.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
author maintainer
#12 lore raw

Re: [PATCH 3/3] media: i2c: Use ACPI_PTR() for ACPI ID tables

Quoted 16 lines · Andy Shevchenko
Quoted 15 lines · Sakari Ailus
Quoted 13 lines · Andy Shevchenko
Quoted 7 lines · Sakari Ailus

Add ACPI_PTR() to the ACPI ID tables where missing. The patch has been produced with the following command:

git grep -lP 'acpi_match_table.*=\s*(?!ACPI_PTR)' \
	drivers/media/|while read i; do
	perl -i -pe 's/\.acpi_match_table\s*=\s*\K(\w+),/ACPI_PTR($1),/' $i;

done

NAK.

It doesn't explain why we need that. This also inconsistent with OF type of IDs.

Quoted 6 lines
Quoted 3 lines

ACPI IDs are used on ACPI only while compatible strings are used on both ACPI and OF. Thus the ACPI ID table is redundant if CONFIG_ACPI is disabled.

They may be informative for the cases when on the working say OF system I can get the IDs for ACPI based platforms at run-time.

That's a bit far-fetched I think. Have you ever done that? :-)

Media drivers are probably one of the largest groups of drivers that are as relevant for ACPI as they are for OF.

The of_match_ptr() that used to be present in nearly all media drivers has been largely eliminated in the same context and the only reason for that is that the table is also relevant for ACPI systems. The case is indeed the opposite to the ACPI equivalent so I really don't see why we shouldn't just drop it where it's, well, redundant.

Quoted 3 lines

Also you just save a couple of dozens of bytes. This is peanuts and unneeded churn. Again, here is my formal

I recall you often comment on struct field ordering to save, well, typically less than dozens of bytes, too.

Quoted 5 lines

In case you want to override that, please keep it in the commit message (among other tags). And yes, we have such a tag in the Git history of Linux kernel.

Signature · 1 line
Sakari Ailus
#13 lore raw

Re: [PATCH 3/3] media: i2c: Use ACPI_PTR() for ACPI ID tables

Quoted 17 lines · Sakari Ailus
Quoted 16 lines · Andy Shevchenko
Quoted 15 lines · Sakari Ailus
Quoted 13 lines · Andy Shevchenko
Quoted 7 lines · Sakari Ailus

Add ACPI_PTR() to the ACPI ID tables where missing. The patch has been produced with the following command:

git grep -lP 'acpi_match_table.*=\s*(?!ACPI_PTR)' \
	drivers/media/|while read i; do
	perl -i -pe 's/\.acpi_match_table\s*=\s*\K(\w+),/ACPI_PTR($1),/' $i;

done

NAK.

It doesn't explain why we need that. This also inconsistent with OF type of IDs.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

ACPI IDs are used on ACPI only while compatible strings are used on both ACPI and OF. Thus the ACPI ID table is redundant if CONFIG_ACPI is disabled.

They may be informative for the cases when on the working say OF system I can get the IDs for ACPI based platforms at run-time.

That's a bit far-fetched I think. Have you ever done that? :-)

I have not working with OF platforms, but I'm pretty much see value of this possibility.

Quoted 6 lines

Media drivers are probably one of the largest groups of drivers that are as relevant for ACPI as they are for OF.

The of_match_ptr() that used to be present in nearly all media drivers has been largely eliminated in the same context and the only reason for that is that the table is also relevant for ACPI systems.

So, if we ever will have a code to use ACPI IDs in OF enumeration, this will have the same argument.

Quoted 3 lines

The case is indeed the
opposite to the ACPI equivalent so I really don't see why we shouldn't just drop it where it's, well, redundant.

The use of the unneeded macro makes code harder to follow. Still ID tables are useful on their own.

Quoted 5 lines
Quoted 2 lines

Also you just save a couple of dozens of bytes. This is peanuts and unneeded churn. Again, here is my formal

I recall you often comment on struct field ordering to save, well, typically less than dozens of bytes, too.

There is a difference, the ID tables are from RO sections, the structures are runtime and grow linearly as many objects of a type are created. Among two the priority of reducing runtime memory footprint has a priority over the RO sections.

Quoted 1 line
Quoted 1 line

The tag still stays. But nobody prevents media maintainers to do what they want :-)

Quoted 2 lines
Quoted 2 lines

In case you want to override that, please keep it in the commit message (among other tags). And yes, we have such a tag in the Git history of Linux kernel.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
author maintainer
#14 lore raw

Re: [PATCH 3/3] media: i2c: Use ACPI_PTR() for ACPI ID tables

Quoted 40 lines · Andy Shevchenko
Quoted 17 lines · Sakari Ailus
Quoted 16 lines · Andy Shevchenko
Quoted 15 lines · Sakari Ailus
Quoted 13 lines · Andy Shevchenko
Quoted 7 lines · Sakari Ailus

Add ACPI_PTR() to the ACPI ID tables where missing. The patch has been produced with the following command:

git grep -lP 'acpi_match_table.*=\s*(?!ACPI_PTR)' \
	drivers/media/|while read i; do
	perl -i -pe 's/\.acpi_match_table\s*=\s*\K(\w+),/ACPI_PTR($1),/' $i;

done

NAK.

It doesn't explain why we need that. This also inconsistent with OF type of IDs.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

ACPI IDs are used on ACPI only while compatible strings are used on both ACPI and OF. Thus the ACPI ID table is redundant if CONFIG_ACPI is disabled.

They may be informative for the cases when on the working say OF system I can get the IDs for ACPI based platforms at run-time.

That's a bit far-fetched I think. Have you ever done that? :-)

I have not working with OF platforms, but I'm pretty much see value of this possibility.

Quoted 6 lines

Media drivers are probably one of the largest groups of drivers that are as relevant for ACPI as they are for OF.

The of_match_ptr() that used to be present in nearly all media drivers has been largely eliminated in the same context and the only reason for that is that the table is also relevant for ACPI systems.

So, if we ever will have a code to use ACPI IDs in OF enumeration, this will have the same argument.

Quoted 6 lines
Quoted 3 lines

The case is indeed the
opposite to the ACPI equivalent so I really don't see why we shouldn't just drop it where it's, well, redundant.

The use of the unneeded macro makes code harder to follow. Still ID tables are useful on their own.

About 20 drivers currently in Media tree use this "unneeded" macro in this context. (These either have #ifdefs, __maybe_unused or depend on ACPI directly, and the two first then can be removed after the two first patches in the series.)

The rest of the reasoning you provided above is rather improbable IMHO.

Quoted 11 lines
Quoted 6 lines
Quoted 3 lines

Also you just save a couple of dozens of bytes. This is peanuts and unneeded churn. Again, here is my formal

I recall you often comment on struct field ordering to save, well, typically less than dozens of bytes, too.

There is a difference, the ID tables are from RO sections, the structures are runtime and grow linearly as many objects of a type are created. Among two the priority of reducing runtime memory footprint has a priority over the RO sections.

These are often device specific and typically, albeit not always, there's one device (especially camera sensors etc.) of a kind in a system.

Quoted 5 lines
Quoted 2 lines
Quoted 2 lines

The tag still stays. But nobody prevents media maintainers to do what they want :-)

Kernel documentation appears not to recognise such a tag. This can always be found in lore though.

Quoted 4 lines
Quoted 3 lines
Quoted 3 lines

In case you want to override that, please keep it in the commit message (among other tags). And yes, we have such a tag in the Git history of Linux kernel.

Signature · 3 lines
Regards,

Sakari Ailus