LKML Archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/5] media: Fix compilations with !ACPI !PM and !OF
@ 2024-05-01 13:08 Ricardo Ribalda
  2024-05-01 13:08 ` [PATCH v2 1/5] media: bcm2835-unicam: Fix build with !PM Ricardo Ribalda
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Ricardo Ribalda @ 2024-05-01 13:08 UTC (permalink / raw
  To: Mauro Carvalho Chehab, Florian Fainelli, Ray Jui, Scott Branden,
	Broadcom internal kernel review list, Sakari Ailus, Bingbu Cao,
	Tianshu Qiu
  Cc: linux-media, linux-rpi-kernel, linux-arm-kernel, linux-kernel,
	Hans Verkuil, Ricardo Ribalda, Laurent Pinchart,
	kernel test robot

The current media-stating has some errors when configurations are
missing. Fix that.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
Changes in v2:
- Remove missing __maybe_unused (Thanks Hidenori)
- Include https://patchwork.linuxtv.org/project/linux-media/patch/20240430213633.23767-2-laurent.pinchart@ideasonboard.com/
- Link to v1: https://lore.kernel.org/r/20240430-fix-ipu6-v1-0-9b31fbbce6e4@chromium.org

---
Laurent Pinchart (1):
      media: bcm2835-unicam: Include v4l2-subdev.h

Ricardo Ribalda (4):
      media: bcm2835-unicam: Fix build with !PM
      media: intel/ipu6: Switch to RUNTIME_PM_OPS() and SYSTEM_SLEEP_PM_OPS
      media: intel/ipu6: Fix direct dependency Kconfig error
      media: intel/ipu6: Fix build with !ACPI

 drivers/media/pci/intel/Kconfig                  |  3 +-
 drivers/media/pci/intel/ipu-bridge.c             | 66 +++++++++++++++++-------
 drivers/media/pci/intel/ipu6/ipu6.c              |  4 +-
 drivers/media/platform/broadcom/bcm2835-unicam.c |  3 +-
 4 files changed, 53 insertions(+), 23 deletions(-)
---
base-commit: a1c6d22421501fc1016b99ac8570a1030714c70f
change-id: 20240430-fix-ipu6-84d4d5515452

Best regards,
-- 
Ricardo Ribalda <ribalda@chromium.org>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 1/5] media: bcm2835-unicam: Fix build with !PM
  2024-05-01 13:08 [PATCH v2 0/5] media: Fix compilations with !ACPI !PM and !OF Ricardo Ribalda
@ 2024-05-01 13:08 ` Ricardo Ribalda
  2024-05-02 10:11   ` Mauro Carvalho Chehab
  2024-05-01 13:08 ` [PATCH v2 2/5] media: bcm2835-unicam: Include v4l2-subdev.h Ricardo Ribalda
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 8+ messages in thread
From: Ricardo Ribalda @ 2024-05-01 13:08 UTC (permalink / raw
  To: Mauro Carvalho Chehab, Florian Fainelli, Ray Jui, Scott Branden,
	Broadcom internal kernel review list, Sakari Ailus, Bingbu Cao,
	Tianshu Qiu
  Cc: linux-media, linux-rpi-kernel, linux-arm-kernel, linux-kernel,
	Hans Verkuil, Ricardo Ribalda

The driver can only match the device vide the DT table, so the table
should always be used, of_match_ptr does not make sense here.

Fixes:
drivers/media/platform/broadcom/bcm2835-unicam.c:2724:34: warning: ‘unicam_of_match’ defined but not used [-Wunused-const-variable=]

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
 drivers/media/platform/broadcom/bcm2835-unicam.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/broadcom/bcm2835-unicam.c b/drivers/media/platform/broadcom/bcm2835-unicam.c
index bd2bbb53070e..c590e26fe2cf 100644
--- a/drivers/media/platform/broadcom/bcm2835-unicam.c
+++ b/drivers/media/platform/broadcom/bcm2835-unicam.c
@@ -2733,7 +2733,7 @@ static struct platform_driver unicam_driver = {
 	.driver = {
 		.name	= UNICAM_MODULE_NAME,
 		.pm	= pm_ptr(&unicam_pm_ops),
-		.of_match_table = of_match_ptr(unicam_of_match),
+		.of_match_table = unicam_of_match,
 	},
 };
 

-- 
2.45.0.rc0.197.gbae5840b3b-goog


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 2/5] media: bcm2835-unicam: Include v4l2-subdev.h
  2024-05-01 13:08 [PATCH v2 0/5] media: Fix compilations with !ACPI !PM and !OF Ricardo Ribalda
  2024-05-01 13:08 ` [PATCH v2 1/5] media: bcm2835-unicam: Fix build with !PM Ricardo Ribalda
@ 2024-05-01 13:08 ` Ricardo Ribalda
  2024-05-01 13:08 ` [PATCH v2 3/5] media: intel/ipu6: Switch to RUNTIME_PM_OPS() and SYSTEM_SLEEP_PM_OPS Ricardo Ribalda
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Ricardo Ribalda @ 2024-05-01 13:08 UTC (permalink / raw
  To: Mauro Carvalho Chehab, Florian Fainelli, Ray Jui, Scott Branden,
	Broadcom internal kernel review list, Sakari Ailus, Bingbu Cao,
	Tianshu Qiu
  Cc: linux-media, linux-rpi-kernel, linux-arm-kernel, linux-kernel,
	Hans Verkuil, Ricardo Ribalda, Laurent Pinchart,
	kernel test robot

From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

The unicam driver uses the v4l2_subdev structure. Include the
corresponding header instead of relying on indirect includes.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202404302324.8aTC84kE-lkp@intel.com/
Reviewed-by: Ricardo Ribalda <ribalda@chromium.org>
---
 drivers/media/platform/broadcom/bcm2835-unicam.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/platform/broadcom/bcm2835-unicam.c b/drivers/media/platform/broadcom/bcm2835-unicam.c
index c590e26fe2cf..3c7878d8d79b 100644
--- a/drivers/media/platform/broadcom/bcm2835-unicam.c
+++ b/drivers/media/platform/broadcom/bcm2835-unicam.c
@@ -55,6 +55,7 @@
 #include <media/v4l2-ioctl.h>
 #include <media/v4l2-fwnode.h>
 #include <media/v4l2-mc.h>
+#include <media/v4l2-subdev.h>
 #include <media/videobuf2-dma-contig.h>
 
 #include "bcm2835-unicam-regs.h"

-- 
2.45.0.rc0.197.gbae5840b3b-goog


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 3/5] media: intel/ipu6: Switch to RUNTIME_PM_OPS() and SYSTEM_SLEEP_PM_OPS
  2024-05-01 13:08 [PATCH v2 0/5] media: Fix compilations with !ACPI !PM and !OF Ricardo Ribalda
  2024-05-01 13:08 ` [PATCH v2 1/5] media: bcm2835-unicam: Fix build with !PM Ricardo Ribalda
  2024-05-01 13:08 ` [PATCH v2 2/5] media: bcm2835-unicam: Include v4l2-subdev.h Ricardo Ribalda
@ 2024-05-01 13:08 ` Ricardo Ribalda
  2024-05-01 13:08 ` [PATCH v2 4/5] media: intel/ipu6: Fix direct dependency Kconfig error Ricardo Ribalda
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Ricardo Ribalda @ 2024-05-01 13:08 UTC (permalink / raw
  To: Mauro Carvalho Chehab, Florian Fainelli, Ray Jui, Scott Branden,
	Broadcom internal kernel review list, Sakari Ailus, Bingbu Cao,
	Tianshu Qiu
  Cc: linux-media, linux-rpi-kernel, linux-arm-kernel, linux-kernel,
	Hans Verkuil, Ricardo Ribalda

Replace the old helpers with its modern alternative.
Now we do not need to set '__maybe_unused' annotations when we are not
enabling the PM configurations.

Fixes:
drivers/media/pci/intel/ipu6/ipu6.c:841:12: warning: ‘ipu6_runtime_resume’ defined but not used [-Wunused-function]
drivers/media/pci/intel/ipu6/ipu6.c:806:12: warning: ‘ipu6_resume’ defined but not used [-Wunused-function]
drivers/media/pci/intel/ipu6/ipu6.c:801:12: warning: ‘ipu6_suspend’ defined but not used [-Wunused-function]

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
 drivers/media/pci/intel/ipu6/ipu6.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/pci/intel/ipu6/ipu6.c b/drivers/media/pci/intel/ipu6/ipu6.c
index 4b1f69d14d71..7bcd9c5a381a 100644
--- a/drivers/media/pci/intel/ipu6/ipu6.c
+++ b/drivers/media/pci/intel/ipu6/ipu6.c
@@ -860,8 +860,8 @@ static int ipu6_runtime_resume(struct device *dev)
 }
 
 static const struct dev_pm_ops ipu6_pm_ops = {
-	SET_SYSTEM_SLEEP_PM_OPS(&ipu6_suspend, &ipu6_resume)
-	SET_RUNTIME_PM_OPS(&ipu6_suspend, &ipu6_runtime_resume, NULL)
+	SYSTEM_SLEEP_PM_OPS(&ipu6_suspend, &ipu6_resume)
+	RUNTIME_PM_OPS(&ipu6_suspend, &ipu6_runtime_resume, NULL)
 };
 
 MODULE_DEVICE_TABLE(pci, ipu6_pci_tbl);

-- 
2.45.0.rc0.197.gbae5840b3b-goog


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 4/5] media: intel/ipu6: Fix direct dependency Kconfig error
  2024-05-01 13:08 [PATCH v2 0/5] media: Fix compilations with !ACPI !PM and !OF Ricardo Ribalda
                   ` (2 preceding siblings ...)
  2024-05-01 13:08 ` [PATCH v2 3/5] media: intel/ipu6: Switch to RUNTIME_PM_OPS() and SYSTEM_SLEEP_PM_OPS Ricardo Ribalda
@ 2024-05-01 13:08 ` Ricardo Ribalda
  2024-05-01 13:08 ` [PATCH v2 5/5] media: intel/ipu6: Fix build with !ACPI Ricardo Ribalda
  2024-05-02  8:26 ` [PATCH v2 0/5] media: Fix compilations with !ACPI !PM and !OF Sakari Ailus
  5 siblings, 0 replies; 8+ messages in thread
From: Ricardo Ribalda @ 2024-05-01 13:08 UTC (permalink / raw
  To: Mauro Carvalho Chehab, Florian Fainelli, Ray Jui, Scott Branden,
	Broadcom internal kernel review list, Sakari Ailus, Bingbu Cao,
	Tianshu Qiu
  Cc: linux-media, linux-rpi-kernel, linux-arm-kernel, linux-kernel,
	Hans Verkuil, Ricardo Ribalda

VIDEO_INTEL_IPU6 selects IPU6_BRIDGE, but they have different set of
dependencies.

Fixes:
WARNING: unmet direct dependencies detected for IPU_BRIDGE
  Depends on [n]: MEDIA_SUPPORT [=y] && PCI [=y] && MEDIA_PCI_SUPPORT [=y] && I2C [=y] && ACPI [=n]
  Selected by [y]:
  - VIDEO_INTEL_IPU6 [=y] && MEDIA_SUPPORT [=y] && PCI [=y] && MEDIA_PCI_SUPPORT [=y] && (ACPI [=n] || COMPILE_TEST [=y]) && VIDEO_DEV [=y] && X86 [=y] && X86_64 [=y] && HAS_DMA [=y]

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
 drivers/media/pci/intel/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/pci/intel/Kconfig b/drivers/media/pci/intel/Kconfig
index 04cb3d253486..d9fcddce028b 100644
--- a/drivers/media/pci/intel/Kconfig
+++ b/drivers/media/pci/intel/Kconfig
@@ -6,7 +6,8 @@ source "drivers/media/pci/intel/ivsc/Kconfig"
 
 config IPU_BRIDGE
 	tristate "Intel IPU Bridge"
-	depends on I2C && ACPI
+	depends on ACPI || COMPILE_TEST
+	depends on I2C
 	help
 	  The IPU bridge is a helper library for Intel IPU drivers to
 	  function on systems shipped with Windows.

-- 
2.45.0.rc0.197.gbae5840b3b-goog


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 5/5] media: intel/ipu6: Fix build with !ACPI
  2024-05-01 13:08 [PATCH v2 0/5] media: Fix compilations with !ACPI !PM and !OF Ricardo Ribalda
                   ` (3 preceding siblings ...)
  2024-05-01 13:08 ` [PATCH v2 4/5] media: intel/ipu6: Fix direct dependency Kconfig error Ricardo Ribalda
@ 2024-05-01 13:08 ` Ricardo Ribalda
  2024-05-02  8:26 ` [PATCH v2 0/5] media: Fix compilations with !ACPI !PM and !OF Sakari Ailus
  5 siblings, 0 replies; 8+ messages in thread
From: Ricardo Ribalda @ 2024-05-01 13:08 UTC (permalink / raw
  To: Mauro Carvalho Chehab, Florian Fainelli, Ray Jui, Scott Branden,
	Broadcom internal kernel review list, Sakari Ailus, Bingbu Cao,
	Tianshu Qiu
  Cc: linux-media, linux-rpi-kernel, linux-arm-kernel, linux-kernel,
	Hans Verkuil, Ricardo Ribalda

Modify the code so it can be compiled tested in configurations that do
not have ACPI enabled.

Fixes:
drivers/media/pci/intel/ipu-bridge.c:103:30: error: implicit declaration of function ‘acpi_device_handle’; did you mean ‘acpi_fwnode_handle’? [-Werror=implicit-function-declaration]
drivers/media/pci/intel/ipu-bridge.c:103:30: warning: initialization of ‘acpi_handle’ {aka ‘void *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
drivers/media/pci/intel/ipu-bridge.c:110:17: error: implicit declaration of function ‘for_each_acpi_dev_match’ [-Werror=implicit-function-declaration]
drivers/media/pci/intel/ipu-bridge.c:110:74: error: expected ‘;’ before ‘for_each_acpi_consumer_dev’
drivers/media/pci/intel/ipu-bridge.c:104:29: warning: unused variable ‘consumer’ [-Wunused-variable]
drivers/media/pci/intel/ipu-bridge.c:103:21: warning: unused variable ‘handle’ [-Wunused-variable]
drivers/media/pci/intel/ipu-bridge.c:166:38: error: invalid use of undefined type ‘struct acpi_device’
drivers/media/pci/intel/ipu-bridge.c:185:43: error: invalid use of undefined type ‘struct acpi_device’
drivers/media/pci/intel/ipu-bridge.c:191:30: error: invalid use of undefined type ‘struct acpi_device’
drivers/media/pci/intel/ipu-bridge.c:196:30: error: invalid use of undefined type ‘struct acpi_device’
drivers/media/pci/intel/ipu-bridge.c:202:30: error: invalid use of undefined type ‘struct acpi_device’
drivers/media/pci/intel/ipu-bridge.c:223:31: error: invalid use of undefined type ‘struct acpi_device’
drivers/media/pci/intel/ipu-bridge.c:236:18: error: implicit declaration of function ‘acpi_get_physical_device_location’ [-Werror=implicit-function-declaration]
drivers/media/pci/intel/ipu-bridge.c:236:56: error: invalid use of undefined type ‘struct acpi_device’
drivers/media/pci/intel/ipu-bridge.c:238:31: error: invalid use of undefined type ‘struct acpi_device’
drivers/media/pci/intel/ipu-bridge.c:256:31: error: invalid use of undefined type ‘struct acpi_device’
drivers/media/pci/intel/ipu-bridge.c:275:31: error: invalid use of undefined type ‘struct acpi_device’
drivers/media/pci/intel/ipu-bridge.c:280:30: error: invalid use of undefined type ‘struct acpi_device’
drivers/media/pci/intel/ipu-bridge.c:469:26: error: implicit declaration of function ‘acpi_device_hid’; did you mean ‘dmi_device_id’? [-Werror=implicit-function-declaration]
drivers/media/pci/intel/ipu-bridge.c:468:74: warning: format ‘%s’ expects argument of type ‘char *’, but argument 4 has type ‘int’ [-Wformat=]
drivers/media/pci/intel/ipu-bridge.c:637:58: error: expected ‘;’ before ‘{’ token
drivers/media/pci/intel/ipu-bridge.c:696:1: warning: label ‘err_put_adev’ defined but not used [-Wunused-label]
drivers/media/pci/intel/ipu-bridge.c:693:1: warning: label ‘err_put_ivsc’ defined but not used [-Wunused-label]
drivers/media/pci/intel/ipu-bridge.c:691:1: warning: label ‘err_free_swnodes’ defined but not used [-Wunused-label]
drivers/media/pci/intel/ipu-bridge.c:632:40: warning: unused variable ‘primary’ [-Wunused-variable]
drivers/media/pci/intel/ipu-bridge.c:632:31: warning: unused variable ‘fwnode’ [-Wunused-variable]
drivers/media/pci/intel/ipu-bridge.c:733:73: error: expected ‘;’ before ‘{’ token
drivers/media/pci/intel/ipu-bridge.c:725:24: warning: unused variable ‘csi_dev’ [-Wunused-variable]
drivers/media/pci/intel/ipu-bridge.c:724:43: warning: unused variable ‘adev’ [-Wunused-variable]
drivers/media/pci/intel/ipu-bridge.c:599:12: warning: ‘ipu_bridge_instantiate_ivsc’ defined but not used [-Wunused-function]
drivers/media/pci/intel/ipu-bridge.c:444:13: warning: ‘ipu_bridge_create_connection_swnodes’ defined but not used [-Wunused-function]
drivers/media/pci/intel/ipu-bridge.c:297:13: warning: ‘ipu_bridge_create_fwnode_properties’ defined but not used [-Wunused-function]
drivers/media/pci/intel/ipu-bridge.c:155:12: warning: ‘ipu_bridge_check_ivsc_dev’ defined but not used [-Wunused-function]

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
 drivers/media/pci/intel/ipu-bridge.c | 66 +++++++++++++++++++++++++-----------
 1 file changed, 47 insertions(+), 19 deletions(-)

diff --git a/drivers/media/pci/intel/ipu-bridge.c b/drivers/media/pci/intel/ipu-bridge.c
index e994db4f4d91..61750cc98d70 100644
--- a/drivers/media/pci/intel/ipu-bridge.c
+++ b/drivers/media/pci/intel/ipu-bridge.c
@@ -15,6 +15,8 @@
 #include <media/ipu-bridge.h>
 #include <media/v4l2-fwnode.h>
 
+#define ADEV_DEV(adev) ACPI_PTR(&((adev)->dev))
+
 /*
  * 92335fcf-3203-4472-af93-7b4453ac29da
  *
@@ -87,6 +89,7 @@ static const char * const ipu_vcm_types[] = {
 	"lc898212axb",
 };
 
+#if IS_ENABLED(CONFIG_ACPI)
 /*
  * Used to figure out IVSC acpi device by ipu_bridge_get_ivsc_acpi_dev()
  * instead of device and driver match to probe IVSC device.
@@ -100,13 +103,13 @@ static const struct acpi_device_id ivsc_acpi_ids[] = {
 
 static struct acpi_device *ipu_bridge_get_ivsc_acpi_dev(struct acpi_device *adev)
 {
-	acpi_handle handle = acpi_device_handle(adev);
-	struct acpi_device *consumer, *ivsc_adev;
 	unsigned int i;
 
 	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(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)
@@ -118,6 +121,12 @@ static struct acpi_device *ipu_bridge_get_ivsc_acpi_dev(struct acpi_device *adev
 
 	return NULL;
 }
+#else
+static struct acpi_device *ipu_bridge_get_ivsc_acpi_dev(struct acpi_device *adev)
+{
+	return NULL;
+}
+#endif
 
 static int ipu_bridge_match_ivsc_dev(struct device *dev, const void *adev)
 {
@@ -163,7 +172,7 @@ static int ipu_bridge_check_ivsc_dev(struct ipu_sensor *sensor,
 		csi_dev = ipu_bridge_get_ivsc_csi_dev(adev);
 		if (!csi_dev) {
 			acpi_dev_put(adev);
-			dev_err(&adev->dev, "Failed to find MEI CSI dev\n");
+			dev_err(ADEV_DEV(adev), "Failed to find MEI CSI dev\n");
 			return -ENODEV;
 		}
 
@@ -182,24 +191,25 @@ static int ipu_bridge_read_acpi_buffer(struct acpi_device *adev, char *id,
 	acpi_status status;
 	int ret = 0;
 
-	status = acpi_evaluate_object(adev->handle, id, NULL, &buffer);
+	status = acpi_evaluate_object(ACPI_PTR(adev->handle),
+				      id, NULL, &buffer);
 	if (ACPI_FAILURE(status))
 		return -ENODEV;
 
 	obj = buffer.pointer;
 	if (!obj) {
-		dev_err(&adev->dev, "Couldn't locate ACPI buffer\n");
+		dev_err(ADEV_DEV(adev), "Couldn't locate ACPI buffer\n");
 		return -ENODEV;
 	}
 
 	if (obj->type != ACPI_TYPE_BUFFER) {
-		dev_err(&adev->dev, "Not an ACPI buffer\n");
+		dev_err(ADEV_DEV(adev), "Not an ACPI buffer\n");
 		ret = -ENODEV;
 		goto out_free_buff;
 	}
 
 	if (obj->buffer.length > size) {
-		dev_err(&adev->dev, "Given buffer is too small\n");
+		dev_err(ADEV_DEV(adev), "Given buffer is too small\n");
 		ret = -EINVAL;
 		goto out_free_buff;
 	}
@@ -220,7 +230,7 @@ static u32 ipu_bridge_parse_rotation(struct acpi_device *adev,
 	case IPU_SENSOR_ROTATION_INVERTED:
 		return 180;
 	default:
-		dev_warn(&adev->dev,
+		dev_warn(ADEV_DEV(adev),
 			 "Unknown rotation %d. Assume 0 degree rotation\n",
 			 ssdb->degree);
 		return 0;
@@ -230,12 +240,14 @@ static u32 ipu_bridge_parse_rotation(struct acpi_device *adev,
 static enum v4l2_fwnode_orientation ipu_bridge_parse_orientation(struct acpi_device *adev)
 {
 	enum v4l2_fwnode_orientation orientation;
-	struct acpi_pld_info *pld;
-	acpi_status status;
+	struct acpi_pld_info *pld = NULL;
+	acpi_status status = AE_ERROR;
 
+#if IS_ENABLED(CONFIG_ACPI)
 	status = acpi_get_physical_device_location(adev->handle, &pld);
+#endif
 	if (ACPI_FAILURE(status)) {
-		dev_warn(&adev->dev, "_PLD call failed, using default orientation\n");
+		dev_warn(ADEV_DEV(adev), "_PLD call failed, using default orientation\n");
 		return V4L2_FWNODE_ORIENTATION_EXTERNAL;
 	}
 
@@ -253,7 +265,8 @@ static enum v4l2_fwnode_orientation ipu_bridge_parse_orientation(struct acpi_dev
 		orientation = V4L2_FWNODE_ORIENTATION_EXTERNAL;
 		break;
 	default:
-		dev_warn(&adev->dev, "Unknown _PLD panel val %d\n", pld->panel);
+		dev_warn(ADEV_DEV(adev), "Unknown _PLD panel val %d\n",
+			 pld->panel);
 		orientation = V4L2_FWNODE_ORIENTATION_EXTERNAL;
 		break;
 	}
@@ -272,12 +285,12 @@ int ipu_bridge_parse_ssdb(struct acpi_device *adev, struct ipu_sensor *sensor)
 		return ret;
 
 	if (ssdb.vcmtype > ARRAY_SIZE(ipu_vcm_types)) {
-		dev_warn(&adev->dev, "Unknown VCM type %d\n", ssdb.vcmtype);
+		dev_warn(ADEV_DEV(adev), "Unknown VCM type %d\n", ssdb.vcmtype);
 		ssdb.vcmtype = 0;
 	}
 
 	if (ssdb.lanes > IPU_MAX_LANES) {
-		dev_err(&adev->dev, "Number of lanes in SSDB is invalid\n");
+		dev_err(ADEV_DEV(adev), "Number of lanes in SSDB is invalid\n");
 		return -EINVAL;
 	}
 
@@ -465,8 +478,14 @@ static void ipu_bridge_create_connection_swnodes(struct ipu_bridge *bridge,
 						sensor->ipu_properties);
 
 	if (sensor->csi_dev) {
+		const char *device_hid = "";
+
+#if IS_ENABLED(CONFIG_ACPI)
+		device_hid = acpi_device_hid(sensor->ivsc_adev);
+#endif
+
 		snprintf(sensor->ivsc_name, sizeof(sensor->ivsc_name), "%s-%u",
-			 acpi_device_hid(sensor->ivsc_adev), sensor->link);
+			 device_hid, sensor->link);
 
 		nodes[SWNODE_IVSC_HID] = NODE_SENSOR(sensor->ivsc_name,
 						     sensor->ivsc_properties);
@@ -631,11 +650,15 @@ static int ipu_bridge_connect_sensor(const struct ipu_sensor_config *cfg,
 {
 	struct fwnode_handle *fwnode, *primary;
 	struct ipu_sensor *sensor;
-	struct acpi_device *adev;
+	struct acpi_device *adev = NULL;
 	int ret;
 
+#if IS_ENABLED(CONFIG_ACPI)
 	for_each_acpi_dev_match(adev, cfg->hid, NULL, -1) {
-		if (!adev->status.enabled)
+#else
+	while (true) {
+#endif
+		if (!ACPI_PTR(adev->status.enabled))
 			continue;
 
 		if (bridge->n_sensors >= IPU_MAX_PORTS) {
@@ -671,7 +694,7 @@ static int ipu_bridge_connect_sensor(const struct ipu_sensor_config *cfg,
 			goto err_free_swnodes;
 		}
 
-		sensor->adev = acpi_dev_get(adev);
+		sensor->adev = ACPI_PTR(acpi_dev_get(adev));
 
 		primary = acpi_fwnode_handle(adev);
 		primary->secondary = fwnode;
@@ -727,11 +750,16 @@ static int ipu_bridge_ivsc_is_ready(void)
 	unsigned int i;
 
 	for (i = 0; i < ARRAY_SIZE(ipu_supported_sensors); i++) {
+#if IS_ENABLED(CONFIG_ACPI)
 		const struct ipu_sensor_config *cfg =
 			&ipu_supported_sensors[i];
 
 		for_each_acpi_dev_match(sensor_adev, cfg->hid, NULL, -1) {
-			if (!sensor_adev->status.enabled)
+#else
+		while (true) {
+			sensor_adev = NULL;
+#endif
+			if (!ACPI_PTR(sensor_adev->status.enabled))
 				continue;
 
 			adev = ipu_bridge_get_ivsc_acpi_dev(sensor_adev);

-- 
2.45.0.rc0.197.gbae5840b3b-goog


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 0/5] media: Fix compilations with !ACPI !PM and !OF
  2024-05-01 13:08 [PATCH v2 0/5] media: Fix compilations with !ACPI !PM and !OF Ricardo Ribalda
                   ` (4 preceding siblings ...)
  2024-05-01 13:08 ` [PATCH v2 5/5] media: intel/ipu6: Fix build with !ACPI Ricardo Ribalda
@ 2024-05-02  8:26 ` Sakari Ailus
  5 siblings, 0 replies; 8+ messages in thread
From: Sakari Ailus @ 2024-05-02  8:26 UTC (permalink / raw
  To: Ricardo Ribalda
  Cc: Mauro Carvalho Chehab, Florian Fainelli, Ray Jui, Scott Branden,
	Broadcom internal kernel review list, Bingbu Cao, Tianshu Qiu,
	linux-media, linux-rpi-kernel, linux-arm-kernel, linux-kernel,
	Hans Verkuil, Laurent Pinchart, kernel test robot

Hi Ricardo,

On Wed, May 01, 2024 at 01:08:08PM +0000, Ricardo Ribalda wrote:
> The current media-stating has some errors when configurations are
> missing. Fix that.
> 
> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
> ---
> Changes in v2:
> - Remove missing __maybe_unused (Thanks Hidenori)
> - Include https://patchwork.linuxtv.org/project/linux-media/patch/20240430213633.23767-2-laurent.pinchart@ideasonboard.com/
> - Link to v1: https://lore.kernel.org/r/20240430-fix-ipu6-v1-0-9b31fbbce6e4@chromium.org

Thanks for these! I'll submit the PR for these probably today, with another
IPU6 fix.

-- 
Kind regards,

Sakari Ailus

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 1/5] media: bcm2835-unicam: Fix build with !PM
  2024-05-01 13:08 ` [PATCH v2 1/5] media: bcm2835-unicam: Fix build with !PM Ricardo Ribalda
@ 2024-05-02 10:11   ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 8+ messages in thread
From: Mauro Carvalho Chehab @ 2024-05-02 10:11 UTC (permalink / raw
  To: Ricardo Ribalda
  Cc: Florian Fainelli, Ray Jui, Scott Branden,
	Broadcom internal kernel review list, Sakari Ailus, Bingbu Cao,
	Tianshu Qiu, linux-media, linux-rpi-kernel, linux-arm-kernel,
	linux-kernel, Hans Verkuil

Em Wed, 01 May 2024 13:08:09 +0000
Ricardo Ribalda <ribalda@chromium.org> escreveu:

> The driver can only match the device vide the DT table, so the table
> should always be used, of_match_ptr does not make sense here.
> 
> Fixes:
> drivers/media/platform/broadcom/bcm2835-unicam.c:2724:34: warning: ‘unicam_of_match’ defined but not used [-Wunused-const-variable=]

Be careful here: Fixes: <patch> is a tag used by stable people to
identify if a patch needs to be backported. Using a Fixes: may cause
such scripts to break.

(it caused a problem on my apply patch script, as it does reorder
fixes tag).

No need to resend it, as I can fix it when applying, but next time
please use something like:

	It fixes this warning:
	drivers/media/platform/broadcom/bcm2835-unicam.c:2724:34: warning: ‘unicam_of_match’ defined but not used [-Wunused-const-variable=]

(or some other similar word that won't be using a defined meta tag
with a different meaning).

Regards,
Mauro

> 
> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
> ---
>  drivers/media/platform/broadcom/bcm2835-unicam.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/broadcom/bcm2835-unicam.c b/drivers/media/platform/broadcom/bcm2835-unicam.c
> index bd2bbb53070e..c590e26fe2cf 100644
> --- a/drivers/media/platform/broadcom/bcm2835-unicam.c
> +++ b/drivers/media/platform/broadcom/bcm2835-unicam.c
> @@ -2733,7 +2733,7 @@ static struct platform_driver unicam_driver = {
>  	.driver = {
>  		.name	= UNICAM_MODULE_NAME,
>  		.pm	= pm_ptr(&unicam_pm_ops),
> -		.of_match_table = of_match_ptr(unicam_of_match),
> +		.of_match_table = unicam_of_match,
>  	},
>  };
>  
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-05-02 10:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-01 13:08 [PATCH v2 0/5] media: Fix compilations with !ACPI !PM and !OF Ricardo Ribalda
2024-05-01 13:08 ` [PATCH v2 1/5] media: bcm2835-unicam: Fix build with !PM Ricardo Ribalda
2024-05-02 10:11   ` Mauro Carvalho Chehab
2024-05-01 13:08 ` [PATCH v2 2/5] media: bcm2835-unicam: Include v4l2-subdev.h Ricardo Ribalda
2024-05-01 13:08 ` [PATCH v2 3/5] media: intel/ipu6: Switch to RUNTIME_PM_OPS() and SYSTEM_SLEEP_PM_OPS Ricardo Ribalda
2024-05-01 13:08 ` [PATCH v2 4/5] media: intel/ipu6: Fix direct dependency Kconfig error Ricardo Ribalda
2024-05-01 13:08 ` [PATCH v2 5/5] media: intel/ipu6: Fix build with !ACPI Ricardo Ribalda
2024-05-02  8:26 ` [PATCH v2 0/5] media: Fix compilations with !ACPI !PM and !OF Sakari Ailus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).