From patchwork Mon Dec 16 21:17:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 851319 Received: from mail-qt1-f177.google.com (mail-qt1-f177.google.com [209.85.160.177]) (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 D69581D45FE for ; Mon, 16 Dec 2024 21:17:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734383847; cv=none; b=Zysxw2hgEtwWA7JqlvqC8urM2pwKtOgSfkMS0uEdUqHAqz8BgOXTYCJn+XTk75wk0XOAJOi8z8fZuHZyP+Qt2fCQ7OCb+b+lprRjXx4nCG1WiAdsi2W/R/jqc6MZwSgrpO4rrAIuJ24L4sUSSkgTFZ9EHBkyKME2i8udsFLMaLU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734383847; c=relaxed/simple; bh=kKwZloJ+pxiytz9zfwyv5msK5QwJz26A7aW8bSu0I3s=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hvEvS36u5OGzuqe+VhZmaTAZXkrB2SeaEqZTpJclhrcn2l5AiibWLQ790bxEW2FcGvFJnSC5kpfCd7G4nV3ERjLFLRrbIBwtDpV9W/Hb3IOlvXOWNOQ679fAnrrPvWWMEeiI7+MZ1Jr2iXcpvxa1VnR22v1zZjtV2QGGFdMYiHA= 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=RirRtlIs; arc=none smtp.client-ip=209.85.160.177 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="RirRtlIs" Received: by mail-qt1-f177.google.com with SMTP id d75a77b69052e-46772a0f85bso40897631cf.3 for ; Mon, 16 Dec 2024 13:17:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1734383845; x=1734988645; 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=kM2B80UZkeR2LPczGOfVlIBqSwSauWzJe2cC0H2QDRc=; b=RirRtlIskXwmaHipMITx24EyeCZsFaL6QXksT07tn27TpSzPZLiLexMe/AHK5oulAU J5mQxx7d268giF+o/uF9Qmggcagd+VNuPUu6p6Mww8FdZ4Ao+PCnALLzulW0N/kNNNaD eXDLvJ0+QHlHtKHntzuTQqEsEctSu9LdG+wfg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734383845; x=1734988645; 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=kM2B80UZkeR2LPczGOfVlIBqSwSauWzJe2cC0H2QDRc=; b=vuLgCDy3Z6RPg6aDMLezvg6dks3OVzqOGx/eHm1sENEX8r8F2PnBUmZD88V0vhR+oI OG4ArU3we1BHr5R8GCvRDpovJLEzinoWycI4NZdZ9U1e95SjU0PZurfQCV5GKRWryw64 v8l/hewnTWDxl8NgGLqA5+PfzvBqFuvVedS6qbJkiZOlgWuokztR4dk73Zcz8hXCFZXu +ItpvduKv0kFej2g5yufnXI7USlCkESwQIN6pC2SvIhmEh5+GAvVp39qgNfIYqvnwQsn p8IZlZiUaCNrNE7VmabR9zNuS+f8B3ZHNV2yO8smzslcKAPWHueG1vsp3aKjWZ4HtSIe 6jTw== X-Forwarded-Encrypted: i=1; AJvYcCU7j5l90Bg4jWaR1ywiJ6hPbrnq9xhFBfBoZd+Rx0iJTkmCu6kXFndj1QfuFuCHs4D9vFxBsis1W6oYdA==@vger.kernel.org X-Gm-Message-State: AOJu0YwQ6Zb+f7VVdvRDhAAtwnbS0zocPKKho3qvxbxZOWqjL5uUsGE7 PnWr3tNRAwP1TEtYmNk30HOCcpUyIHJ4H/7vjhF99hsbkNCThrVZskS5DkI3Ew== X-Gm-Gg: ASbGncs4EkRgZaQXSxfoKL6OupCWgfHmZCpWDlSb77eoqnsQNSCZeSyTY5jTkQUlsy+ BZSgyYFZDXhFQg5Kkhl8AAQrTLO2dWdrqfESpw7plK96M4sNA+kn2Oaq2h4jBPCQAhJoryyHctV RlmuFljY5lh1q4r2evBzBJooHJylcmov8MHv9wUYQN6jyRXxEndq7Wbu5tSDQKxKH3XmngJI6Om O99fEjRz0w+MjRe3+5eAJCz66Ezcv2Fml42BrRYw5KwNpsRob3a0BR9T81LuZGWxTRxn4W2Bzwh VX7gYpiw+qnRY9CqbDy2ICBUF3nftqo= X-Google-Smtp-Source: AGHT+IHSGnqI6FhkQaL0069bHSXiDXW28qApI4WsVyO7HAsa7gVNw+XbMJ7VfZy9PvrVRyRjuC0jMg== X-Received: by 2002:a05:622a:1487:b0:467:45b7:c495 with SMTP id d75a77b69052e-468f8ad232emr17931231cf.15.1734383844801; Mon, 16 Dec 2024 13:17:24 -0800 (PST) Received: from denia.c.googlers.com (5.236.236.35.bc.googleusercontent.com. [35.236.236.5]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-467b2e85c03sm31927501cf.69.2024.12.16.13.17.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Dec 2024 13:17:23 -0800 (PST) From: Ricardo Ribalda Date: Mon, 16 Dec 2024 21:17:15 +0000 Subject: [PATCH v5 1/7] ACPI: bus: change the prototype for acpi_get_physical_device_location Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241216-fix-ipu-v5-1-3d6b35ddce7b@chromium.org> References: <20241216-fix-ipu-v5-0-3d6b35ddce7b@chromium.org> In-Reply-To: <20241216-fix-ipu-v5-0-3d6b35ddce7b@chromium.org> To: "Rafael J. Wysocki" , Len Brown , Greg Kroah-Hartman , Robert Moore , "Rafael J. Wysocki" Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-usb@vger.kernel.org, acpica-devel@lists.linux.dev, Sakari Ailus , Dan Carpenter , Ricardo Ribalda X-Mailer: b4 0.13.0 It generally is not OK to use acpi_status and/or AE_ error codes without CONFIG_ACPI and they really only should be used in drivers/acpi/ (and not everywhere in there for that matter). So acpi_get_physical_device_location() needs to be redefined to return something different from acpi_status (preferably bool) in order to be used in !CONFIG_ACPI code. Suggested-by: Rafael J. Wysocki Signed-off-by: Ricardo Ribalda --- drivers/acpi/mipi-disco-img.c | 3 +-- drivers/acpi/scan.c | 4 +--- drivers/acpi/utils.c | 7 +++---- drivers/base/physical_location.c | 4 +--- drivers/media/pci/intel/ipu-bridge.c | 4 ++-- drivers/usb/core/usb-acpi.c | 3 +-- include/acpi/acpi_bus.h | 2 +- 7 files changed, 10 insertions(+), 17 deletions(-) diff --git a/drivers/acpi/mipi-disco-img.c b/drivers/acpi/mipi-disco-img.c index 92b658f92dc0..5b85989f96be 100644 --- a/drivers/acpi/mipi-disco-img.c +++ b/drivers/acpi/mipi-disco-img.c @@ -624,8 +624,7 @@ static void init_crs_csi2_swnodes(struct crs_csi2 *csi2) if (!fwnode_property_present(adev_fwnode, "rotation")) { struct acpi_pld_info *pld; - status = acpi_get_physical_device_location(handle, &pld); - if (ACPI_SUCCESS(status)) { + if (acpi_get_physical_device_location(handle, &pld)) { swnodes->dev_props[NEXT_PROPERTY(prop_index, DEV_ROTATION)] = PROPERTY_ENTRY_U32("rotation", pld->rotation * 45U); diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 74dcccdc6482..93d340027b7f 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -723,10 +723,8 @@ int acpi_tie_acpi_dev(struct acpi_device *adev) static void acpi_store_pld_crc(struct acpi_device *adev) { struct acpi_pld_info *pld; - acpi_status status; - status = acpi_get_physical_device_location(adev->handle, &pld); - if (ACPI_FAILURE(status)) + if (!acpi_get_physical_device_location(adev->handle, &pld)) return; adev->pld_crc = crc32(~0, pld, sizeof(*pld)); diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index 6de542d99518..526563a0d188 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c @@ -494,7 +494,7 @@ bool acpi_device_dep(acpi_handle target, acpi_handle match) } EXPORT_SYMBOL_GPL(acpi_device_dep); -acpi_status +bool acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld) { acpi_status status; @@ -502,9 +502,8 @@ acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld union acpi_object *output; status = acpi_evaluate_object(handle, "_PLD", NULL, &buffer); - if (ACPI_FAILURE(status)) - return status; + return false; output = buffer.pointer; @@ -523,7 +522,7 @@ acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld out: kfree(buffer.pointer); - return status; + return ACPI_SUCCESS(status); } EXPORT_SYMBOL(acpi_get_physical_device_location); diff --git a/drivers/base/physical_location.c b/drivers/base/physical_location.c index 951819e71b4a..5db06e825c94 100644 --- a/drivers/base/physical_location.c +++ b/drivers/base/physical_location.c @@ -13,13 +13,11 @@ bool dev_add_physical_location(struct device *dev) { struct acpi_pld_info *pld; - acpi_status status; if (!has_acpi_companion(dev)) return false; - status = acpi_get_physical_device_location(ACPI_HANDLE(dev), &pld); - if (ACPI_FAILURE(status)) + if (!acpi_get_physical_device_location(ACPI_HANDLE(dev), &pld)) return false; dev->physical_location = diff --git a/drivers/media/pci/intel/ipu-bridge.c b/drivers/media/pci/intel/ipu-bridge.c index a0e9a71580b5..6cc2614b8f86 100644 --- a/drivers/media/pci/intel/ipu-bridge.c +++ b/drivers/media/pci/intel/ipu-bridge.c @@ -259,12 +259,12 @@ static enum v4l2_fwnode_orientation ipu_bridge_parse_orientation(struct acpi_dev { enum v4l2_fwnode_orientation orientation; struct acpi_pld_info *pld = NULL; - acpi_status status = AE_ERROR; + bool status = false; #if IS_ENABLED(CONFIG_ACPI) status = acpi_get_physical_device_location(adev->handle, &pld); #endif - if (ACPI_FAILURE(status)) { + if (!status) { dev_warn(ADEV_DEV(adev), "_PLD call failed, using default orientation\n"); return V4L2_FWNODE_ORIENTATION_EXTERNAL; } diff --git a/drivers/usb/core/usb-acpi.c b/drivers/usb/core/usb-acpi.c index 03c22114214b..935c0efea0b6 100644 --- a/drivers/usb/core/usb-acpi.c +++ b/drivers/usb/core/usb-acpi.c @@ -213,8 +213,7 @@ usb_acpi_get_connect_type(struct usb_port *port_dev, acpi_handle *handle) * no connectable, the port would be not used. */ - status = acpi_get_physical_device_location(handle, &pld); - if (ACPI_SUCCESS(status) && pld) + if (acpi_get_physical_device_location(handle, &pld) && pld) port_dev->location = USB_ACPI_LOCATION_VALID | pld->group_token << 8 | pld->group_position; diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index b2e377b7f337..19f92852e127 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h @@ -43,7 +43,7 @@ acpi_status acpi_evaluate_ost(acpi_handle handle, u32 source_event, u32 status_code, struct acpi_buffer *status_buf); -acpi_status +bool acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld); bool acpi_has_method(acpi_handle handle, char *name); From patchwork Mon Dec 16 21:17:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 851318 Received: from mail-qt1-f170.google.com (mail-qt1-f170.google.com [209.85.160.170]) (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 A23B21D5CC9 for ; Mon, 16 Dec 2024 21:17:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734383850; cv=none; b=ie1noQ6Flf01glvzNmGpy+s6SCGOGORZlph6stfK999ebMV0jZzIEGJO3Xlk/U5/EKu60Cfi06YCklSf73R3pBpqveYQOLQEmt0jRGjwGyRBAzC8hhFDcudOOc9BT1BhmIv0VEAlIMa5MwiTnE5Lhm2miAIEBIJLZSGZ9ZknqlM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734383850; c=relaxed/simple; bh=X32i657SSLdAHHKEkAbumTOxZEIg1B0mwuSYHOFYedE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pJSXNDmksPWEI8m6f3n4qc+tP45F2N9YjCmB+YGIIYMZk1ogG1FI2nE9ZJUKywLdRQ4jbGAGIR33GOaeV0oVfQzYFn7+FaW1Q9ANTl9TeLIIytsO/1cTOBwO6F1ziCKvRvQK7ghzi9BIXpvysCYkRMOvP/459cqzC/LbnoQyyT4= 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=LSEs2M+2; arc=none smtp.client-ip=209.85.160.170 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="LSEs2M+2" Received: by mail-qt1-f170.google.com with SMTP id d75a77b69052e-467a3c85e11so23948481cf.2 for ; Mon, 16 Dec 2024 13:17:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1734383847; x=1734988647; 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=WqBBzZFuR8Mx+keH2/BU5geK8A+jljM9pAiu8cpH6y0=; b=LSEs2M+2u4DUw7wALz8b4Ub6cQ2qEl/y/zuTqEE3TwDenbsNWiFE490qDAuagbC75v RUwY0bCqz9XbHcdpEcetZGUp/wPYfmGgQAPLKDbLGag8TmV81Tb+vMoLZ2aqvDn201/+ sZaqERXgCo9kspL1Kdh0UuH7V7U+WZPvH86Jc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734383847; x=1734988647; 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=WqBBzZFuR8Mx+keH2/BU5geK8A+jljM9pAiu8cpH6y0=; b=eYyD0r2YUnntqjzTQhJ5psVoWLXk9w0plMMRuk4AKi/PhvgF5RkD4ke1czLISd6bRD /2GmhoOxnZXuzoXRxHnvu+HuCTelhGDny3dxr0/i/IwmC46k5y35kwjummT+o5AmTj3r J8obrBWf/ziM1RslGX+ShhYcam6aZUSgCzgOh7vv8XU3TGyFWZYMihsXFVsSKiqJ5Xjm l82BImUO7YXxMuwi4Xvxtuem+Be/pQeiwBi6neWV7O0LRS/jbomQxVmcPeqzBbTJP18G JL8TXnLCCYPS2MbqYnENN9YRm1zH1aGaPq80SU+BdaDCIAXurpFU4DWmwGq0CJhdYZ6U gp0A== X-Forwarded-Encrypted: i=1; AJvYcCVEL/zydOXahlZr5GDR7ux9LHZ+wloT0q9s8DQvTi+nKjxUmiGvn3R7yinB8S2z1jgZFUtqT4/tLOW5BA==@vger.kernel.org X-Gm-Message-State: AOJu0YxmJoAjCHjPL4XiTozQfVpzWzsQXI4JX0JBVdNnbHrWySikNzgu onwnpwvw35FZim0s1N/VJmVK9RmAH3ZmSQdzhV1FNylIb/s1IF+70QIYtoynEA== X-Gm-Gg: ASbGncugdYUe0b+RmAmozrItcFvujYFgZSgDLiwPdhdFKpCtCEEgkqf207Bwkm0ZsOq U29zNpkrL1UeeJRKKYnmYAsxgYW7Z1MDcVgUqkfkCZB2TLcjroHUOBkkAuiZTZ4TtWM6E+GW/nT arB0OrE21Y2tRl8FZinrZ7ZObKh6S9l5tC5yHrkQkJJ5gpjpy84LDISbrcC3b/RcwFPsLvwZHtU 1T5xNkFFe/xBEvPd/Kr1LuqCc3sxUc1d4eNjTJ1TrKgx6u+pvmIpkWhfKxCXUS/iuAxKCRoekc8 B0VWznIkkbwUPOz8WGqfDtuQtFF56bc= X-Google-Smtp-Source: AGHT+IFa0lE3VU6S7yMTSi6U10IiAbRleFzkYam8wiPnIWkXufZo9uMrtys/YCrx+kHmkm9mMlGHjg== X-Received: by 2002:a05:622a:1aa1:b0:467:79eb:4a16 with SMTP id d75a77b69052e-467a5721b4dmr271093651cf.4.1734383847705; Mon, 16 Dec 2024 13:17:27 -0800 (PST) Received: from denia.c.googlers.com (5.236.236.35.bc.googleusercontent.com. [35.236.236.5]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-467b2e85c03sm31927501cf.69.2024.12.16.13.17.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Dec 2024 13:17:26 -0800 (PST) From: Ricardo Ribalda Date: Mon, 16 Dec 2024 21:17:17 +0000 Subject: [PATCH v5 3/7] ACPI: bus: implement acpi_get_physical_device_location when !ACPI Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241216-fix-ipu-v5-3-3d6b35ddce7b@chromium.org> References: <20241216-fix-ipu-v5-0-3d6b35ddce7b@chromium.org> In-Reply-To: <20241216-fix-ipu-v5-0-3d6b35ddce7b@chromium.org> To: "Rafael J. Wysocki" , Len Brown , Greg Kroah-Hartman , Robert Moore , "Rafael J. Wysocki" Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-usb@vger.kernel.org, acpica-devel@lists.linux.dev, Sakari Ailus , Dan Carpenter , Ricardo Ribalda , Mauro Carvalho Chehab X-Mailer: b4 0.13.0 Provide an implementation of acpi_get_physical_device_location that can be used when CONFIG_ACPI is not set. Reviewed-by: Sakari Ailus Acked-by: Mauro Carvalho Chehab Signed-off-by: Ricardo Ribalda --- include/acpi/acpi_bus.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index a9b5a5204781..f38e8b1c8e1f 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h @@ -43,9 +43,6 @@ acpi_status acpi_evaluate_ost(acpi_handle handle, u32 source_event, u32 status_code, struct acpi_buffer *status_buf); -bool -acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld); - bool acpi_has_method(acpi_handle handle, char *name); acpi_status acpi_execute_simple_method(acpi_handle handle, char *method, u64 arg); @@ -60,6 +57,9 @@ bool acpi_check_dsm(acpi_handle handle, const guid_t *guid, u64 rev, u64 funcs); union acpi_object *acpi_evaluate_dsm(acpi_handle handle, const guid_t *guid, u64 rev, u64 func, union acpi_object *argv4); #ifdef CONFIG_ACPI +bool +acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld); + static inline union acpi_object * acpi_evaluate_dsm_typed(acpi_handle handle, const guid_t *guid, u64 rev, u64 func, union acpi_object *argv4, @@ -1003,6 +1003,12 @@ static inline int unregister_acpi_bus_type(void *bus) { return 0; } static inline int acpi_wait_for_acpi_ipmi(void) { return 0; } +static inline bool +acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld) +{ + return false; +} + #define for_each_acpi_dev_match(adev, hid, uid, hrv) \ for (adev = NULL; false && (hid) && (uid) && (hrv); ) From patchwork Mon Dec 16 21:17:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 851317 Received: from mail-qt1-f178.google.com (mail-qt1-f178.google.com [209.85.160.178]) (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 B86561D9339 for ; Mon, 16 Dec 2024 21:17:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734383853; cv=none; b=Byc3lMZ3/vuGZAqJ02uoaui3V3L6qvpYRnzG9UmqBpsxSw7mggt2pvZRP7xJsYX6udrVsP9UNlCsko8xwryJ8X2aS8XDxSMPbPIquuNA3HDl/nvR9JJpuXZjGJ7B+6qPtWBOr76NySj3J/xCvtAkY0G7HxSaGjxzeuo+UQzlMfk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734383853; c=relaxed/simple; bh=95QUI19i+vnnT5+G1KHFOpDSO/pMrFLiSHBGkodQPoc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pVz4Nw5NH807cIfQRQAbMr85WctH8aQh92gBIph3Q1EI43ByejrGhY0GhJbprOuLo7onAWmK2thQCvUuvf8FSqBa6YhtEeYxov4IOKNNHl2pQtD5EZPMT7vC6KwwrljbOanM21lnSuqHjBa3sc5B5uN8pR0dY3aSkedF2BEWJKk= 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=OZKlqkrt; arc=none smtp.client-ip=209.85.160.178 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="OZKlqkrt" Received: by mail-qt1-f178.google.com with SMTP id d75a77b69052e-4678afeb133so49880491cf.0 for ; Mon, 16 Dec 2024 13:17:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1734383850; x=1734988650; 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=Q9wRik7VAWXozMa2pBEsGGs4ayCPfnrgn33kguAxeWI=; b=OZKlqkrt9/2ONupx19ZzXA18kP6cweiU/xz/phCbkZJv0oh8Qajw9vF0Y1tWpO8MBE R1kwkFWtqtyfkzDbyWgXHOPB53jkFsqq0SJrkILJ+zKZUmHrjcGbbzW+G50g+LblXBPs iCbi9ciTLTmUskmHGwYd1H7CDftzpPmg98WFU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734383850; x=1734988650; 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=Q9wRik7VAWXozMa2pBEsGGs4ayCPfnrgn33kguAxeWI=; b=xMXiGdGGwYT4f9meeuGEKfrB5bbkXD0sepApqvvXfUZLYdPxapP8KeKRAhgUM+WtOA xrhLt807dsSuNiPRIeU5fTvum3n57stKCwWSsqFJmpsIvj7uhF5gcLe4P7NBAoOttrKR myQFQDCqDZWjjQl3BuwLshrIaq1Sy7Vd1sxpt4lCBTMPNQjWEY2laEVYda5Sx7Nqy8Nb Fw0n91Zl7qz6vfgPdOTJlVs1099XMdB/SIGhjd9azdlKtIdlwE2cZZzev/zBTbtucH3B OGbLdUO91vZb6YIxdoi0thLDdbdCPgIkTA0AcxSl3QbH8Dnixmc3vzTvwTNCTLlXayO2 aChQ== X-Forwarded-Encrypted: i=1; AJvYcCUHSAv9GkAqx0uzGtkDEn64pmMCVMJtdxxknxEPssrPKbxlXpBICMZmyjEwnidhfOHzWPozMCy/7CMwJQ==@vger.kernel.org X-Gm-Message-State: AOJu0YxQntbosudp4Vc7CozHwdauWkXbauocZfnXl1FrTkCbjI6qCDGS P0iol8U8zfNOKJmCPr6kbld9JMTEQFLPVs4iAVDCTBUxN7PMhUjhXO485RqYqg== X-Gm-Gg: ASbGnctFvwHNs3Wedmd9cSApmfqCwJ8sr2icja5HeYHDASBIKzOCl9Cnc50HRNjmAqg OIwbzqk37jgNQhgjNjJAEsvdakcBB+J3MW+cOP2UVIsGbu5N0gYl2KXYEhd4oVLRkVRzRDPNxBn 6KgMzrvNs42bDbIOsGcMdeNwlYfqA8WyG+A6mumgcC6rpK1Cp/T/ojDbV3JTy5YXF0MObb/U6ko /9m3pHXP8va8DMMSg1c0RZ1RfeFg0mOfQC+MIVY0ysmIQ+fablSj/75hbbn3y1lcTOlnnrwRSaF hmEGACXh0iNgUhG0uXV0iDXto+m9Gbk= X-Google-Smtp-Source: AGHT+IEWoLxfSlaf8rXHfYGdo/dNrMIk3fj9viLQXfHndjp90WcsgvICJeewTTVu5HvfhfYK4N5nnA== X-Received: by 2002:ac8:570b:0:b0:465:2fcd:cb0b with SMTP id d75a77b69052e-468f8df3bcemr12486021cf.24.1734383849763; Mon, 16 Dec 2024 13:17:29 -0800 (PST) Received: from denia.c.googlers.com (5.236.236.35.bc.googleusercontent.com. [35.236.236.5]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-467b2e85c03sm31927501cf.69.2024.12.16.13.17.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Dec 2024 13:17:29 -0800 (PST) From: Ricardo Ribalda Date: Mon, 16 Dec 2024 21:17:19 +0000 Subject: [PATCH v5 5/7] ACPI: bus: implement for_each_acpi_consumer_dev when !ACPI Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241216-fix-ipu-v5-5-3d6b35ddce7b@chromium.org> References: <20241216-fix-ipu-v5-0-3d6b35ddce7b@chromium.org> In-Reply-To: <20241216-fix-ipu-v5-0-3d6b35ddce7b@chromium.org> To: "Rafael J. Wysocki" , Len Brown , Greg Kroah-Hartman , Robert Moore , "Rafael J. Wysocki" Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-usb@vger.kernel.org, acpica-devel@lists.linux.dev, Sakari Ailus , Dan Carpenter , Ricardo Ribalda , Mauro Carvalho Chehab X-Mailer: b4 0.13.0 Provide an implementation of for_each_acpi_consumer_dev that can be use used when CONFIG_ACPI is not set. The expression `false && supplier` is used to avoid "variable not used" warnings. Reviewed-by: Sakari Ailus Acked-by: Mauro Carvalho Chehab Signed-off-by: Ricardo Ribalda --- include/acpi/acpi_bus.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index f38e8b1c8e1f..68c0e2fb029f 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h @@ -1009,6 +1009,9 @@ acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld return false; } +#define for_each_acpi_consumer_dev(supplier, consumer) \ + for (consumer = NULL; false && (supplier);) + #define for_each_acpi_dev_match(adev, hid, uid, hrv) \ for (adev = NULL; false && (hid) && (uid) && (hrv); ) From patchwork Mon Dec 16 21:17:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 851316 Received: from mail-qt1-f178.google.com (mail-qt1-f178.google.com [209.85.160.178]) (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 2C24B1DB958 for ; Mon, 16 Dec 2024 21:17:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734383855; cv=none; b=HSYv9PQBiCcjgVcACtEl1gukA9ZL9cOONqMoLPzAgmRd1SINrMbE7jguyTyQCPgjtB55vrdeMeOWkEGcrrt06Tkm1iank/+VS33wyrLFQcKGoMpjmjeDrxliXOPTV/SeH1P9wY0OR8JfTnkUQhLuYf0pvtXZVs8c4D+H54cuUaM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734383855; c=relaxed/simple; bh=IKB58y4snq/gqAR94o4C+T0eqQtkn7ecDZk3e6CYE68=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=M4W9mwy76o+BG53LF+qWbJ2ezqfnBAA3YAI/AhJNFQ+SnnvBXnp1m4Px4ladfuvN1LsEKY3XzLHUf5/v2X1LBOvWKMMdsnDuIMK97ekjBDpuUjTZDNEWno9VQF2R1qIJr/it9zu3vwQHfn/HTXqTcbI/LwZ6aWJI4yrqaoJoUgs= 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=GJPwkgNF; arc=none smtp.client-ip=209.85.160.178 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="GJPwkgNF" Received: by mail-qt1-f178.google.com with SMTP id d75a77b69052e-467918c360aso55124831cf.0 for ; Mon, 16 Dec 2024 13:17:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1734383852; x=1734988652; 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=pSt2f8yebuqnlO+DsTFByKH2G3GRiRhWURC3O1KFqeY=; b=GJPwkgNFlEuz0Eo+vpfVsbPktf5ec6XKKDuEt1RQ1hOB+pdMWdEJCIRPeOOXTVeD+w r8i5ieBBTYy7w/lHAIqLfHDnPQYyxUZjRmC9ayjDAy0tNczRtAvk9T6UpMazzqA33S8W Z3PJNYgbgNXTLQ9SEwXsnkjyRnLP7pAENC8LI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734383852; x=1734988652; 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=pSt2f8yebuqnlO+DsTFByKH2G3GRiRhWURC3O1KFqeY=; b=YDmyw2Ku01klQuD3P90alo9oMitKp2/sVagugxBXkIhRgiXL7FRbOUVHih+oZAfWNF p2gEKoZ+fytUxhUFGfw17IznxUm4VNTizAbvCCqzWjTL3tJDlkXuxMm3waf5RYAsG4zT d0qxD/GAfO26G0N/QSL8xka1Yj6mVF2vvYq9bac+nwY+RlZT3bJZGh6WUs4VMxjuyeCE keEsEAJKjjdO0Cb/UcX5SbkMdRkGM1mxh8a3BhQ0H/1Qd9/HC8uFfR0dsf1Y/BbfLKhE q4u40y8IyGs8gZjzz9FCMR2hP268dS4yghQiLvVfQqT+guBYGH9GmDhADFuQD+tuk+/2 54dA== X-Forwarded-Encrypted: i=1; AJvYcCXoS+0CWwg6cvz2ZHIdPOrzG2I8JGYTYRsawEHP9d7MAO7TzUup6VghO4ZMCewh6N5NecswNVYFigmVFA==@vger.kernel.org X-Gm-Message-State: AOJu0YwPiixVr15MixHZp6opp4CSQSjAMEa4OOtGZL769ePLBiDTlAjO QV/JLpvXqjQm3eYai0FODdgpm/ku/SwyomWLuK5gQ1B01kA+SLQu7sGC411Y4Q== X-Gm-Gg: ASbGnctAQB8xjtiRNNN3n073wMmHrH6C9Z/zaT6znb0w49EhHOOMyn8pzh4MG0XHsHN 7jwo7eoS3GYHF5aAAcNnRiywUIErHCr86cag12nx7QbHu6SoCDi3jiIE/uWBNHhmdItCl3bhOAa fHecRCcE+Tw8jXM6v+oCIurlj50WmCZQMKmUvZt0kY2TWYAkFBak7Mb8dKNBp9XWgt3QwJgEOBJ gXC7yCTJpxbuuE2rYW68cyB/VEZcbIH9gP2CJ4tuQBjnSjjxjQhcRl8TbV1xlNjfNvcWWINDoqr H5aJlb+J+CkWva4kKVXWtmNoATfc6EM= X-Google-Smtp-Source: AGHT+IGA7OE2/+AFr8NJQp1+beNCjHTix5HDCvzlrGBd1KJenMxv6YV5fSV7uyPrfaZdLlcoEJkjrQ== X-Received: by 2002:ac8:5a93:0:b0:466:a983:a15a with SMTP id d75a77b69052e-467a581d253mr223743851cf.42.1734383852093; Mon, 16 Dec 2024 13:17:32 -0800 (PST) Received: from denia.c.googlers.com (5.236.236.35.bc.googleusercontent.com. [35.236.236.5]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-467b2e85c03sm31927501cf.69.2024.12.16.13.17.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Dec 2024 13:17:31 -0800 (PST) From: Ricardo Ribalda Date: Mon, 16 Dec 2024 21:17:21 +0000 Subject: [PATCH v5 7/7] media: ipu-bridge: Remove unneeded conditional compilations Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241216-fix-ipu-v5-7-3d6b35ddce7b@chromium.org> References: <20241216-fix-ipu-v5-0-3d6b35ddce7b@chromium.org> In-Reply-To: <20241216-fix-ipu-v5-0-3d6b35ddce7b@chromium.org> To: "Rafael J. Wysocki" , Len Brown , Greg Kroah-Hartman , Robert Moore , "Rafael J. Wysocki" Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-usb@vger.kernel.org, acpica-devel@lists.linux.dev, Sakari Ailus , Dan Carpenter , Ricardo Ribalda , Mauro Carvalho Chehab X-Mailer: b4 0.13.0 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 Acked-by: Mauro Carvalho Chehab Signed-off-by: Ricardo Ribalda --- drivers/media/pci/intel/ipu-bridge.c | 29 ++++------------------------- 1 file changed, 4 insertions(+), 25 deletions(-) diff --git a/drivers/media/pci/intel/ipu-bridge.c b/drivers/media/pci/intel/ipu-bridge.c index 6cc2614b8f86..be84c100d732 100644 --- a/drivers/media/pci/intel/ipu-bridge.c +++ b/drivers/media/pci/intel/ipu-bridge.c @@ -2,6 +2,7 @@ /* Author: Dan Scally */ #include +#include #include #include #include @@ -107,7 +108,6 @@ 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. @@ -127,11 +127,11 @@ static struct acpi_device *ipu_bridge_get_ivsc_acpi_dev(struct acpi_device *adev const struct acpi_device_id *acpi_id = &ivsc_acpi_ids[i]; struct acpi_device *consumer, *ivsc_adev; - acpi_handle handle = acpi_device_handle(adev); + acpi_handle handle = acpi_device_handle(ACPI_PTR(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 (consumer->handle == handle) { + if (ACPI_PTR(consumer->handle) == handle) { acpi_dev_put(consumer); return ivsc_adev; } @@ -139,12 +139,6 @@ 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) { @@ -259,12 +253,8 @@ static enum v4l2_fwnode_orientation ipu_bridge_parse_orientation(struct acpi_dev { enum v4l2_fwnode_orientation orientation; struct acpi_pld_info *pld = NULL; - bool status = false; -#if IS_ENABLED(CONFIG_ACPI) - status = acpi_get_physical_device_location(adev->handle, &pld); -#endif - if (!status) { + if (!acpi_get_physical_device_location(ACPI_PTR(adev->handle), &pld)) { dev_warn(ADEV_DEV(adev), "_PLD call failed, using default orientation\n"); return V4L2_FWNODE_ORIENTATION_EXTERNAL; } @@ -498,9 +488,7 @@ static void ipu_bridge_create_connection_swnodes(struct ipu_bridge *bridge, 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", device_hid, sensor->link); @@ -671,11 +659,7 @@ static int ipu_bridge_connect_sensor(const struct ipu_sensor_config *cfg, struct acpi_device *adev = NULL; int ret; -#if IS_ENABLED(CONFIG_ACPI) for_each_acpi_dev_match(adev, cfg->hid, NULL, -1) { -#else - while (true) { -#endif if (!ACPI_PTR(adev->status.enabled)) continue; @@ -768,15 +752,10 @@ 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) { -#else - while (true) { - sensor_adev = NULL; -#endif if (!ACPI_PTR(sensor_adev->status.enabled)) continue;