From nobody Fri Dec 19 03:03:12 2025 Received: from mail-ot1-f48.google.com (mail-ot1-f48.google.com [209.85.210.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 69FF2172767 for ; Tue, 30 Apr 2024 12:55:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714481754; cv=none; b=eUK5xM+qdJrxmNYn3xo/0MBPCml8hHoTEhV2Om/t6sAegN2gGX1pyW2X89GGKwu6pj24YKf/lbsArJtyvKR5vHkTZrrn7IhO199zuVmDp2ls589xezKuBePDKL9YlQLfUrI50R3Dmhoj88vMJxv6JNPKdcY8R2Oauz5z7FfZvsg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714481754; c=relaxed/simple; bh=Im0i0nSeZTVU1ukqye2O2p/hIKmI9wUUQGfLF9dIgdI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mo5c/fYpFSwaK1h4H/MygsN+YwVctIYnSlTaag5Ks215IT0bpEAh4EoCCa2vHXyh4hGAwdI+3IjeWnMoR0RFfO2OrV/bjYr1o629vIxPEeCDxLAgSE9BerHEqgRsUU4tTH8KQ9nZg7J2lgZrYuZlHXBM1Mzn703dBaYdZD2XivQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=ZO2BY4xL; arc=none smtp.client-ip=209.85.210.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="ZO2BY4xL" Received: by mail-ot1-f48.google.com with SMTP id 46e09a7af769-6ea2f95ec67so2298409a34.2 for ; Tue, 30 Apr 2024 05:55:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714481750; x=1715086550; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=W3aDGh51WrAJ8PgiOFsXpuERP1GOnupX3ZgEurXatu8=; b=ZO2BY4xLX64F0HVKthqggR/ATljB/BjPLhoKhd9b6K5WJb6WkQdipGG8mf6cW4MXaV dTY4PiedgcXCmdNyTXcCdE96dlgeHj5zauIyNVIgbeIjX2xE9tWM74/U4fu6l9A0zn/J OtrMVbgubNt/5uCK2wAaovBy9srvRNj5sQNWw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714481750; x=1715086550; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=W3aDGh51WrAJ8PgiOFsXpuERP1GOnupX3ZgEurXatu8=; b=xSxEBN/uDH7TyqRWcbPIxxLLKFXoehXADB+70MWqVt09W6UpZClkwqknh/LTT4LivE RrmbPzLdnz89/L0LT/tDXoknknmd0VBLnNsou+k5mu897wWrR56dbUlRFkNP7YWfeTXx mzFUUJPYwfNhDVUuzqo/cjkuDEq/nkl8sfdZlZojmYkgzYf6Vugg/3gQHdBbAiIZZLrp szYk669IGPN4Yk2aKbNpJfsql+BWRJ7DWyd9nLbKBsruTBcOqSMiRryP47Dx8ZQr8rAm fkbBiQBTtqjbK2stw/NFtMgP3e/+wutwgGZ6LN+VebFD/zW3GT6WuhV69kQfXrLTqL65 LYCA== X-Forwarded-Encrypted: i=1; AJvYcCXvrmuBfHcmqEhmjPJsUf9/cZJnlJLZqBEcHKDthbhJsRRxvHBb1snS3v9KLjkzdXZLcFgJ0d8PsrvWqosu83Q4URzQ1HH8zkTejRMl X-Gm-Message-State: AOJu0YzPTkooIdkO1Rn8XdjMmoceON0FShY/6vRNQBSyOmrEQcrU02tm yeaaBysN67fHcplwykRHBOjtLA0xDz2w4yKhDeNawNKPAWJQpieUfIPrGJvkMQ== X-Google-Smtp-Source: AGHT+IE8F+k3g5uPOihti5THP9s3MwDIIlO9hpY6CvqxL5rmWFHHurCg96j6xwnb0ZfdYm2sA2WP/g== X-Received: by 2002:a9d:6e0f:0:b0:6ee:3720:aaec with SMTP id e15-20020a9d6e0f000000b006ee3720aaecmr8448773otr.16.1714481750570; Tue, 30 Apr 2024 05:55:50 -0700 (PDT) Received: from denia.c.googlers.com (114.152.245.35.bc.googleusercontent.com. [35.245.152.114]) by smtp.gmail.com with ESMTPSA id o16-20020a05620a111000b00790f90ffc32sm1553667qkk.22.2024.04.30.05.55.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 05:55:49 -0700 (PDT) From: Ricardo Ribalda Date: Tue, 30 Apr 2024 12:55:36 +0000 Subject: [PATCH 4/4] media: intel/ipu6: Fix build with !ACPI Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240430-fix-ipu6-v1-4-9b31fbbce6e4@chromium.org> References: <20240430-fix-ipu6-v1-0-9b31fbbce6e4@chromium.org> In-Reply-To: <20240430-fix-ipu6-v1-0-9b31fbbce6e4@chromium.org> To: Mauro Carvalho Chehab , Florian Fainelli , Ray Jui , Scott Branden , Broadcom internal kernel review list , Sakari Ailus , Bingbu Cao , Tianshu Qiu Cc: linux-media@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Hans Verkuil , Ricardo Ribalda X-Mailer: b4 0.12.4 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 =E2=80=98acpi_device_handle=E2=80=99; did you mean =E2=80=98acpi_= fwnode_handle=E2=80=99? [-Werror=3Dimplicit-function-declaration] drivers/media/pci/intel/ipu-bridge.c:103:30: warning: initialization of =E2= =80=98acpi_handle=E2=80=99 {aka =E2=80=98void *=E2=80=99} from =E2=80=98int= =E2=80=99 makes pointer from integer without a cast [-Wint-conversion] drivers/media/pci/intel/ipu-bridge.c:110:17: error: implicit declaration of= function =E2=80=98for_each_acpi_dev_match=E2=80=99 [-Werror=3Dimplicit-fun= ction-declaration] drivers/media/pci/intel/ipu-bridge.c:110:74: error: expected =E2=80=98;=E2= =80=99 before =E2=80=98for_each_acpi_consumer_dev=E2=80=99 drivers/media/pci/intel/ipu-bridge.c:104:29: warning: unused variable =E2= =80=98consumer=E2=80=99 [-Wunused-variable] drivers/media/pci/intel/ipu-bridge.c:103:21: warning: unused variable =E2= =80=98handle=E2=80=99 [-Wunused-variable] drivers/media/pci/intel/ipu-bridge.c:166:38: error: invalid use of undefine= d type =E2=80=98struct acpi_device=E2=80=99 drivers/media/pci/intel/ipu-bridge.c:185:43: error: invalid use of undefine= d type =E2=80=98struct acpi_device=E2=80=99 drivers/media/pci/intel/ipu-bridge.c:191:30: error: invalid use of undefine= d type =E2=80=98struct acpi_device=E2=80=99 drivers/media/pci/intel/ipu-bridge.c:196:30: error: invalid use of undefine= d type =E2=80=98struct acpi_device=E2=80=99 drivers/media/pci/intel/ipu-bridge.c:202:30: error: invalid use of undefine= d type =E2=80=98struct acpi_device=E2=80=99 drivers/media/pci/intel/ipu-bridge.c:223:31: error: invalid use of undefine= d type =E2=80=98struct acpi_device=E2=80=99 drivers/media/pci/intel/ipu-bridge.c:236:18: error: implicit declaration of= function =E2=80=98acpi_get_physical_device_location=E2=80=99 [-Werror=3Dim= plicit-function-declaration] drivers/media/pci/intel/ipu-bridge.c:236:56: error: invalid use of undefine= d type =E2=80=98struct acpi_device=E2=80=99 drivers/media/pci/intel/ipu-bridge.c:238:31: error: invalid use of undefine= d type =E2=80=98struct acpi_device=E2=80=99 drivers/media/pci/intel/ipu-bridge.c:256:31: error: invalid use of undefine= d type =E2=80=98struct acpi_device=E2=80=99 drivers/media/pci/intel/ipu-bridge.c:275:31: error: invalid use of undefine= d type =E2=80=98struct acpi_device=E2=80=99 drivers/media/pci/intel/ipu-bridge.c:280:30: error: invalid use of undefine= d type =E2=80=98struct acpi_device=E2=80=99 drivers/media/pci/intel/ipu-bridge.c:469:26: error: implicit declaration of= function =E2=80=98acpi_device_hid=E2=80=99; did you mean =E2=80=98dmi_devi= ce_id=E2=80=99? [-Werror=3Dimplicit-function-declaration] drivers/media/pci/intel/ipu-bridge.c:468:74: warning: format =E2=80=98%s=E2= =80=99 expects argument of type =E2=80=98char *=E2=80=99, but argument 4 ha= s type =E2=80=98int=E2=80=99 [-Wformat=3D] drivers/media/pci/intel/ipu-bridge.c:637:58: error: expected =E2=80=98;=E2= =80=99 before =E2=80=98{=E2=80=99 token drivers/media/pci/intel/ipu-bridge.c:696:1: warning: label =E2=80=98err_put= _adev=E2=80=99 defined but not used [-Wunused-label] drivers/media/pci/intel/ipu-bridge.c:693:1: warning: label =E2=80=98err_put= _ivsc=E2=80=99 defined but not used [-Wunused-label] drivers/media/pci/intel/ipu-bridge.c:691:1: warning: label =E2=80=98err_fre= e_swnodes=E2=80=99 defined but not used [-Wunused-label] drivers/media/pci/intel/ipu-bridge.c:632:40: warning: unused variable =E2= =80=98primary=E2=80=99 [-Wunused-variable] drivers/media/pci/intel/ipu-bridge.c:632:31: warning: unused variable =E2= =80=98fwnode=E2=80=99 [-Wunused-variable] drivers/media/pci/intel/ipu-bridge.c:733:73: error: expected =E2=80=98;=E2= =80=99 before =E2=80=98{=E2=80=99 token drivers/media/pci/intel/ipu-bridge.c:725:24: warning: unused variable =E2= =80=98csi_dev=E2=80=99 [-Wunused-variable] drivers/media/pci/intel/ipu-bridge.c:724:43: warning: unused variable =E2= =80=98adev=E2=80=99 [-Wunused-variable] drivers/media/pci/intel/ipu-bridge.c:599:12: warning: =E2=80=98ipu_bridge_i= nstantiate_ivsc=E2=80=99 defined but not used [-Wunused-function] drivers/media/pci/intel/ipu-bridge.c:444:13: warning: =E2=80=98ipu_bridge_c= reate_connection_swnodes=E2=80=99 defined but not used [-Wunused-function] drivers/media/pci/intel/ipu-bridge.c:297:13: warning: =E2=80=98ipu_bridge_c= reate_fwnode_properties=E2=80=99 defined but not used [-Wunused-function] drivers/media/pci/intel/ipu-bridge.c:155:12: warning: =E2=80=98ipu_bridge_c= heck_ivsc_dev=E2=80=99 defined but not used [-Wunused-function] Signed-off-by: Ricardo Ribalda --- 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 #include =20 +#define ADEV_DEV(adev) ACPI_PTR(&((adev)->dev)) + /* * 92335fcf-3203-4472-af93-7b4453ac29da * @@ -87,6 +89,7 @@ static const char * const ipu_vcm_types[] =3D { "lc898212axb", }; =20 +#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[] = =3D { =20 static struct acpi_device *ipu_bridge_get_ivsc_acpi_dev(struct acpi_device= *adev) { - acpi_handle handle =3D acpi_device_handle(adev); - struct acpi_device *consumer, *ivsc_adev; unsigned int i; =20 for (i =3D 0; i < ARRAY_SIZE(ivsc_acpi_ids); i++) { const struct acpi_device_id *acpi_id =3D &ivsc_acpi_ids[i]; + struct acpi_device *consumer, *ivsc_adev; =20 + acpi_handle handle =3D 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_de= v(struct acpi_device *adev =20 return NULL; } +#else +static struct acpi_device *ipu_bridge_get_ivsc_acpi_dev(struct acpi_device= *adev) +{ + return NULL; +} +#endif =20 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 =3D 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; } =20 @@ -182,24 +191,25 @@ static int ipu_bridge_read_acpi_buffer(struct acpi_de= vice *adev, char *id, acpi_status status; int ret =3D 0; =20 - status =3D acpi_evaluate_object(adev->handle, id, NULL, &buffer); + status =3D acpi_evaluate_object(ACPI_PTR(adev->handle), + id, NULL, &buffer); if (ACPI_FAILURE(status)) return -ENODEV; =20 obj =3D 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; } =20 if (obj->type !=3D ACPI_TYPE_BUFFER) { - dev_err(&adev->dev, "Not an ACPI buffer\n"); + dev_err(ADEV_DEV(adev), "Not an ACPI buffer\n"); ret =3D -ENODEV; goto out_free_buff; } =20 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 =3D -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_devi= ce *adev, static enum v4l2_fwnode_orientation ipu_bridge_parse_orientation(struct ac= pi_device *adev) { enum v4l2_fwnode_orientation orientation; - struct acpi_pld_info *pld; - acpi_status status; + struct acpi_pld_info *pld =3D NULL; + acpi_status status =3D AE_ERROR; =20 +#if IS_ENABLED(CONFIG_ACPI) status =3D 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; } =20 @@ -253,7 +265,8 @@ static enum v4l2_fwnode_orientation ipu_bridge_parse_or= ientation(struct acpi_dev orientation =3D 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 =3D V4L2_FWNODE_ORIENTATION_EXTERNAL; break; } @@ -272,12 +285,12 @@ int ipu_bridge_parse_ssdb(struct acpi_device *adev, s= truct ipu_sensor *sensor) return ret; =20 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 =3D 0; } =20 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; } =20 @@ -465,8 +478,14 @@ static void ipu_bridge_create_connection_swnodes(struc= t ipu_bridge *bridge, sensor->ipu_properties); =20 if (sensor->csi_dev) { + const char *device_hid =3D ""; + +#if IS_ENABLED(CONFIG_ACPI) + device_hid =3D 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); =20 nodes[SWNODE_IVSC_HID] =3D 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 =3D NULL; int ret; =20 +#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; =20 if (bridge->n_sensors >=3D IPU_MAX_PORTS) { @@ -671,7 +694,7 @@ static int ipu_bridge_connect_sensor(const struct ipu_s= ensor_config *cfg, goto err_free_swnodes; } =20 - sensor->adev =3D acpi_dev_get(adev); + sensor->adev =3D ACPI_PTR(acpi_dev_get(adev)); =20 primary =3D acpi_fwnode_handle(adev); primary->secondary =3D fwnode; @@ -727,11 +750,16 @@ static int ipu_bridge_ivsc_is_ready(void) unsigned int i; =20 for (i =3D 0; i < ARRAY_SIZE(ipu_supported_sensors); i++) { +#if IS_ENABLED(CONFIG_ACPI) const struct ipu_sensor_config *cfg =3D &ipu_supported_sensors[i]; =20 for_each_acpi_dev_match(sensor_adev, cfg->hid, NULL, -1) { - if (!sensor_adev->status.enabled) +#else + while (true) { + sensor_adev =3D NULL; +#endif + if (!ACPI_PTR(sensor_adev->status.enabled)) continue; =20 adev =3D ipu_bridge_get_ivsc_acpi_dev(sensor_adev); --=20 2.44.0.769.g3c40516874-goog