Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp69044pxb; Tue, 5 Oct 2021 23:34:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyi5AdDolq1YlmrApv0/8U3bZX/4lAD3eBBWa8z+4iQu7PbraHwAmVUCx4OiSLanzINaxgJ X-Received: by 2002:a50:be87:: with SMTP id b7mr33141387edk.382.1633502062420; Tue, 05 Oct 2021 23:34:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633502062; cv=none; d=google.com; s=arc-20160816; b=JOe5E1FNkkP/Ok2K7Ecl5ZeTKuj19FK2tYGY5f7tjdDLDiqyY7CUSxZG1hnTCwjfjy kinNN+d21jcZZTqwseS1+KEgPYbN2POmYoAjvDfRB3S9tK6gGIbJYqaYFWdcNnJGqZJL pfOLE1oFmjujCjVLMiyKvk2AhyOCY+OL+IKrJo0stOR9DKTGWE6SFY465zWOh8NBATOD 7dGx3IwpeT8MrJSM0YAi/0vy+ZxAnToF2PGAk1zO97vgtYEZd2n3mjaZKtHWC5GQ06yV y8TZus4inXiyjNzz17O9utBt9nELtY3twlMhU8YFJuxsGx2yt7ww0DlnGuPa5fjRCnRd CjeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=btHubqNJOewx60vTpseGV+0nCMN5aB7RO/7+L5BkfGo=; b=BVN0kdJdcvpSvo3xe1X5Gjy8bBjmfm6p1lfZrxGbrlGsv0Xpn0M+DuA0MfGEnubzf3 pn5XmjWop7ilGKcdodGorKEoyv455abmulRNqPh898n1oeqOiIHLFgh5Jn9M8b6IpxWh EqlaEKaTZvNyov+2m1mopu9PynfsBVvb4xigP1WCYLoSKqYeY4TJtL0jgQVxiJLe7EJY M3uRcYky7a6YQGSnGxUFdZSRX50n4UPRmCMz14+3bBMXZuWvaQJrEEnctlaaxqUyQPqS YCtpVkPsk4I3EycsGnxbbiq8PbCvcR38euVvPHVEQl/UURlK177FhcZJV+NfQyxRK7Ks l4Fg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 1si6998730ejn.101.2021.10.05.23.33.58; Tue, 05 Oct 2021 23:34:22 -0700 (PDT) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230134AbhJFGcY (ORCPT + 99 others); Wed, 6 Oct 2021 02:32:24 -0400 Received: from mga07.intel.com ([134.134.136.100]:36775 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229956AbhJFGcV (ORCPT ); Wed, 6 Oct 2021 02:32:21 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10128"; a="289429915" X-IronPort-AV: E=Sophos;i="5.85,350,1624345200"; d="scan'208";a="289429915" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2021 23:30:29 -0700 X-IronPort-AV: E=Sophos;i="5.85,350,1624345200"; d="scan'208";a="484034646" Received: from pwali-mobl1.amr.corp.intel.com (HELO ldmartin-desk2) ([10.213.170.68]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2021 23:30:29 -0700 Date: Tue, 5 Oct 2021 23:30:29 -0700 From: Lucas De Marchi To: Andy Shevchenko Cc: "linux-kernel@vger.kernel.org" , Andrew Morton , Andy Shevchenko Subject: Re: [PATCH] lib/string_helpers: add linux/string.h for strlen() Message-ID: <20211006063029.owhu5hjtaivib5d5@ldmartin-desk2> X-Patchwork-Hint: comment References: <20211005212634.3223113-1-lucas.demarchi@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 06, 2021 at 08:57:27AM +0300, Andy Shevchenko wrote: >On Wednesday, October 6, 2021, Lucas De Marchi >wrote: > >> linux/string_helpers.h uses strlen(), so include the correpondent >> header. Otherwise we get a compilation error if it's not also included >> by whoever included the helper. >> >> Signed-off-by: Lucas De Marchi >> --- >> include/linux/string_helpers.h | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/include/linux/string_helpers.h b/include/linux/string_ >> helpers.h >> index 68189c4a2eb1..4ba39e1403b2 100644 >> --- a/include/linux/string_helpers.h >> +++ b/include/linux/string_helpers.h >> @@ -4,6 +4,7 @@ >> >> #include >> #include >> +#include >> #include > > >I’m afraid this potentially can add into header dependencies hell. What >about moving the user to the C file? I can do that, but I don't see the problem here... afaics it has been like this for 7 years, since commit c8250381c827 ("lib / string_helpers: introduce string_escape_mem()"), and the only way it was never borken is because linux/string.h is already being indirectly included from other headers. So just adding it here is harmless. I reproduced this while following the normal header order in i915 and adding linux/string_helpers.h like this: diff --git a/drivers/gpu/drm/i915/display/intel_display_debugfs.c b/drivers/gpu/drm/i915/display/intel_display_debugfs.c index 309d74fd86ce..1dfc01617258 100644 --- a/drivers/gpu/drm/i915/display/intel_display_debugfs.c +++ b/drivers/gpu/drm/i915/display/intel_display_debugfs.c @@ -3,6 +3,8 @@ * Copyright © 2020 Intel Corporation */ +#include + #include #include Note that this became the first header included, producing the following error: make -j$(nproc) drivers/gpu/drm/i915/display/intel_display_debugfs.o DESCEND objtool CALL scripts/atomic/check-atomics.sh CALL scripts/checksyscalls.sh CC [M] drivers/gpu/drm/i915/display/intel_display_debugfs.o In file included from drivers/gpu/drm/i915/display/intel_display_debugfs.c:6: ./include/linux/string_helpers.h: In function ‘string_escape_str’: ./include/linux/string_helpers.h:75:32: error: implicit declaration of function ‘strlen’ [-Werror=implicit-function-declaration] 75 | return string_escape_mem(src, strlen(src), dst, sz, flags, only); | ^~~~~~ ./include/linux/string_helpers.h:75:32: error: incompatible implicit declaration of built-in function ‘strlen’ [-Werror] ./include/linux/string_helpers.h:7:1: note: include ‘’ or provide a declaration of ‘strlen’ 6 | #include +++ |+#include 7 | #include cc1: all warnings being treated as errors Anyway, if it's preferable to move these functions out of line, I can do so. thanks Lucas De Marchi > > >> >> struct file; >> -- >> 2.33.0 >> >> > >-- >With Best Regards, >Andy Shevchenko