Skip to content

Commit 84524b1

Browse files
ribaldarafaeljw
authored andcommitted
media: ipu-bridge: Remove unneeded conditional compilations
The ACPI headers have introduced implementations for some of their functions when the kernel is not configured with ACPI. Let's use them instead of our conditional compilation. It is easier to maintain and less prone to errors. Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Acked-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org> Link: https://patch.msgid.link/20241216-fix-ipu-v5-7-3d6b35ddce7b@chromium.org Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 78c3227 commit 84524b1

File tree

1 file changed

+4
-25
lines changed

1 file changed

+4
-25
lines changed

drivers/media/pci/intel/ipu-bridge.c

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
/* Author: Dan Scally <djrscally@gmail.com> */
33

44
#include <linux/acpi.h>
5+
#include <acpi/acpi_bus.h>
56
#include <linux/cleanup.h>
67
#include <linux/device.h>
78
#include <linux/i2c.h>
@@ -107,7 +108,6 @@ static const char * const ipu_vcm_types[] = {
107108
"lc898212axb",
108109
};
109110

110-
#if IS_ENABLED(CONFIG_ACPI)
111111
/*
112112
* Used to figure out IVSC acpi device by ipu_bridge_get_ivsc_acpi_dev()
113113
* instead of device and driver match to probe IVSC device.
@@ -127,24 +127,18 @@ static struct acpi_device *ipu_bridge_get_ivsc_acpi_dev(struct acpi_device *adev
127127
const struct acpi_device_id *acpi_id = &ivsc_acpi_ids[i];
128128
struct acpi_device *consumer, *ivsc_adev;
129129

130-
acpi_handle handle = acpi_device_handle(adev);
130+
acpi_handle handle = acpi_device_handle(ACPI_PTR(adev));
131131
for_each_acpi_dev_match(ivsc_adev, acpi_id->id, NULL, -1)
132132
/* camera sensor depends on IVSC in DSDT if exist */
133133
for_each_acpi_consumer_dev(ivsc_adev, consumer)
134-
if (consumer->handle == handle) {
134+
if (ACPI_PTR(consumer->handle) == handle) {
135135
acpi_dev_put(consumer);
136136
return ivsc_adev;
137137
}
138138
}
139139

140140
return NULL;
141141
}
142-
#else
143-
static struct acpi_device *ipu_bridge_get_ivsc_acpi_dev(struct acpi_device *adev)
144-
{
145-
return NULL;
146-
}
147-
#endif
148142

149143
static int ipu_bridge_match_ivsc_dev(struct device *dev, const void *adev)
150144
{
@@ -259,12 +253,8 @@ static enum v4l2_fwnode_orientation ipu_bridge_parse_orientation(struct acpi_dev
259253
{
260254
enum v4l2_fwnode_orientation orientation;
261255
struct acpi_pld_info *pld = NULL;
262-
bool status = false;
263256

264-
#if IS_ENABLED(CONFIG_ACPI)
265-
status = acpi_get_physical_device_location(adev->handle, &pld);
266-
#endif
267-
if (!status) {
257+
if (!acpi_get_physical_device_location(ACPI_PTR(adev->handle), &pld)) {
268258
dev_warn(ADEV_DEV(adev), "_PLD call failed, using default orientation\n");
269259
return V4L2_FWNODE_ORIENTATION_EXTERNAL;
270260
}
@@ -498,9 +488,7 @@ static void ipu_bridge_create_connection_swnodes(struct ipu_bridge *bridge,
498488
if (sensor->csi_dev) {
499489
const char *device_hid = "";
500490

501-
#if IS_ENABLED(CONFIG_ACPI)
502491
device_hid = acpi_device_hid(sensor->ivsc_adev);
503-
#endif
504492

505493
snprintf(sensor->ivsc_name, sizeof(sensor->ivsc_name), "%s-%u",
506494
device_hid, sensor->link);
@@ -671,11 +659,7 @@ static int ipu_bridge_connect_sensor(const struct ipu_sensor_config *cfg,
671659
struct acpi_device *adev = NULL;
672660
int ret;
673661

674-
#if IS_ENABLED(CONFIG_ACPI)
675662
for_each_acpi_dev_match(adev, cfg->hid, NULL, -1) {
676-
#else
677-
while (true) {
678-
#endif
679663
if (!ACPI_PTR(adev->status.enabled))
680664
continue;
681665

@@ -768,15 +752,10 @@ static int ipu_bridge_ivsc_is_ready(void)
768752
unsigned int i;
769753

770754
for (i = 0; i < ARRAY_SIZE(ipu_supported_sensors); i++) {
771-
#if IS_ENABLED(CONFIG_ACPI)
772755
const struct ipu_sensor_config *cfg =
773756
&ipu_supported_sensors[i];
774757

775758
for_each_acpi_dev_match(sensor_adev, cfg->hid, NULL, -1) {
776-
#else
777-
while (true) {
778-
sensor_adev = NULL;
779-
#endif
780759
if (!ACPI_PTR(sensor_adev->status.enabled))
781760
continue;
782761

0 commit comments

Comments
 (0)