All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Lucas De Marchi <lucas.demarchi@intel.com>,
	intel-xe@lists.freedesktop.org
Cc: Lucas De Marchi <lucas.demarchi@intel.com>,
	Matthew Auld <matthew.auld@intel.com>,
	Maarten Lankhorst <maarten.lankhorst@intel.com>
Subject: Re: [Intel-xe] [PATCH v2 02/11] drm/xe: Sort includes
Date: Fri, 17 Feb 2023 13:39:31 +0200	[thread overview]
Message-ID: <87y1owy0zw.fsf@intel.com> (raw)
In-Reply-To: <20230217005226.106499-3-lucas.demarchi@intel.com>

On Thu, 16 Feb 2023, Lucas De Marchi <lucas.demarchi@intel.com> wrote:
> Sort includes and split them in blocks:
>
> 1) .h corresponding to the .c. Example: xe_bb.c should have a "#include
>    "xe_bb.h" first.

Personally, I've never liked this, because the local headers could have
stuff that impacts global headers. And if there are conflicts, you kind
of want to have your local one look like the culprit (although modern
compilers are pretty good at showing both sites).

Note that to keep headers self-contained, this is not enough for headers
not associated with a .c, which is why we have the HDRTEST rule in i915.

> 2) #include <linux/...>
> 3) #include <drm/...>
> 4) local includes
> 5) i915 includes
>
> This is accomplished by running
> `clang-format --style=file -i --sort-includes drivers/gpu/drm/xe/*.c`
> and ignoring all the changes after the includes. There are also some
> manual tweaks to split the blocks.

Do you have the style file somewhere?

>
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> ---
>  drivers/gpu/drm/xe/xe_bb.c                  |  4 ++--
>  drivers/gpu/drm/xe/xe_bo.c                  |  2 --
>  drivers/gpu/drm/xe/xe_bo_evict.c            |  2 +-
>  drivers/gpu/drm/xe/xe_debugfs.c             |  2 +-
>  drivers/gpu/drm/xe/xe_device.c              |  9 ++++-----
>  drivers/gpu/drm/xe/xe_display.c             | 12 ++++++------
>  drivers/gpu/drm/xe/xe_dma_buf.c             |  8 +++-----
>  drivers/gpu/drm/xe/xe_engine.c              |  4 ++--
>  drivers/gpu/drm/xe/xe_exec.c                |  2 +-
>  drivers/gpu/drm/xe/xe_execlist.c            |  9 ++++-----
>  drivers/gpu/drm/xe/xe_force_wake.c          |  4 ++--
>  drivers/gpu/drm/xe/xe_ggtt.c                |  7 +++----
>  drivers/gpu/drm/xe/xe_gt.c                  |  2 +-
>  drivers/gpu/drm/xe/xe_gt_clock.c            |  8 ++++----
>  drivers/gpu/drm/xe/xe_gt_debugfs.c          |  2 +-
>  drivers/gpu/drm/xe/xe_gt_mcr.c              |  2 +-
>  drivers/gpu/drm/xe/xe_gt_pagefault.c        |  2 +-
>  drivers/gpu/drm/xe/xe_gt_sysfs.c            |  4 +++-
>  drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c |  2 +-
>  drivers/gpu/drm/xe/xe_gt_topology.c         |  2 +-
>  drivers/gpu/drm/xe/xe_guc.c                 | 13 +++++++------
>  drivers/gpu/drm/xe/xe_guc_ads.c             |  5 +++--
>  drivers/gpu/drm/xe/xe_guc_ct.c              |  4 ++--
>  drivers/gpu/drm/xe/xe_guc_debugfs.c         |  2 +-
>  drivers/gpu/drm/xe/xe_guc_hwconfig.c        |  2 +-
>  drivers/gpu/drm/xe/xe_guc_log.c             |  2 +-
>  drivers/gpu/drm/xe/xe_guc_pc.c              | 12 +++++++-----
>  drivers/gpu/drm/xe/xe_guc_submit.c          |  6 +++---
>  drivers/gpu/drm/xe/xe_huc.c                 |  2 +-
>  drivers/gpu/drm/xe/xe_huc_debugfs.c         |  2 +-
>  drivers/gpu/drm/xe/xe_hw_engine.c           |  3 +--
>  drivers/gpu/drm/xe/xe_hw_fence.c            |  1 -
>  drivers/gpu/drm/xe/xe_irq.c                 |  5 +++--
>  drivers/gpu/drm/xe/xe_lrc.c                 |  7 +++----
>  drivers/gpu/drm/xe/xe_migrate.c             | 11 ++++++-----
>  drivers/gpu/drm/xe/xe_mmio.c                |  3 +--
>  drivers/gpu/drm/xe/xe_mocs.c                |  4 ++--
>  drivers/gpu/drm/xe/xe_module.c              |  1 +
>  drivers/gpu/drm/xe/xe_pci.c                 |  5 ++---
>  drivers/gpu/drm/xe/xe_pcode.c               | 10 ++++------
>  drivers/gpu/drm/xe/xe_pm.c                  |  4 ++--
>  drivers/gpu/drm/xe/xe_preempt_fence.c       |  2 +-
>  drivers/gpu/drm/xe/xe_pt.c                  |  4 ++--
>  drivers/gpu/drm/xe/xe_query.c               | 11 ++++++-----
>  drivers/gpu/drm/xe/xe_reg_sr.c              |  5 ++---
>  drivers/gpu/drm/xe/xe_reg_whitelist.c       |  7 +++----
>  drivers/gpu/drm/xe/xe_ring_ops.c            |  4 ++--
>  drivers/gpu/drm/xe/xe_rtp.c                 |  1 -
>  drivers/gpu/drm/xe/xe_sa.c                  |  3 ++-
>  drivers/gpu/drm/xe/xe_sched_job.c           |  1 -
>  drivers/gpu/drm/xe/xe_sync.c                |  5 +++--
>  drivers/gpu/drm/xe/xe_ttm_gtt_mgr.c         |  2 +-
>  drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c      |  2 +-
>  drivers/gpu/drm/xe/xe_ttm_vram_mgr.c        |  2 +-
>  drivers/gpu/drm/xe/xe_tuning.c              |  2 +-
>  drivers/gpu/drm/xe/xe_uc.c                  |  4 ++--
>  drivers/gpu/drm/xe/xe_vm.c                  |  2 +-
>  drivers/gpu/drm/xe/xe_vm_madvise.c          |  8 +++++---
>  drivers/gpu/drm/xe/xe_wopcm.c               |  2 +-
>  59 files changed, 128 insertions(+), 132 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_bb.c b/drivers/gpu/drm/xe/xe_bb.c
> index 8b9209571fd0..a25079d4e710 100644
> --- a/drivers/gpu/drm/xe/xe_bb.c
> +++ b/drivers/gpu/drm/xe/xe_bb.c
> @@ -2,12 +2,12 @@
>  /*
>   * Copyright © 2022 Intel Corporation
>   */
> -

Nitpick, throughout the series, I would leave a blank line after the
SPDX and copyright boilerplate, regardless of whether it's an #include
or header guard #ifdef that follows. They're not comments about what
follows, which is what it feels like when they're directly attached to
something that follows without a blank line.

>  #include "xe_bb.h"
> -#include "xe_sa.h"
> +
>  #include "xe_device.h"
>  #include "xe_engine_types.h"
>  #include "xe_hw_fence.h"
> +#include "xe_sa.h"
>  #include "xe_sched_job.h"
>  #include "xe_vm_types.h"
>

...

> diff --git a/drivers/gpu/drm/xe/xe_uc.c b/drivers/gpu/drm/xe/xe_uc.c
> index 7886c8b85397..a27e6c1a6aff 100644
> --- a/drivers/gpu/drm/xe/xe_uc.c
> +++ b/drivers/gpu/drm/xe/xe_uc.c
> @@ -3,13 +3,13 @@
>   * Copyright © 2022 Intel Corporation
>   */
>  
> +#include "xe_uc.h"
>  #include "xe_device.h"
> -#include "xe_huc.h"
>  #include "xe_gt.h"
>  #include "xe_guc.h"
>  #include "xe_guc_pc.h"
>  #include "xe_guc_submit.h"
> -#include "xe_uc.h"
> +#include "xe_huc.h"
>  #include "xe_uc_fw.h"
>  #include "xe_wopcm.h"

Here, having the .h corresponding to the .c just looks like it's not
properly sorted.

BR,
Jani.


-- 
Jani Nikula, Intel Open Source Graphics Center

  parent reply	other threads:[~2023-02-17 11:39 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-17  0:52 [Intel-xe] [PATCH v2 00/11] Start register cleanup Lucas De Marchi
2023-02-17  0:52 ` [Intel-xe] [PATCH v2 01/11] drm/xe: Remove outdated build workaround Lucas De Marchi
2023-02-17 20:13   ` Rodrigo Vivi
2023-02-17  0:52 ` [Intel-xe] [PATCH v2 02/11] drm/xe: Sort includes Lucas De Marchi
2023-02-17 11:20   ` Matthew Auld
2023-02-17 15:03     ` Lucas De Marchi
2023-02-17 11:39   ` Jani Nikula [this message]
2023-02-17 15:09     ` Lucas De Marchi
2023-02-17  0:52 ` [Intel-xe] [PATCH v2 03/11] drm/xe/guc: Remove i915_regs.h include Lucas De Marchi
2023-02-17  0:52 ` [Intel-xe] [PATCH v2 04/11] drm/xe: Remove dependency on intel_engine_regs.h Lucas De Marchi
2023-02-24 18:02   ` Matt Roper
2023-02-24 18:05     ` Lucas De Marchi
2023-02-17  0:52 ` [Intel-xe] [PATCH v2 05/11] drm/xe: Remove dependency on intel_gt_regs.h Lucas De Marchi
2023-02-17 20:20   ` Rodrigo Vivi
2023-02-17 22:08     ` Lucas De Marchi
2023-02-24 18:06   ` Matt Roper
2023-02-24 18:29     ` Lucas De Marchi
2023-02-24 18:34       ` Matt Roper
2023-02-24 19:47         ` Vivi, Rodrigo
2023-02-24 20:25           ` Lucas De Marchi
2023-02-24 21:22             ` Vivi, Rodrigo
2023-02-17  0:52 ` [Intel-xe] [PATCH v2 06/11] drm/xe: Remove dependency on intel_lrc_reg.h Lucas De Marchi
2023-02-24 18:20   ` Matt Roper
2023-02-24 18:54     ` Lucas De Marchi
2023-02-17  0:52 ` [Intel-xe] [PATCH v2 07/11] drm/xe: Remove dependency on intel_gpu_commands.h Lucas De Marchi
2023-02-24 18:26   ` Matt Roper
2023-02-17  0:52 ` [Intel-xe] [PATCH v2 08/11] drm/xe: Remove dependency on i915_reg.h Lucas De Marchi
2023-02-17 20:27   ` Rodrigo Vivi
2023-02-17 22:22     ` Lucas De Marchi
2023-02-27 14:19       ` Jani Nikula
2023-02-17  0:52 ` [Intel-xe] [PATCH v2 09/11] drm/xe/guc_pc: Move gt register to the proper place Lucas De Marchi
2023-02-17 20:23   ` Rodrigo Vivi
2023-02-17 22:11     ` Lucas De Marchi
2023-02-17  0:52 ` [Intel-xe] [PATCH v2 10/11] drm/xe: Remove dependency on intel_mchbar_regs.h Lucas De Marchi
2023-02-17 20:18   ` Rodrigo Vivi
2023-02-17  0:52 ` [Intel-xe] [PATCH v2 11/11] drm/xe: Use relative includes for i915_reg_defs.h Lucas De Marchi
2023-02-17 16:33   ` Lucas De Marchi
2023-02-17 20:28   ` Rodrigo Vivi
2023-02-17 22:30     ` Lucas De Marchi
2023-02-21 21:42       ` Rodrigo Vivi
2023-02-21 21:50         ` Lucas De Marchi
2023-02-17  6:19 ` [Intel-xe] [PATCH v2 00/11] Start register cleanup Lucas De Marchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y1owy0zw.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=lucas.demarchi@intel.com \
    --cc=maarten.lankhorst@intel.com \
    --cc=matthew.auld@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.