From patchwork Wed Nov 9 10:51:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 17464 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp266058wru; Wed, 9 Nov 2022 02:56:48 -0800 (PST) X-Google-Smtp-Source: AMsMyM75s+bQfk3CNLo1xlq7DSP1XZcgzNPR6Y8tH34XCmOvWBIw7lHIvfKKW9QOP6mYBe3mPkk8 X-Received: by 2002:a17:906:6681:b0:78d:d12c:7e96 with SMTP id z1-20020a170906668100b0078dd12c7e96mr1072508ejo.298.1667991408668; Wed, 09 Nov 2022 02:56:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667991408; cv=none; d=google.com; s=arc-20160816; b=I82Fhe4Owb+HMkOOHF2+wh0ZBF3eWicvoUGkbyCcJZzYWmYwbRbmvQHmOphoZiuufJ IyTBbZBRKSL2NjQSEpd8Dz0SFY9DSNYxB+G/yz9UJC4isoUthMLhRADAElUmvPT+Kd60 bJP7qScZQFcVaEbbBORVN7JE8bnmuNcmRdU4XaxwqoGXYSVNdrxP4F+TBrX+WDMmzxoQ 4DUkz9VcsQ3scUISBcVUEzGeVI5zpChE0UW0i9FViHBm0VESV6CZS+EXBAHywRhDkNLM iW0RPIaCjFPo7ByByE0Nx59atgJGCF+C6LksRDLAMYZ/eu5DQQu+is+YaQAcCqvp6Tu6 GB8Q== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=R+I++0HuXFf8ZpX4yVoAY7cb/0UVhpPty9cR9vw9cKM=; b=rE8Dm100TOfkqC73qjoYY17hWtC3kVuk9aPn2DvVGtixNETJFHqoK2VD7xglF13Pzp rwnSmYiz5nrM+hWrri/+si3Ytwlmga1NTr+Oz5U4pmLueaEc3RT9RI7G+GHA0FJE22g/ Ha0WeXxI1TJya+HJL5ZrayzGc+tAaI3u4AvFp7V6VldATdK7ruasNcM0PgL3nbQJ5oKM VznwpFkdUbr2dpw5rQSDvx99HTT0nq842UAEQa9oTg5r/pJysnVcf25TOGfL1iejmBwM JpYrjz+bo8xpFGCXYdfw4h7XECuCOLMVTU99HP6rzP9n1rH6wKVTq+O5jFBiW0MDmbu0 tw3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=e6oV0IHn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q5-20020aa7cc05000000b004612915d1a0si13557540edt.507.2022.11.09.02.56.24; Wed, 09 Nov 2022 02:56:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=e6oV0IHn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229877AbiKIKu7 (ORCPT + 99 others); Wed, 9 Nov 2022 05:50:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229690AbiKIKu5 (ORCPT ); Wed, 9 Nov 2022 05:50:57 -0500 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47349249; Wed, 9 Nov 2022 02:50:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667991056; x=1699527056; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=unCM/Qt3pgMcDj4CtsPmEJc8BHMjVTV5v1XWbrtVPsY=; b=e6oV0IHn8pWl8OVgka/QNakN/6CM7ohPLOHTNJUwRC+zrG4Bmxj7qVLq CxqQpEGX3yd7gNjs3uOW7gOj3oTaHrNgcHD9jcXoYSx1i9Bmedv3C6gkE A+gR5Zt1kQ4YidhdqaoNVTujzDTJ22TLfybXL2ZT9rfy9g8otmxh4PSR4 DWzJ8zpsBvFv8KJDBY5pH15VuylqsxC8sQtCnOuzC8ImrXkg9VIPAdxDX cNG5n42FTd9SOamzb+GyH1MUHO1BDRd+nbH9jS9HCZ5CyTBIPymgNBqXM GrzIh6gdDhmPLxFyXQiQ0X9nrf24hqszUigfE5NmbNUR3+U7L7fHLustV g==; X-IronPort-AV: E=McAfee;i="6500,9779,10525"; a="397239951" X-IronPort-AV: E=Sophos;i="5.96,150,1665471600"; d="scan'208";a="397239951" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Nov 2022 02:50:55 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10525"; a="779300605" X-IronPort-AV: E=Sophos;i="5.96,150,1665471600"; d="scan'208";a="779300605" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 09 Nov 2022 02:50:54 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 16570155; Wed, 9 Nov 2022 12:51:17 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , linux-kernel@vger.kernel.org Cc: "Rafael J. Wysocki" , linux-acpi@vger.kernel.org Subject: [PATCH v1 1/2] resource: Replace printk(KERN_WARNING) by pr_warn() Date: Wed, 9 Nov 2022 12:51:13 +0200 Message-Id: <20221109105114.32886-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749015759692754183?= X-GMAIL-MSGID: =?utf-8?q?1749015759692754183?= Replace printk(KERN_WARNING) by pr_warn(). While at it, use %pa for the resource_size_t variables. Signed-off-by: Andy Shevchenko --- kernel/resource.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/kernel/resource.c b/kernel/resource.c index 4c5e80b92f2f..ab32b015bd50 100644 --- a/kernel/resource.c +++ b/kernel/resource.c @@ -888,7 +888,7 @@ void insert_resource_expand_to_fit(struct resource *root, struct resource *new) if (conflict->end > new->end) new->end = conflict->end; - printk("Expanded resource %s due to conflict with %s\n", new->name, conflict->name); + pr_info("Expanded resource %s due to conflict with %s\n", new->name, conflict->name); } write_unlock(&resource_lock); } @@ -1283,9 +1283,7 @@ void __release_region(struct resource *parent, resource_size_t start, write_unlock(&resource_lock); - printk(KERN_WARNING "Trying to free nonexistent resource " - "<%016llx-%016llx>\n", (unsigned long long)start, - (unsigned long long)end); + pr_warn("Trying to free nonexistent resource <%pa-%pa>\n", &start, &end); } EXPORT_SYMBOL(__release_region); @@ -1658,6 +1656,7 @@ __setup("reserve=", reserve_setup); int iomem_map_sanity_check(resource_size_t addr, unsigned long size) { struct resource *p = &iomem_resource; + resource_size_t end = addr + size - 1; int err = 0; loff_t l; @@ -1667,12 +1666,12 @@ int iomem_map_sanity_check(resource_size_t addr, unsigned long size) * We can probably skip the resources without * IORESOURCE_IO attribute? */ - if (p->start >= addr + size) + if (p->start > end) continue; if (p->end < addr) continue; if (PFN_DOWN(p->start) <= PFN_DOWN(addr) && - PFN_DOWN(p->end) >= PFN_DOWN(addr + size - 1)) + PFN_DOWN(p->end) >= PFN_DOWN(end)) continue; /* * if a resource is "BUSY", it's not a hardware resource @@ -1683,10 +1682,8 @@ int iomem_map_sanity_check(resource_size_t addr, unsigned long size) if (p->flags & IORESOURCE_BUSY) continue; - printk(KERN_WARNING "resource sanity check: requesting [mem %#010llx-%#010llx], which spans more than %s %pR\n", - (unsigned long long)addr, - (unsigned long long)(addr + size - 1), - p->name, p); + pr_warn("resource sanity check: requesting [mem %pa-%pa], which spans more than %s %pR\n", + &addr, &end, p->name, p); err = -1; break; } From patchwork Wed Nov 9 10:51:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 17463 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp266045wru; Wed, 9 Nov 2022 02:56:47 -0800 (PST) X-Google-Smtp-Source: AA0mqf41OTI3oLB4MRheynR9ODP2lYP7QIY9USmaFPTRomQKf/Vkors8pFVIhbmovdwZy/npYnPe X-Received: by 2002:a05:6402:27d2:b0:462:8e41:569c with SMTP id c18-20020a05640227d200b004628e41569cmr18592404ede.191.1667991406793; Wed, 09 Nov 2022 02:56:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667991406; cv=none; d=google.com; s=arc-20160816; b=cBs1Ri/bWsjAHKW2f7fueaGlaQRHYz3LN4d5DNnsH88HwjuHfgw1tYgrw2Qp+72m4F rdSZxBPcv1uuokJJWu8vWEycHNPi5RSSvoBBfMvSF1mztjc3kt444jg7ttHcnsJGoXvJ PaoFrMJbKzOrjN8tUXGVMQcAen9tYWeP3IWCMTHUeC7V/g1YXy6n2Rk8/CpMo4z0StRC 6LPNlRbDJJTkcB+vlZ9YIskxGCM6bu9CaYaIdyo75DN2gHP6JvT+W0mf4hwt0bGOafMz a5eukqryDoyjGbgPoSvjPtFMYUrrN59tqE5uFWaU9Mhe3eePAdDIIHijmVS1voSidVHz iVFQ== 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 :dkim-signature; bh=ORkq1h/bhMRD/y017ZUL0ZAV09WhGTpaaJQ2FPwBuck=; b=L3YLPp9swFA5QJZnPFfLSkWPZatAZt5RRWWtkKpb9jRBx0HrRRsZtCOMAK60jL4mZ/ aEGsCosJOIz76s45XV5/mMAtthJOqVe5DrZm7iNpEWqejjjF74jRqqThRoJF/Nn3A3lG UuycDMpHuMMfxA2KzuuxrKVdicbaU1AIPQilLdxHFwXUqaZfoiI5lLFQ9riqzkkF8R8u 5m/kN87SPQX9sD8jjeqy7cyPOweltn5jDh8cHunyPIrC9rWgWHkt6S3LlxeXxlgiG/zr o50xg4QWhUZdBUyLohKLO+jGctrdOfOkRsDtj1ZBKcjRVYy3P117KwthKPFbbMb+sDJs 1gpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=BWL0Td7V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cy1-20020a0564021c8100b00459060fcde3si13747510edb.202.2022.11.09.02.56.23; Wed, 09 Nov 2022 02:56:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=BWL0Td7V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229667AbiKIKu5 (ORCPT + 99 others); Wed, 9 Nov 2022 05:50:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229526AbiKIKu4 (ORCPT ); Wed, 9 Nov 2022 05:50:56 -0500 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8133F1E9; Wed, 9 Nov 2022 02:50:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667991055; x=1699527055; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=LWNcWECinfMb+fcqwO/G8pIM6Y4hWmoQNoCDj4j5org=; b=BWL0Td7VKFUcNfGwitgBM3dAnjrbkc1YqD9wraqd7/cBACrIx+DjBYmj dSEBNZe7GTw96PIoVXS4XY2nNDNowhn5t7uHJMpqtSKORTb3Dq71cuiID z0vkVzlWs0eYkYHZAn+eegC+/8a3mUGqYe+p1Xtm6U/ZOhGc1aKBF1ymy fbxgH2xSn7FwXH3BhkHWEKdkoC+6W2cQP5Dp+xUwoJTiCK4OPnVbz2ieO LqFiPHE0tGjmlIDBfSJSEJFk0tMqBU+u4SJNzeRkPOmeKU8rj4XM7bRAC L6tayQb+ta3DoGZ5r+OurGkC3rqr1gUzB6yFvIw/U5hamzscb2W8mkU94 A==; X-IronPort-AV: E=McAfee;i="6500,9779,10525"; a="397239950" X-IronPort-AV: E=Sophos;i="5.96,150,1665471600"; d="scan'208";a="397239950" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Nov 2022 02:50:55 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10525"; a="779300606" X-IronPort-AV: E=Sophos;i="5.96,150,1665471600"; d="scan'208";a="779300606" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 09 Nov 2022 02:50:54 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 25BBDF7; Wed, 9 Nov 2022 12:51:18 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , linux-kernel@vger.kernel.org Cc: "Rafael J. Wysocki" , linux-acpi@vger.kernel.org Subject: [PATCH v1 2/2] resource: Convert DEFINE_RES_NAMED() to be compound literal Date: Wed, 9 Nov 2022 12:51:14 +0200 Message-Id: <20221109105114.32886-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221109105114.32886-1-andriy.shevchenko@linux.intel.com> References: <20221109105114.32886-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749015757645812497?= X-GMAIL-MSGID: =?utf-8?q?1749015757645812497?= Currently DEFINE_RES_NAMED() can only be used to fill the static data. In some cases it would be convenient to use it as right value in the assignment operation. But it can't be done as is, because compiler has no clue about the data layout. Converting it to be a compound literal allows the above mentioned usage. Signed-off-by: Andy Shevchenko Reviewed-by: Rafael J. Wysocki --- include/linux/ioport.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/ioport.h b/include/linux/ioport.h index 27642ca15d93..67d3fb2133b6 100644 --- a/include/linux/ioport.h +++ b/include/linux/ioport.h @@ -155,7 +155,7 @@ enum { /* helpers to define resources */ #define DEFINE_RES_NAMED(_start, _size, _name, _flags) \ - { \ +(struct resource) { \ .start = (_start), \ .end = (_start) + (_size) - 1, \ .name = (_name), \