From patchwork Tue May 5 13:21:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 11529061 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A252517E8 for ; Tue, 5 May 2020 13:21:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 837DF215A4 for ; Tue, 5 May 2020 13:21:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="GhzSTl6t" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728960AbgEENVr (ORCPT ); Tue, 5 May 2020 09:21:47 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:59763 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728892AbgEENVr (ORCPT ); Tue, 5 May 2020 09:21:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588684904; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oXvOfYNLxP2n9KMtCvZ22eK9RVc3+f2D2Cb9gIn69YQ=; b=GhzSTl6tu9Qtq5m5onQdcqkbnZJ7qwFhqFE+cDV1xIgRMeAA/HMV+JZF6KAnvnwCmf+Osq y8z8kTZSnQ9XL44L+5czkATDLgKOH7pKW+Mo7Vz6SiVQNzbx5/chKdzWOyJkRtBiGqoasN 61QC7m3ChM6zXvWKJmGZgIf2JQG345I= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-457-i4ij7bCGNJOK2v75-TcwWg-1; Tue, 05 May 2020 09:21:42 -0400 X-MC-Unique: i4ij7bCGNJOK2v75-TcwWg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C1CCE8014D7; Tue, 5 May 2020 13:21:40 +0000 (UTC) Received: from x1.localdomain.com (ovpn-113-21.ams2.redhat.com [10.36.113.21]) by smtp.corp.redhat.com (Postfix) with ESMTP id E16D26060E; Tue, 5 May 2020 13:21:38 +0000 (UTC) From: Hans de Goede To: "Rafael J . Wysocki" , Len Brown , Bjorn Helgaas , Mika Westerberg , Andy Shevchenko , Linus Walleij Cc: Hans de Goede , linux-acpi@vger.kernel.org, linux-pci@vger.kernel.org, linux-gpio@vger.kernel.org Subject: [PATCH 1/3] ACPI / utils: Add acpi_evaluate_reg() helper Date: Tue, 5 May 2020 15:21:26 +0200 Message-Id: <20200505132128.19476-2-hdegoede@redhat.com> In-Reply-To: <20200505132128.19476-1-hdegoede@redhat.com> References: <20200505132128.19476-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org With a recent fix to the pinctrl-cherryview driver we know have 2 drivers open-coding the parameter building / passing for calling _REG on an ACPI handle. Add a helper for this, so that these 2 drivers can be converted to this helper. Signed-off-by: Hans de Goede --- drivers/acpi/utils.c | 25 +++++++++++++++++++++++++ include/acpi/acpi_bus.h | 1 + 2 files changed, 26 insertions(+) diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index 804ac0df58ec..838b719ec7ce 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c @@ -605,6 +605,31 @@ acpi_status acpi_evaluate_lck(acpi_handle handle, int lock) return status; } +/** + * acpi_evaluate_reg: Evaluate _REG method to register OpRegion presence + * @handle: ACPI device handle + * @space_id: ACPI address space id to register OpRegion presence for + * @function: Parameter to pass to _REG one of ACPI_REG_CONNECT or + * ACPI_REG_DISCONNECT + * + * Evaluate device's _REG method to register OpRegion presence. + */ +acpi_status acpi_evaluate_reg(acpi_handle handle, u8 space_id, u32 function) +{ + struct acpi_object_list arg_list; + union acpi_object params[2]; + + params[0].type = ACPI_TYPE_INTEGER; + params[0].integer.value = space_id; + params[1].type = ACPI_TYPE_INTEGER; + params[1].integer.value = function; + arg_list.count = 2; + arg_list.pointer = params; + + return acpi_evaluate_object(handle, "_REG", &arg_list, NULL); +} +EXPORT_SYMBOL(acpi_evaluate_reg); + /** * acpi_evaluate_dsm - evaluate device's _DSM method * @handle: ACPI device handle diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index a92bea7184a8..5afb6ceb284f 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h @@ -44,6 +44,7 @@ acpi_status acpi_execute_simple_method(acpi_handle handle, char *method, u64 arg); acpi_status acpi_evaluate_ej0(acpi_handle handle); acpi_status acpi_evaluate_lck(acpi_handle handle, int lock); +acpi_status acpi_evaluate_reg(acpi_handle handle, u8 space_id, u32 function); bool acpi_ata_match(acpi_handle handle); bool acpi_bay_match(acpi_handle handle); bool acpi_dock_match(acpi_handle handle); From patchwork Tue May 5 13:21:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 11529069 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 70D2E14B4 for ; Tue, 5 May 2020 13:21:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 594792083B for ; Tue, 5 May 2020 13:21:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="T6Laf5jF" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729023AbgEENVu (ORCPT ); Tue, 5 May 2020 09:21:50 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:56724 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728898AbgEENVt (ORCPT ); Tue, 5 May 2020 09:21:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588684908; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=C62A7ZX2Fzn6OxQtLQ6cG85T/2JvqNh73Sjw5wOf4Z8=; b=T6Laf5jF4DIp+ZvT8SHM6TNinrAB1F/IkoU5HCQysSwQyH0mwDu+JXg10bjPrRNCJCcaT5 mPVd3+2JobgcQjTw1dHDwYvqNFlo5orQav/CTyaLjetv9yytgvMlWrK8Q1XH9azASzk1fd aveBEd8W5nLqgnfji9FvVmu2gIqqKrY= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-490-1qLHArz8Prq-zst2h12iQw-1; Tue, 05 May 2020 09:21:44 -0400 X-MC-Unique: 1qLHArz8Prq-zst2h12iQw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E35C0107ACF6; Tue, 5 May 2020 13:21:42 +0000 (UTC) Received: from x1.localdomain.com (ovpn-113-21.ams2.redhat.com [10.36.113.21]) by smtp.corp.redhat.com (Postfix) with ESMTP id 120236060E; Tue, 5 May 2020 13:21:40 +0000 (UTC) From: Hans de Goede To: "Rafael J . Wysocki" , Len Brown , Bjorn Helgaas , Mika Westerberg , Andy Shevchenko , Linus Walleij Cc: Hans de Goede , linux-acpi@vger.kernel.org, linux-pci@vger.kernel.org, linux-gpio@vger.kernel.org Subject: [PATCH 2/3] ACPI / hotplug / PCI: Use the new acpi_evaluate_reg() helper Date: Tue, 5 May 2020 15:21:27 +0200 Message-Id: <20200505132128.19476-3-hdegoede@redhat.com> In-Reply-To: <20200505132128.19476-1-hdegoede@redhat.com> References: <20200505132128.19476-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Use the new acpi_evaluate_reg() helper in the acpiphp_glue.c code. Signed-off-by: Hans de Goede Acked-by: Bjorn Helgaas --- drivers/pci/hotplug/acpiphp_glue.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index b3869951c0eb..fd77eb1d460c 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c @@ -385,20 +385,11 @@ static unsigned char acpiphp_max_busnr(struct pci_bus *bus) static void acpiphp_set_acpi_region(struct acpiphp_slot *slot) { struct acpiphp_func *func; - union acpi_object params[2]; - struct acpi_object_list arg_list; - list_for_each_entry(func, &slot->funcs, sibling) { - arg_list.count = 2; - arg_list.pointer = params; - params[0].type = ACPI_TYPE_INTEGER; - params[0].integer.value = ACPI_ADR_SPACE_PCI_CONFIG; - params[1].type = ACPI_TYPE_INTEGER; - params[1].integer.value = 1; - /* _REG is optional, we don't care about if there is failure */ - acpi_evaluate_object(func_to_handle(func), "_REG", &arg_list, - NULL); - } + list_for_each_entry(func, &slot->funcs, sibling) + acpi_evaluate_reg(func_to_handle(func), + ACPI_ADR_SPACE_PCI_CONFIG, + ACPI_REG_CONNECT); } static void check_hotplug_bridge(struct acpiphp_slot *slot, struct pci_dev *dev) From patchwork Tue May 5 13:21:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 11529065 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7A4E214B4 for ; Tue, 5 May 2020 13:21:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5C41C2078D for ; Tue, 5 May 2020 13:21:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="LjVL7TA4" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729029AbgEENVt (ORCPT ); Tue, 5 May 2020 09:21:49 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:25952 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728996AbgEENVt (ORCPT ); Tue, 5 May 2020 09:21:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588684908; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pCVuo/wWVMtEixMAsPUx+ERNNUL83pR0CaQxlVIb/Cs=; b=LjVL7TA4UtgNses7tJTb39Bl5zIRHD6jmE0x2MWxp52t7b4ZQuSTeGFzWlPj2ZYAmD8nik ucDfXy69Hb3/uWSvWgxb4GJYcJhWSLJ7FeWqqFQFk0igzRgmTprIGFIoBgv3m+jbDpr2Uh YN7GCFVUiQVsloaN8FAyYVwie6ef9lM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-150-irMXFVHKMEGlX47Pv6O8bg-1; Tue, 05 May 2020 09:21:46 -0400 X-MC-Unique: irMXFVHKMEGlX47Pv6O8bg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1C5348014C1; Tue, 5 May 2020 13:21:45 +0000 (UTC) Received: from x1.localdomain.com (ovpn-113-21.ams2.redhat.com [10.36.113.21]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3787B6060E; Tue, 5 May 2020 13:21:43 +0000 (UTC) From: Hans de Goede To: "Rafael J . Wysocki" , Len Brown , Bjorn Helgaas , Mika Westerberg , Andy Shevchenko , Linus Walleij Cc: Hans de Goede , linux-acpi@vger.kernel.org, linux-pci@vger.kernel.org, linux-gpio@vger.kernel.org Subject: [PATCH 3/3] pinctrl: cherryview: Use the new acpi_evaluate_reg() helper Date: Tue, 5 May 2020 15:21:28 +0200 Message-Id: <20200505132128.19476-4-hdegoede@redhat.com> In-Reply-To: <20200505132128.19476-1-hdegoede@redhat.com> References: <20200505132128.19476-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Use the new acpi_evaluate_reg() helper in the pinctrl-cherryview code. Signed-off-by: Hans de Goede --- drivers/pinctrl/intel/pinctrl-cherryview.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/pinctrl/intel/pinctrl-cherryview.c b/drivers/pinctrl/intel/pinctrl-cherryview.c index 4817aec114d6..579bdfcfab8f 100644 --- a/drivers/pinctrl/intel/pinctrl-cherryview.c +++ b/drivers/pinctrl/intel/pinctrl-cherryview.c @@ -1693,8 +1693,6 @@ static acpi_status chv_pinctrl_mmio_access_handler(u32 function, static int chv_pinctrl_probe(struct platform_device *pdev) { - struct acpi_object_list input; - union acpi_object params[2]; struct chv_pinctrl *pctrl; struct acpi_device *adev; acpi_status status; @@ -1765,13 +1763,8 @@ static int chv_pinctrl_probe(struct platform_device *pdev) * the GeneralPurposeIo OpRegion. Manually call _REG here so that * the DSDT-s GeneralPurposeIo availability checks will succeed. */ - params[0].type = ACPI_TYPE_INTEGER; - params[0].integer.value = ACPI_ADR_SPACE_GPIO; - params[1].type = ACPI_TYPE_INTEGER; - params[1].integer.value = 1; - input.count = 2; - input.pointer = params; - acpi_evaluate_object(adev->handle, "_REG", &input, NULL); + acpi_evaluate_reg(adev->handle, ACPI_ADR_SPACE_GPIO, + ACPI_REG_CONNECT); platform_set_drvdata(pdev, pctrl);