From patchwork Wed Nov 9 15:56:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 17642 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp421069wru; Wed, 9 Nov 2022 08:08:06 -0800 (PST) X-Google-Smtp-Source: AMsMyM4ePTVVIaRhbQkLGfQGgGRP6u9TmbK2AlEZDurG8HhNn2C1oATlJCLyl2kxzQh/80ZzOMRf X-Received: by 2002:a17:907:3fa7:b0:7ad:e0cf:417d with SMTP id hr39-20020a1709073fa700b007ade0cf417dmr44554499ejc.577.1668010086530; Wed, 09 Nov 2022 08:08:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668010086; cv=none; d=google.com; s=arc-20160816; b=NpBK+xUuDtTWcamzoh1NYphtCQoQvCO83Psrt/hBUcIUqkbv6olukmMucVO1d0IQny V02kHxe7cRbpM6UCapI9vrQ3g4mFlSX6R8fLG5y7hqK3+zYBzAFsYFygbIZPFsQ7vr0O r9L7SLMcQ5amO+AkN/cAIC6wLEzYf7kfb+oZ8Uzy1pAt0itwg+T7CX4d+XL1T4GjoRwW 9ogD9WIkRq7akCFhJD9srlyztYvT4Ee9OoFxiirqi9ucxQftpVDeSfSHrQkjWeZCQ5jF pmdzm1Dp2yzhicw5HtFa30sDjIKLVg3QcK/znbhdnRcbmvfmAxymcsTvnA/K1nSEonDA fwMQ== 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=tt6gdOk3KghTLGgUBVp+szywjgo+833rZY5GFK52cFg=; b=OgelmCBgoz7aGAtAzZLbf9N6/EsFDnXsCsAM8ulmGV6EE9MW+urwNs+OoZo1aHvhcA GeYLqyRAcU0ZX1GUHv2ElofTaYHEgpWMktm67LbBOGGgEgYqgUHxhAvCYbXdsnkbcTTG rVVfRTaQtr1mJBicD0+SE8M3ZajHtwj1xQasZLb7iR1+FXe2hL9aaHVi+bufPFEpLdzW Ax950zXmJbr/Z4w11dFIkiOOoQ8V9h3WY7M0A5XDFroNwfJutqFKxavurqtg6qUXUTmQ /KZeprPFNi51Xkk/UUceIKIFv1bs7PzgmctO1S3BEeggvR5kap8Heyf4bUgiLK0pv95B 3f8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=IGYdAGIs; 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 x9-20020a05640226c900b0046013b7e7efsi18606326edd.631.2022.11.09.08.07.35; Wed, 09 Nov 2022 08:08:06 -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=IGYdAGIs; 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 S230397AbiKIP4A (ORCPT + 99 others); Wed, 9 Nov 2022 10:56:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230109AbiKIPz7 (ORCPT ); Wed, 9 Nov 2022 10:55:59 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 841491D674 for ; Wed, 9 Nov 2022 07:55:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668009358; x=1699545358; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=houP/G39k9nKc21+XB8opbGw93N1dUcYvVlSmSR6tAo=; b=IGYdAGIsI9z97yCXMAMYNyLu18kDUIBhCPuAIe4oza6a3BUGop81lWVq 2E1SLwltpgN+CsluOegcUKBhAv0ExnJWDPEUwheWykp3u8vJ+zgw2Zbk/ E5MVRo9MxsMA6oiOsk4x7+kayR/6ZImadQrMl3e+gXAtYB50qvA1pUea1 3jWgmB27EeLKWtj2ZoLWuh6FSmqgp+HEtpATQHTsC3kpiMt7vmO0IUh5w b5oWmhuF02iIYy96FUxFatC98ANnjYx9+TX2ujHi5gdPZJ7ctBaU2Tao+ yGt+g7BlgnlTR1yGUO6rjSer0S+Atspv6s7SXgAvbpDB3ZEzuUtFoVYlK Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10526"; a="308632794" X-IronPort-AV: E=Sophos;i="5.96,151,1665471600"; d="scan'208";a="308632794" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Nov 2022 07:55:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10526"; a="881974115" X-IronPort-AV: E=Sophos;i="5.96,151,1665471600"; d="scan'208";a="881974115" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga006.fm.intel.com with ESMTP; 09 Nov 2022 07:55:56 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id ADE60155; Wed, 9 Nov 2022 17:56:20 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , linux-kernel@vger.kernel.org Cc: "Rafael J. Wysocki" , Greg Kroah-Hartman Subject: [PATCH v2 1/2] resource: Replace printk(KERN_WARNING) by pr_warn(), printk() by pr_info() Date: Wed, 9 Nov 2022 17:56:17 +0200 Message-Id: <20221109155618.42276-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,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?1749035344453812961?= X-GMAIL-MSGID: =?utf-8?q?1749035344453812961?= Replace printk(KERN_WARNING) by pr_warn() and printk() by pr_info(). While at it, use %pa for the resource_size_t variables. With that, for the sake of consistency, introduce a temporary variable for the end address in iomem_map_sanity_check() like it's done in another function in the same module. Signed-off-by: Andy Shevchenko Reviewed-by: Rafael J. Wysocki --- v2: updated changelog (Rafael), Cc'ed to Greg (Rafael) 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 15:56:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 17640 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp419787wru; Wed, 9 Nov 2022 08:06:11 -0800 (PST) X-Google-Smtp-Source: AMsMyM4pNd4Tj0KhVaGjkWi4+aGTwVlGNcuXE4e8KoeFlDgaIdsrfPF52ryQok3agWWMPr/KV6DN X-Received: by 2002:a17:902:e74a:b0:186:a094:1d3 with SMTP id p10-20020a170902e74a00b00186a09401d3mr59664902plf.153.1668009971362; Wed, 09 Nov 2022 08:06:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668009971; cv=none; d=google.com; s=arc-20160816; b=wf9J9LVtsdpOVgUAajOf0Cz7IXXOHOOGW+ux/AmrThbLXTGR8PLAjae9s9nudJWO6z 2rA5XuUuXzVX/2ODigTlnAW40RsbA6XxsM18dr2upbegWpTD8UPSkoWNWoVaVEoShYv7 j583TggPOAbMEdZ5MFfgpMIaD8PfPTbp5wC8j5B2MFLj9/nZiHHu/sLUv6maC5/LzBpY 7p0tkkKst94hrxu9zc67msr7rJzdqxHNudKybczdnfhBF9gr1RwX9BBAXzh3y1EfUmRV eY3muP1ydUf70AYiME4CGlmjXD1IjRGmf2FUjTji49KKEkc9ggaAWOH+ZxcmSBEdBQem jJgg== 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=XMOwcud1shom6Eh15LCojDDudIbY7ZykDV6p7HhfbcU=; b=KazyGg4+sWV9XBk/CkHs2mKfpPNnesERO6O4HitywiXQCqGLdPiM2CrXbcwk/E/Efh V5BMrFLvgGyLYBKGw2KdtW9w6/zafxi5sKwKhv1m4RGbomKmP/cmVRBMsWszBTGu3Wxa rto/WuwUuGVE8PHVrV07cwM7ep3A2A1Qt29W1C2jtek/ssuB/iafIVCRTf+FX9csoVOA RCjWzoLHnK36eVA5eWKb2pwOEfEyCNwNVPVh9zycXxqjT6PNF6MG4OesTohoBL/QGwY5 sQN8IAeQ7MPjsogX0I16WBky0zTSo6CSi2nnbRkEfJ4qnh0WgncUuLJfBi4Nu9kFtBGV tCFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=klldGz6w; 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 e9-20020a636909000000b0046effafcc4esi15442029pgc.797.2022.11.09.08.05.35; Wed, 09 Nov 2022 08:06:11 -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=klldGz6w; 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 S231183AbiKIP4C (ORCPT + 99 others); Wed, 9 Nov 2022 10:56:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231149AbiKIP4A (ORCPT ); Wed, 9 Nov 2022 10:56:00 -0500 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E226118E09 for ; Wed, 9 Nov 2022 07:55:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668009359; x=1699545359; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=eKtwWKYMTJ/eexktXqAdzMQnTSitnr28Dw+XVlTyufw=; b=klldGz6wR8V1oJX2wlVjtXQbNxQlskqL6h13fAa1iB1rME/bO2Mqsapu fH63m+08ImerqRGMII84xTfzGQ1Ro8h2irFkrsS5EngjmxQ793uspcIRW 6MUSuknFtXBYIevb+NwFSQKQp/yAz/H9Mg861z4KTDE/eyufX6wKhcc/a 6z1Ew9aCv8erqh7Aonaao880eE/64faT1hSer79XVEMuRoMy8SZyqcsbv 0bFc25hAIFhxzcTZeqDNIwryfDaVhBNdrKV6B9d+hDne180F/A4QNWlI8 06FiNh9oJN9rrYgx4cK7VaNA+xSDqT0y7fK6z2l37hNd5FOhrTunG/jDa Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10526"; a="397308201" X-IronPort-AV: E=Sophos;i="5.96,151,1665471600"; d="scan'208";a="397308201" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Nov 2022 07:55:59 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10526"; a="631293196" X-IronPort-AV: E=Sophos;i="5.96,151,1665471600"; d="scan'208";a="631293196" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga007.jf.intel.com with ESMTP; 09 Nov 2022 07:55:57 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id A974015C; Wed, 9 Nov 2022 17:56:21 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , linux-kernel@vger.kernel.org Cc: "Rafael J. Wysocki" , Greg Kroah-Hartman Subject: [PATCH v2 2/2] resource: Convert DEFINE_RES_NAMED() to be compound literal Date: Wed, 9 Nov 2022 17:56:18 +0200 Message-Id: <20221109155618.42276-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221109155618.42276-1-andriy.shevchenko@linux.intel.com> References: <20221109155618.42276-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?1749035223949540270?= X-GMAIL-MSGID: =?utf-8?q?1749035223949540270?= 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 --- v2: added tag (Rafael), Cc'ed to Greg (Rafael) 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), \