Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp8223710pxb; Fri, 19 Feb 2021 10:21:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJzlcp0aE8Pbe0iJttHxUPiU7FJsMQL5egtXKP5o4ELhqNd8HoQBFPsMlIAaT/hPGcayL61X X-Received: by 2002:a17:906:af63:: with SMTP id os3mr9947192ejb.69.1613758861779; Fri, 19 Feb 2021 10:21:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613758861; cv=none; d=google.com; s=arc-20160816; b=KolM/bOu9xffpnk0gXR2NLgHk8I0EGClqsM+7yrgYOkjKTavAFTOJHFCbw1G83e2UI 0n2v8AhGSBG+6PzZLwt30+gdwj3BAuMFttXqmkdgCmZNCSqPbRybiMgehc23njthOe42 6vlJKl+iQUPPFVy/2/u/Uxaw0yf5e5A51yuJDyyg2FFiyIjQD2xgW+fi6Ba3kbF/CaUc XlTCPDV9sPSOH+zQx3ghnxFTEZA9OXaHBwOLmRQOacY0NUgjPPOayEKFFlYlCZNj8vhU E7aDrsWyLkLQ0U2Wc//ryqfJrD+Szy3ldyJaL+DS0MnHdApRDFVhEGvVXLT4ZiigKioM u6dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=iQ8ucMJvINWNDiFklUY+3xjK88gCHeu+foeWSbgrYJk=; b=ICfRdT+reXxXc5HvKtj/SybQFOD3+I2dFIStn529xP5QnvlAJ+m49pA6OCviW5SQ8E ZlQ+K/B5TvPQyVALyfSYes2gyFLpW0CCwfQxFBJU1zoAlV9EihmbU3/XMY7Io0RIJvlg 6PzL56xWbU5jRWY3Ek2cVth6zToH04ncDv6TtQg/7oAneJj/GS4Ucphper1uamVTMO8i hG0UKZ6BUhxB1vpTCmQFt/TlUeb8ncM+/a8U0wzHEERgqKwYpVfBOOjtiCkBcczxqhxw LjQcCbWeUfFprLE2nmX1f9XqtzplO48HLmd1U5W5Etu2C8Iso5Jn9OfgO4Ti+gXulo6C mv5w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w8si6354309edc.83.2021.02.19.10.20.37; Fri, 19 Feb 2021 10:21:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229850AbhBSSS7 (ORCPT + 99 others); Fri, 19 Feb 2021 13:18:59 -0500 Received: from cloudserver094114.home.pl ([79.96.170.134]:55504 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229810AbhBSSS6 (ORCPT ); Fri, 19 Feb 2021 13:18:58 -0500 Received: from localhost (127.0.0.1) (HELO v370.home.net.pl) by /usr/run/smtp (/usr/run/postfix/private/idea_smtp) via UNIX with SMTP (IdeaSmtpServer 0.83.537) id 816e0173f029b67d; Fri, 19 Feb 2021 19:18:13 +0100 Received: from kreacher.localnet (89-64-81-29.dynamic.chello.pl [89.64.81.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by v370.home.net.pl (Postfix) with ESMTPSA id AB2AD661E07; Fri, 19 Feb 2021 19:18:12 +0100 (CET) From: "Rafael J. Wysocki" To: Linux ACPI Cc: Linux PCI , LKML , Bjorn Helgaas , Hanjun Guo Subject: [PATCH v1 4/4] ACPI: PCI: Replace direct printk() invocations in pci_link.c Date: Fri, 19 Feb 2021 19:17:44 +0100 Message-ID: <2246899.HyxBmBtjVt@kreacher> In-Reply-To: <4822757.tvZ08WQ2Gl@kreacher> References: <4822757.tvZ08WQ2Gl@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduledrjeeigddutdelucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkjghfggfgtgesthfuredttddtvdenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpefgleehfffhtefflefhleetjeffteettefgteekjedvhfeffedtueefveegveeiveenucfkphepkeelrdeigedrkedurddvleenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeekledrieegrdekuddrvdelpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhrtghpthhtoheplhhinhhugidqrggtphhisehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqphgtihesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehhvghlghgrrghssehkvghrnhgvlhdrohhrghdprhgtphhtthhopehguhhohhgrnhhjuhhnsehhuhgrfigvihdrtgho mh X-DCC--Metrics: v370.home.net.pl 1024; Body=5 Fuz1=5 Fuz2=5 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rafael J. Wysocki Replace the direct printk() invocations in pci_link.c with (mostly corresponding) acpi_handle_*() calls relative to the ACPI handle of the given link device, which allows the AML corresponding to those messages to be identified more easily, or with pr_*() calls. While at it, add a pr_fmt() definition ot pci_link.c, make acpi_pci_link_check_possible() print all messages with acpi_handle_debug() for consistency and replace the (not-so- reliable) KERN_CONT-based message line composition in acpi_pci_link_add() with two pr_info() and a series of acpi_handle_debug() calls (the latter for the possible IRQs). Signed-off-by: Rafael J. Wysocki --- drivers/acpi/pci_link.c | 86 +++++++++++++++++++++--------------------------- 1 file changed, 38 insertions(+), 48 deletions(-) Index: linux-pm/drivers/acpi/pci_link.c =================================================================== --- linux-pm.orig/drivers/acpi/pci_link.c +++ linux-pm/drivers/acpi/pci_link.c @@ -12,6 +12,8 @@ * for IRQ management (e.g. start()->_SRS). */ +#define pr_fmt(fmt) "ACPI: PCI: " fmt + #include #include #include @@ -102,9 +104,9 @@ static acpi_status acpi_pci_link_check_p (i < p->interrupt_count && i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) { if (!p->interrupts[i]) { - printk(KERN_WARNING PREFIX - "Invalid _PRS IRQ %d\n", - p->interrupts[i]); + acpi_handle_debug(handle, + "Invalid _PRS IRQ %d\n", + p->interrupts[i]); continue; } link->irq.possible[i] = p->interrupts[i]; @@ -120,17 +122,17 @@ static acpi_status acpi_pci_link_check_p struct acpi_resource_extended_irq *p = &resource->data.extended_irq; if (!p || !p->interrupt_count) { - printk(KERN_WARNING PREFIX - "Blank _PRS EXT IRQ resource\n"); + acpi_handle_debug(handle, + "Blank _PRS EXT IRQ resource\n"); return AE_OK; } for (i = 0; (i < p->interrupt_count && i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) { if (!p->interrupts[i]) { - printk(KERN_WARNING PREFIX - "Invalid _PRS IRQ %d\n", - p->interrupts[i]); + acpi_handle_debug(handle, + "Invalid _PRS IRQ %d\n", + p->interrupts[i]); continue; } link->irq.possible[i] = p->interrupts[i]; @@ -142,8 +144,8 @@ static acpi_status acpi_pci_link_check_p break; } default: - printk(KERN_ERR PREFIX "_PRS resource type 0x%x isn't an IRQ\n", - resource->type); + acpi_handle_debug(handle, "_PRS resource type 0x%x is not IRQ\n", + resource->type); return AE_OK; } @@ -527,6 +529,7 @@ static int acpi_irq_balance = -1; /* 0: static int acpi_pci_link_allocate(struct acpi_pci_link *link) { + acpi_handle handle = link->device->handle; int irq; int i; @@ -549,8 +552,8 @@ static int acpi_pci_link_allocate(struct */ if (i == link->irq.possible_count) { if (acpi_strict) - printk(KERN_WARNING PREFIX "_CRS %d not found" - " in _PRS\n", link->irq.active); + acpi_handle_warn(handle, "_CRS %d not found in _PRS\n", + link->irq.active); link->irq.active = 0; } @@ -574,28 +577,23 @@ static int acpi_pci_link_allocate(struct } } if (acpi_irq_get_penalty(irq) >= PIRQ_PENALTY_ISA_ALWAYS) { - printk(KERN_ERR PREFIX "No IRQ available for %s [%s]. " - "Try pci=noacpi or acpi=off\n", - acpi_device_name(link->device), - acpi_device_bid(link->device)); + acpi_handle_err(handle, + "No IRQ available. Try pci=noacpi or acpi=off\n"); return -ENODEV; } /* Attempt to enable the link device at this IRQ. */ if (acpi_pci_link_set(link, irq)) { - printk(KERN_ERR PREFIX "Unable to set IRQ for %s [%s]. " - "Try pci=noacpi or acpi=off\n", - acpi_device_name(link->device), - acpi_device_bid(link->device)); + acpi_handle_err(handle, + "Unable to set IRQ. Try pci=noacpi or acpi=off\n"); return -ENODEV; } else { if (link->irq.active < ACPI_MAX_ISA_IRQS) acpi_isa_irq_penalty[link->irq.active] += PIRQ_PENALTY_PCI_USING; - pr_info("%s [%s] enabled at IRQ %d\n", - acpi_device_name(link->device), - acpi_device_bid(link->device), link->irq.active); + acpi_handle_info(handle, "Enabled at IRQ %d\n", + link->irq.active); } link->irq.initialized = 1; @@ -616,19 +614,19 @@ int acpi_pci_link_allocate_irq(acpi_hand result = acpi_bus_get_device(handle, &device); if (result) { - printk(KERN_ERR PREFIX "Invalid link device\n"); + acpi_handle_err(handle, "Invalid link device\n"); return -1; } link = acpi_driver_data(device); if (!link) { - printk(KERN_ERR PREFIX "Invalid link context\n"); + acpi_handle_err(handle, "Invalid link context\n"); return -1; } /* TBD: Support multiple index (IRQ) entries per Link Device */ if (index) { - printk(KERN_ERR PREFIX "Invalid index %d\n", index); + acpi_handle_err(handle, "Invalid index %d\n", index); return -1; } @@ -640,7 +638,7 @@ int acpi_pci_link_allocate_irq(acpi_hand if (!link->irq.active) { mutex_unlock(&acpi_link_lock); - printk(KERN_ERR PREFIX "Link active IRQ is 0!\n"); + acpi_handle_err(handle, "Link active IRQ is 0!\n"); return -1; } link->refcnt++; @@ -668,20 +666,20 @@ int acpi_pci_link_free_irq(acpi_handle h result = acpi_bus_get_device(handle, &device); if (result) { - printk(KERN_ERR PREFIX "Invalid link device\n"); + acpi_handle_err(handle, "Invalid link device\n"); return -1; } link = acpi_driver_data(device); if (!link) { - printk(KERN_ERR PREFIX "Invalid link context\n"); + acpi_handle_err(handle, "Invalid link context\n"); return -1; } mutex_lock(&acpi_link_lock); if (!link->irq.initialized) { mutex_unlock(&acpi_link_lock); - printk(KERN_ERR PREFIX "Link isn't initialized\n"); + acpi_handle_err(handle, "Link isn't initialized\n"); return -1; } #ifdef FUTURE_USE @@ -712,10 +710,10 @@ int acpi_pci_link_free_irq(acpi_handle h static int acpi_pci_link_add(struct acpi_device *device, const struct acpi_device_id *not_used) { - int result; + acpi_handle handle = device->handle; struct acpi_pci_link *link; + int result; int i; - int found = 0; link = kzalloc(sizeof(struct acpi_pci_link), GFP_KERNEL); if (!link) @@ -734,31 +732,23 @@ static int acpi_pci_link_add(struct acpi /* query and set link->irq.active */ acpi_pci_link_get_current(link); - printk(KERN_INFO PREFIX "%s [%s] (IRQs", acpi_device_name(device), - acpi_device_bid(device)); + pr_info("Interrupt link %s configured for IRQ %d\n", + acpi_device_bid(device), link->irq.active); + for (i = 0; i < link->irq.possible_count; i++) { - if (link->irq.active == link->irq.possible[i]) { - printk(KERN_CONT " *%d", link->irq.possible[i]); - found = 1; - } else - printk(KERN_CONT " %d", link->irq.possible[i]); + if (link->irq.active != link->irq.possible[i]) + acpi_handle_debug(handle, "Possible IRQ %d\n", + link->irq.possible[i]); } - printk(KERN_CONT ")"); - - if (!found) - printk(KERN_CONT " *%d", link->irq.active); - if (!link->device->status.enabled) - printk(KERN_CONT ", disabled."); - - printk(KERN_CONT "\n"); + pr_info("Interrupt link %s disabled\n", acpi_device_bid(device)); list_add_tail(&link->list, &acpi_link_list); end: /* disable all links -- to be activated on use */ - acpi_evaluate_object(device->handle, "_DIS", NULL, NULL); + acpi_evaluate_object(handle, "_DIS", NULL, NULL); mutex_unlock(&acpi_link_lock); if (result)