Message ID | 20230804082619.61833-4-andriy.shevchenko@linux.intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:44a:b0:3f2:4152:657d with SMTP id ez10csp151888vqb; Fri, 4 Aug 2023 03:04:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGzL+zJxaic6V71pR8lHXofT3HLgyGEq9ndKtV6NLjyImEod8CCqHkeES9PFjaaPXoF9t90 X-Received: by 2002:a05:6512:3685:b0:4f8:5886:186d with SMTP id d5-20020a056512368500b004f85886186dmr862313lfs.9.1691143453110; Fri, 04 Aug 2023 03:04:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691143453; cv=none; d=google.com; s=arc-20160816; b=lzkLvikEWU6rWZOpBfb+VYP0ctRtzjEU7cvwJ3OyI0KezzZNmnmFNYUCqDV3L/OaJM NzWappt1TLEmixDUgWwQ6sWd8lY4WG/nv8AoeiCaqUF/so/LU54g84QxudXhL9TIU3Np 5VYi5rJlgUahbY4rdV0jehGgcRr46Q85+MczcBG5lXkNomPBHegKua+0+q/EoztTjihg HgVy/P8nUJ7jKApASoAlVY5sgcZvooGxE0B89D4P5qmgFvd7YchRgBjY+A9oD2AUBjgr QDJ50hCPArvNi50SNUO3boodU/ADxPO/pDCy62VRc6PSKvua+uuvjbXv4rCLra1pg+Bp Anew== 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=LiQZHN/gFI7kOzFyx0EOhyFHwRC/sfDcBQ2mnTPX6fM=; fh=ubSGe9Pf/KxTId9rGYzy0xYsiY5Gj5OI3uWYUzuWZkk=; b=mi+3F4KoQs/aCIGyTmJjbA62MLci+r0FJMJ6UyzixEz2Jp6SiTtQR1/B4CZGJSJV5w m03BcptEseCo0xudpn8qb/wMgJQFtM9yA3hIaBgq9H0QmxxfYsotiuEv2RsNGBiGNvUd WDBYKXVNKZHCQhFHF9lUMg9B7oxiJKzgBE8HaXfERhqGu8ilLorDCxlXPXLvjDS/rLpg YGRLJg3bgzI1XiF9ZoBkUh2+dSk+N1mT4HJK0qaYjUslEH8e7VvqAO087CaQ7/xfeeX9 byDU+IEnSOFlB6QcV5HQSRYBjvvESqlgDTq4f9vXN8lyHLmIj1YkW1pV5YezeREEbIpg U5Vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=LK86CKOJ; 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 mj11-20020a170906af8b00b0099ca6e1b1f1si449929ejb.1055.2023.08.04.03.03.34; Fri, 04 Aug 2023 03:04:13 -0700 (PDT) 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=LK86CKOJ; 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 S234678AbjHDI0z (ORCPT <rfc822;sukrut.bellary@gmail.com> + 99 others); Fri, 4 Aug 2023 04:26:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234565AbjHDI02 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 4 Aug 2023 04:26:28 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E38A4698 for <linux-kernel@vger.kernel.org>; Fri, 4 Aug 2023 01:26:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1691137587; x=1722673587; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GrsynOg2xgorKiT0iE4UnCXSWHQ9xboHF2x1Jg9/Yuk=; b=LK86CKOJjzgIs5ylME9YVbqixUVTCj0xjeCMI2JA8KO7IbMutQW9YNiC QeHxkHvpxAGwxweQCVtdIdGMmZQoEOFrkImhi5DY12Wx0NXK4l/U4mfu7 XJhirmGYD1mmRfEbRHp3jOMqpu3IOHpCPc/XYeIiPDAKmGnFaKqRxlCZf JWe+OjPeX2gE8x2KNT0c616SCEzemPAIV3+U0W9zUAJsUeZm1di9S8fyf h+21KmupxrB9B1TAs76ijYlHTKySjNqSxPIDtQz4bK0ARA9cyPtKn/95I yr1Tf8J7MEBIsmIFIdxbeCF8peZQfOerS7ZJBS4FBNxfaGTCc4ua82xmS A==; X-IronPort-AV: E=McAfee;i="6600,9927,10791"; a="433952161" X-IronPort-AV: E=Sophos;i="6.01,254,1684825200"; d="scan'208";a="433952161" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Aug 2023 01:26:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10791"; a="706907757" X-IronPort-AV: E=Sophos;i="6.01,254,1684825200"; d="scan'208";a="706907757" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga006.jf.intel.com with ESMTP; 04 Aug 2023 01:26:21 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 8F3DF1341; Fri, 4 Aug 2023 11:26:32 +0300 (EEST) From: Andy Shevchenko <andriy.shevchenko@linux.intel.com> To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>, Marco Elver <elver@google.com>, linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, linux-mm@kvack.org Cc: Petr Mladek <pmladek@suse.com>, Steven Rostedt <rostedt@goodmis.org>, Rasmus Villemoes <linux@rasmusvillemoes.dk>, Sergey Senozhatsky <senozhatsky@chromium.org>, Alexander Potapenko <glider@google.com>, Dmitry Vyukov <dvyukov@google.com>, Andrew Morton <akpm@linux-foundation.org> Subject: [PATCH v1 3/4] lib/vsprintf: Remove implied inclusions Date: Fri, 4 Aug 2023 11:26:18 +0300 Message-Id: <20230804082619.61833-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20230804082619.61833-1-andriy.shevchenko@linux.intel.com> References: <20230804082619.61833-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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,URIBL_BLOCKED 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773292437421554882 X-GMAIL-MSGID: 1773292437421554882 |
Series | lib/vsprintf: Rework header inclusions | |
Commit Message
Andy Shevchenko
Aug. 4, 2023, 8:26 a.m. UTC
Remove inclusions that are implied and guaranteed to be provided by others:
compiler.h by types.h
string.hi by string_helpers.h
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
lib/vsprintf.c | 2 --
1 file changed, 2 deletions(-)
Comments
On 04/08/2023 10.26, Andy Shevchenko wrote: > Remove inclusions that are implied and guaranteed to be provided by others: > > compiler.h by types.h > string.hi by string_helpers.h What? No. That's not what we want. Each .c and each .h file should include the headers that declare the stuff they're using. So if string_helpers.h magically stops referring to anything from string.h, one should be allowed to stop including string.h from string_helpers.h. Sure, those two may forever be so intertwined that it never happens, but one really can't maintain some matrix of "X always includes Y so if you include X you don't have to include Y" in one's head. Rasmus
On Fri, Aug 04, 2023 at 11:36:15AM +0200, Rasmus Villemoes wrote: > On 04/08/2023 10.26, Andy Shevchenko wrote: > > Remove inclusions that are implied and guaranteed to be provided by others: > > > > compiler.h by types.h > > string.hi by string_helpers.h > > What? No. That's not what we want. Each .c and each .h file should > include the headers that declare the stuff they're using. 99.99% of kernel if not more doesn't follow this rule pedantically. We have to have a compromise between what is guaranteed and what is not. For example, I'm pretty sure the types.h will always include compiler*.h. > So if string_helpers.h magically stops referring to anything from string.h, > one should be allowed to stop including string.h from string_helpers.h. That's how agreements work. We may agree to guarantee such inclusion or not. The kernel headers as of today is a complete mess (refer to the Ingo's 2k+ patch series). But still, some order / agreement is good to have. > Sure, those two may forever be so intertwined that it never happens, but > one really can't maintain some matrix of "X always includes Y so if you > include X you don't have to include Y" in one's head. Somebody should do that at some point, otherwise it becomes even more mess. If you want your way, iwyu should be part of the kernel build. And be prepared for dozens of headers to be added to the every single C file in the kernel.
diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 63afffab4249..eb0934d02722 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -20,7 +20,6 @@ #include <linux/build_bug.h> #include <linux/clk.h> #include <linux/clk-provider.h> -#include <linux/compiler.h> #include <linux/cred.h> #include <linux/ctype.h> #include <linux/dcache.h> @@ -36,7 +35,6 @@ #include <linux/rtc.h> #include <linux/siphash.h> #include <linux/stdarg.h> -#include <linux/string.h> #include <linux/string_helpers.h> #include <linux/time.h> #include <linux/types.h>