Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4286303pxb; Mon, 8 Feb 2021 12:27:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJxE3kTM0aBztprfh7UW26AFg50Uk+GR6RFe2vlkcKFPbyLAgAfkCT0Pi6xAu8biUrYYHNm8 X-Received: by 2002:a17:906:f102:: with SMTP id gv2mr18531302ejb.47.1612816064833; Mon, 08 Feb 2021 12:27:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612816064; cv=none; d=google.com; s=arc-20160816; b=g6fCTBXkuqqsl+mEtMe7D7cBQGnHrKlkpvil1bcSLb2vOMmcBkpt0nRUqSgklV9IqD RfumQCfPuVb7F+i8Zs1g6XQtcA/qFYfrkjDWbF4gMo/Yod3XZI3MHhwiLBwN9nsw9KcX YoikQokDkje6Z6OWlBoS7sKt4jGQZQM81MPw8wtxlF7AgoeWlpkdwNQmU1hvCANlhKM4 tUYxiQsuBf9f5MBTRUHe/wpeTjYNKluUAcaOE0WF+W1w9NMU74TFREF1o1gU1SzcbZYd 2NY80wP3OUDMNhJKF/64lShUbsCbw+49JxHX2pHylPLowZGqMF87Ei4h5jWmAt+YHdlE BQbg== 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=9ZvK3oSp0zun844DjyL6qdDExNRnqzKNdtYPXti6XWc=; b=LV4GRcgPFwFHJVPOMCMQ41mqvqXnQuSghtDFptWMjVXDFpAdtV956uIEj+X3UCsc0X OjTtcShW0DeuVyEg+/KTP26Ay0CEZWnbfcKX+jLrNVVMyEoITmvinUyz/HMdz4DxIIfX bxuxCzzpJecygjRFTWpGgsFUrD7RMudhNuUfo/RM8bvfnollqqcsiqK2R3z1lY0BdxiZ z0SZeBAopdfQ5HTpAfIeGYkLw2OF2Pr7cKV3bCG7eQMdSDy8+6IELku1lFr5YXyPDSzf 1X1A9+YXzxfNT/UnR0ZdAVkQuSf8F2TORpm+nm4g45+Uq9kOpSimAa2Bn7q0jsJazgql n6jg== 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 x1si12486241eds.502.2021.02.08.12.27.21; Mon, 08 Feb 2021 12:27:44 -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 S233871AbhBHUZW (ORCPT + 99 others); Mon, 8 Feb 2021 15:25:22 -0500 Received: from cloudserver094114.home.pl ([79.96.170.134]:59452 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232418AbhBHTA7 (ORCPT ); Mon, 8 Feb 2021 14:00:59 -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 10aa2af35271feb9; Mon, 8 Feb 2021 20:00:06 +0100 Received: from kreacher.localnet (89-64-80-68.dynamic.chello.pl [89.64.80.68]) (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 67C476608B1; Mon, 8 Feb 2021 20:00:05 +0100 (CET) From: "Rafael J. Wysocki" To: Linux ACPI Cc: LKML , Hanjun Gou Subject: [PATCH v1 1/2] ACPI: OSL: Rework acpi_check_resource_conflict() Date: Mon, 08 Feb 2021 19:58:42 +0100 Message-ID: <4364959.MCEszuYnQi@kreacher> In-Reply-To: <4653881.kBYL0eE9gL@kreacher> References: <4653881.kBYL0eE9gL@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduledrheefgdduudelucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkjghfggfgtgesthfuredttddtvdenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpefgleehfffhtefflefhleetjeffteettefgteekjedvhfeffedtueefveegveeiveenucfkphepkeelrdeigedrkedtrdeikeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeekledrieegrdektddrieekpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhrtghpthhtoheplhhinhhugidqrggtphhisehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepghhouhhhrghnjhhunheshhhurgifvghirdgtohhm X-DCC--Metrics: v370.home.net.pl 1024; Body=3 Fuz1=3 Fuz2=3 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rafael J. Wysocki Rearrange the code in acpi_check_resource_conflict() so as to drop redundant checks and uneeded local variables from there and modify the messages printed by that function to be more concise and hopefully easier to understand. While at it, replace direct printk() usage with pr_*(). Signed-off-by: Rafael J. Wysocki --- drivers/acpi/osl.c | 38 ++++++++++++++------------------------ 1 file changed, 14 insertions(+), 24 deletions(-) Index: linux-pm/drivers/acpi/osl.c =================================================================== --- linux-pm.orig/drivers/acpi/osl.c +++ linux-pm/drivers/acpi/osl.c @@ -1458,38 +1458,28 @@ __setup("acpi_enforce_resources=", acpi_ int acpi_check_resource_conflict(const struct resource *res) { acpi_adr_space_type space_id; - acpi_size length; - u8 warn = 0; - int clash = 0; if (acpi_enforce_resources == ENFORCE_RESOURCES_NO) return 0; - if (!(res->flags & IORESOURCE_IO) && !(res->flags & IORESOURCE_MEM)) - return 0; if (res->flags & IORESOURCE_IO) space_id = ACPI_ADR_SPACE_SYSTEM_IO; - else + else if (res->flags & IORESOURCE_MEM) space_id = ACPI_ADR_SPACE_SYSTEM_MEMORY; + else + return 0; + + if (!acpi_check_address_range(space_id, res->start, resource_size(res), 1)) + return 0; + + pr_info("Resource conflict; ACPI support missing from driver?\n"); + + if (acpi_enforce_resources == ENFORCE_RESOURCES_STRICT) + return -EBUSY; + + if (acpi_enforce_resources == ENFORCE_RESOURCES_LAX) + pr_notice("Resource conflict: System may be unstable or behave erratically\n"); - length = resource_size(res); - if (acpi_enforce_resources != ENFORCE_RESOURCES_NO) - warn = 1; - clash = acpi_check_address_range(space_id, res->start, length, warn); - - if (clash) { - if (acpi_enforce_resources != ENFORCE_RESOURCES_NO) { - if (acpi_enforce_resources == ENFORCE_RESOURCES_LAX) - printk(KERN_NOTICE "ACPI: This conflict may" - " cause random problems and system" - " instability\n"); - printk(KERN_INFO "ACPI: If an ACPI driver is available" - " for this device, you should use it instead of" - " the native driver\n"); - } - if (acpi_enforce_resources == ENFORCE_RESOURCES_STRICT) - return -EBUSY; - } return 0; } EXPORT_SYMBOL(acpi_check_resource_conflict);