From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22DC1C433DF for ; Wed, 26 Aug 2020 16:52:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DFEB42078D for ; Wed, 26 Aug 2020 16:52:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598460775; bh=BomWlpD0mGAvpFUVz/brmOr64Y92gFzTpqDzQk4KDxo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=CVwkwQT4urOOEtkAE1e0O5KR8hqGUYhEqF8nQD6KtK23dpyqu1h6snrCkDkQX8lzG NdtBSJLbCEGIeUY4Ww+SMtzkpI8066gBFBZhXHnjwbypeNIbPeduY9Z84SyilT6JUT 8DRPQV29X0OiMRdf5eF1ag4Q3xztrkpVwXZOqtHk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727790AbgHZQwz (ORCPT ); Wed, 26 Aug 2020 12:52:55 -0400 Received: from mail-ej1-f66.google.com ([209.85.218.66]:45048 "EHLO mail-ej1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726739AbgHZQww (ORCPT ); Wed, 26 Aug 2020 12:52:52 -0400 Received: by mail-ej1-f66.google.com with SMTP id bo3so3788527ejb.11; Wed, 26 Aug 2020 09:52:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=f3SjKHg0rc/Hi94wKGeK4sTEIeweZxxU2pp3miD2U7w=; b=fw7+bH7AiRhwXjq5tfTImHCJPfa+iMv2NbgB0cFIh1y8lFXKapBDUFm5fXQNsJGlJj 5DXxGyaezcySLqGq8GHC8LJLLaqbE6C/aeCXfXka5mYXJ1QGn2VRKPuSZdUj3M6SXRF6 W1TBlka4AXnyAX74NdyrDDdgZuUn6hNrwO8xfKNBQEhdqvE7QTXDqJdocBsW3hPmVP6b MMGEE2p2VxiAO7kgtGOBwCSl9ZzTN0vlra+xY/dxBjwtyISYXgUiAovTDrORcrHDU/GV 6mR3S+5Ct4w7Fx4tcjt4QXFl6jh1bwj4u6fpwmViuqJTfhxzez6jd2bULogNxJC316Qj PkTA== X-Gm-Message-State: AOAM531Kyf8RS73pCksdr2lqiLQ2R+Ek5GFFOh/rK7OAph9jtFsHtOK2 2efYRXJnX9pIy1U7qUE9Lqk= X-Google-Smtp-Source: ABdhPJx8z7paHiBU5Vqit+UaxQDuL7FcpAQaf80dIweI/Cw+HnrnkKZ/d1NlwB9sHxh0qTew9unJQQ== X-Received: by 2002:a17:906:b09a:: with SMTP id x26mr2766990ejy.162.1598460769603; Wed, 26 Aug 2020 09:52:49 -0700 (PDT) Received: from kozik-lap ([194.230.155.216]) by smtp.googlemail.com with ESMTPSA id d2sm2656101ejm.19.2020.08.26.09.52.48 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 Aug 2020 09:52:49 -0700 (PDT) Date: Wed, 26 Aug 2020 18:52:46 +0200 From: Krzysztof Kozlowski To: Lukasz Stelmach Cc: "David S. Miller" , Jakub Kicinski , Kukjin Kim , Rob Herring , Russell King , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, m.szyprowski@samsung.com, b.zolnierkie@samsung.com Subject: Re: [PATCH 1/3] net: ax88796c: ASIX AX88796C SPI Ethernet Adapter Driver Message-ID: <20200826165246.GA29212@kozik-lap> References: <20200825184413.GA2693@kozik-lap> <20200826164533.GC31748@kozik-lap> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200826164533.GC31748@kozik-lap> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org On Wed, Aug 26, 2020 at 06:45:33PM +0200, Krzysztof Kozlowski wrote: > On Wed, Aug 26, 2020 at 04:59:09PM +0200, Lukasz Stelmach wrote: > >> +#include > > >> +#endif > > >> +#include > > >> +#include > > >> +#include > > >> +#include > > >> +#include > > >> +#include > > >> +#include > > >> +#include > > >> +#include > > >> +#include > > >> +#include > > >> +#include > > >> +#include > > >> +#include > > >> +#include > > >> +#include > > >> +#include > > >> +#include > > > > > > All of these should be removed except the headers used directly in this > > > header. > > > > > > > This is "private" header file included in all ax88796c_*.c files and > > these are headers required in them. It seems more conveninet to have > > them all listed in one place. What is the reason to do otherwise? > > Because: > 1. The header is included in other files (more than one) so each other > compilation unit will include all these headers, while not all of them > need. This has a performance penalty during preprocessing. > > 2. You will loose the track which headers are needed, which are not. We > tend to keep it local, which means each compilation unit includes stuff > it needs. This helps removing obsolete includes later. > > 3. Otherwise you could make one header, including all headers of Linux, > and then include this one header in each of C files. One to rule them > all. ... and I got one more: 4. Drivers sometimes get reused, extended or they parts got reused. If a header includes more stuff, it simply will pollute all other units trying to reuse it... making the re-usage difficult. This is less likely reason, I mean, quite imaginary for this particular driver. I don't expect pieces of this driver to be reused... but who knows. Many times in the past in the kernel there was a huge work rewriting headers in many files, because something was including something else and we wanted to decouple these things. Therefore following the pattern - include stuff you explicitly use - helps in every case. Best regards, Krzysztof From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 838F4C433DF for ; Wed, 26 Aug 2020 16:54:27 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4F29D2078B for ; Wed, 26 Aug 2020 16:54:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="NwuivMJM" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4F29D2078B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=OPtF3DuwJgxrgZ6XwW1cwLlU+5YrqTTAWJDaK3xP/zg=; b=NwuivMJM4h+dZLTWzv9TsIfZT PlMwzNOjjf2WWqQfZThFc9I/QpjjwzVK08vC7YvxY9HwxNPPqG8yLV1ik+H8/0BUY1dm09myxQYAt UTi9CK9N6MSaMRl6V/holXT6jiVuR8viq1wdq8iqtp+64sHFRg4/GmZvm+7mlJbI3Y43iPIvoxeAo gQtzl/Fje66iwVB3UF6e4m2FW+Sox2zbuE3hcoYgMS8A4wL9OsE98afjJ9iEkpeWSpD+S7XbxQ6qF W9NZSVRNXQ3tE1KCOH4LRshuplFRGD50v5BPxyPkHFFPKE6tgFhcZGze7W2zZ7DsPLHVsM0rV2/1c jRWrJts8w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kAyfO-0000Q6-Vt; Wed, 26 Aug 2020 16:52:55 +0000 Received: from mail-ej1-f65.google.com ([209.85.218.65]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kAyfL-0000Pc-0w for linux-arm-kernel@lists.infradead.org; Wed, 26 Aug 2020 16:52:52 +0000 Received: by mail-ej1-f65.google.com with SMTP id a21so3842672ejp.0 for ; Wed, 26 Aug 2020 09:52:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=f3SjKHg0rc/Hi94wKGeK4sTEIeweZxxU2pp3miD2U7w=; b=tsuQheE3h5DaPMaK3+9WQCebBYn4PZ4kk+5CJNfANqrf/tnTMmiZ/L+lrjPGUcdZyv Ql69VgKlbixXztMB6zBusBiDekhxlW8Wt4ZQOo0yoxFMrIprZyfh8Mo93Fv+b1p+iRbp xQcxzt9q83w0TfxnbZl5d2xeuFHmb4fIBRS9KX8ZtGxv9TyLDZWh1vg5kVMdzsIwQStR ZtK/RrvIXyGx3QflUTuVtZTf8J7v7NI4RpZcsr0A046p39WaaC07afNJ+4ilX62t7StJ Wlzt0m6RV6qfE5m2Y42ha2FVoE+G4LT+zOuGRizGE+oMytdefUokqHadq+QLx71oNEPP F2yw== X-Gm-Message-State: AOAM530ZDpzRMEqGZGKed8IiPS94Nr/ZXtaoNqkqgYahj+8T8fynGGxo ItvSl3GZVB2izJlhxqjfbqk= X-Google-Smtp-Source: ABdhPJx8z7paHiBU5Vqit+UaxQDuL7FcpAQaf80dIweI/Cw+HnrnkKZ/d1NlwB9sHxh0qTew9unJQQ== X-Received: by 2002:a17:906:b09a:: with SMTP id x26mr2766990ejy.162.1598460769603; Wed, 26 Aug 2020 09:52:49 -0700 (PDT) Received: from kozik-lap ([194.230.155.216]) by smtp.googlemail.com with ESMTPSA id d2sm2656101ejm.19.2020.08.26.09.52.48 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 Aug 2020 09:52:49 -0700 (PDT) Date: Wed, 26 Aug 2020 18:52:46 +0200 From: Krzysztof Kozlowski To: Lukasz Stelmach Subject: Re: [PATCH 1/3] net: ax88796c: ASIX AX88796C SPI Ethernet Adapter Driver Message-ID: <20200826165246.GA29212@kozik-lap> References: <20200825184413.GA2693@kozik-lap> <20200826164533.GC31748@kozik-lap> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200826164533.GC31748@kozik-lap> User-Agent: Mutt/1.9.4 (2018-02-28) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200826_125251_072030_E51EEC78 X-CRM114-Status: GOOD ( 21.68 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-samsung-soc@vger.kernel.org, b.zolnierkie@samsung.com, netdev@vger.kernel.org, Russell King , Rob Herring , linux-kernel@vger.kernel.org, Kukjin Kim , Jakub Kicinski , "David S. Miller" , linux-arm-kernel@lists.infradead.org, m.szyprowski@samsung.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Aug 26, 2020 at 06:45:33PM +0200, Krzysztof Kozlowski wrote: > On Wed, Aug 26, 2020 at 04:59:09PM +0200, Lukasz Stelmach wrote: > >> +#include > > >> +#endif > > >> +#include > > >> +#include > > >> +#include > > >> +#include > > >> +#include > > >> +#include > > >> +#include > > >> +#include > > >> +#include > > >> +#include > > >> +#include > > >> +#include > > >> +#include > > >> +#include > > >> +#include > > >> +#include > > >> +#include > > >> +#include > > > > > > All of these should be removed except the headers used directly in this > > > header. > > > > > > > This is "private" header file included in all ax88796c_*.c files and > > these are headers required in them. It seems more conveninet to have > > them all listed in one place. What is the reason to do otherwise? > > Because: > 1. The header is included in other files (more than one) so each other > compilation unit will include all these headers, while not all of them > need. This has a performance penalty during preprocessing. > > 2. You will loose the track which headers are needed, which are not. We > tend to keep it local, which means each compilation unit includes stuff > it needs. This helps removing obsolete includes later. > > 3. Otherwise you could make one header, including all headers of Linux, > and then include this one header in each of C files. One to rule them > all. ... and I got one more: 4. Drivers sometimes get reused, extended or they parts got reused. If a header includes more stuff, it simply will pollute all other units trying to reuse it... making the re-usage difficult. This is less likely reason, I mean, quite imaginary for this particular driver. I don't expect pieces of this driver to be reused... but who knows. Many times in the past in the kernel there was a huge work rewriting headers in many files, because something was including something else and we wanted to decouple these things. Therefore following the pattern - include stuff you explicitly use - helps in every case. Best regards, Krzysztof _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel