All of lore.kernel.org
 help / color / mirror / Atom feed
From: Linus Probert <linus.probert@gmail.com>
To: "Robert P. J. Day" <rpjday@crashcourse.ca>
Cc: kernel-janitors@vger.kernel.org
Subject: Re: Status of kernel-janitors?
Date: Mon, 30 Mar 2026 22:32:33 +0200	[thread overview]
Message-ID: <acrcLLzBOSOyz9mz@mosquito> (raw)
In-Reply-To: <e25aa771-d3d2-4b93-31b8-15576e1d9512@crashcourse.ca>

On Mon, Mar 30, 2026 at 09:27:25AM -0400, Robert P. J. Day wrote:
> On Mon, 30 Mar 2026, Linus Probert wrote:
> 
> > Hello,
> >
> > I've been a long time builder and fiddler of kernel source. Running
> > self-compiled kernels and pulling in patches before official release
> > etc. Bog standard for most of you I assume.
> >
> > I'd love to dedicate some spare to help the project. Like so many
> > others.
> >
> > The kernel-janoitors "project" does pop up in various resources such as
> > kernelnewbies and I think it might have been mentioned in one of the
> > Linux Foundations free courses. But links to potential homepages seem to
> > be dead and resources are sometimes dated.
> >
> > I read somewhere that this has mostly evolved into janitorial work in
> > drivers/staging. TODOs were mentioned.
> >
> > So the actual question. In my mind janitorial code work is a good place
> > to dip ones toes when starting out. Is this the right mailing list to
> > ask about such things? Any suggestions to find an area where ones
> > assistance would be welcome?
> >
> > I'm aware of checkpatch.pl but for many drivers diverging from these
> > rules seem intentional and just blindly fixing checkpatch warnings are
> > not helpful to the maintainer.
> > Open source is a lot of work so the goal would be to be helpful while
> > not stealing too much attention from concerned parties.
> 
>   I mention this once in a while ... *many* years ago, I wrote some
> admittedly hacky scripts that scanned the kernel source tree looking
> for what I considered "obvious" cleanups. One of those cleanups was to
> abbreviate the numerous calculations of the length of an array
> sprinkled throughout the source code, so I wrote a script that can be
> run from the top of the kernel source tree and can take an argument of
> which subdirectory to examine, looking for a particular regular
> expression that I can barely recognize anymore:
> 
>   #!/bin/sh
>   DIR=${1-.}
>   grep -Er "sizeof ?\(?([^\)]+)\)? ?/ ?sizeof ?\(?.*\1.*" ${DIR}

Is there ever a regex that you do understand after *many* years?

> For example, if I run:
> 
>   $ arraysize.sh drivers/gpu/drm
> 
> I get the output:
> 
> drivers/gpu/drm/xe/xe_guc_hxg_helpers.h:#define hxg_sizeof(T)	(sizeof(T) / sizeof(u32) + BUILD_BUG_ON_ZERO(sizeof(T) % sizeof(u32)))
> drivers/gpu/drm/nouveau/nvif/fifo.c:	a->m.count = sizeof(a->v) / sizeof(a->v.runlists);
> drivers/gpu/drm/amd/display/dc/mpc/dcn30/dcn30_mpc.c:#define NUM_ELEMENTS(a) (sizeof(a) / sizeof((a)[0]))
> drivers/gpu/drm/amd/display/dc/mpc/dcn20/dcn20_mpc.c:#define NUM_ELEMENTS(a) (sizeof(a) / sizeof((a)[0]))
> drivers/gpu/drm/amd/display/dc/dpp/dcn10/dcn10_dpp_cm.c:#define NUM_ELEMENTS(a) (sizeof(a) / sizeof((a)[0]))
> drivers/gpu/drm/amd/display/dc/dpp/dcn10/dcn10_dpp_cm.c:	int arr_size = sizeof(dpp_input_csc_matrix)/sizeof(struct dpp_input_csc_matrix);
> drivers/gpu/drm/amd/display/dc/dpp/dcn30/dcn30_dpp.c:	int arr_size = sizeof(dpp_input_csc_matrix)/sizeof(struct dpp_input_csc_matrix);
> drivers/gpu/drm/amd/display/dc/dpp/dcn20/dcn20_dpp_cm.c:	int arr_size = sizeof(dpp_input_csc_matrix)/sizeof(struct dpp_input_csc_matrix);
> drivers/gpu/drm/amd/display/dc/dpp/dcn401/dcn401_dpp_cm.c:#define NUM_ELEMENTS(a) (sizeof(a) / sizeof((a)[0]))
> drivers/gpu/drm/amd/display/dc/dpp/dcn401/dcn401_dpp_cm.c:	int arr_size = sizeof(dpp_input_csc_matrix) / sizeof(struct dpp_input_csc_matrix);
> drivers/gpu/drm/amd/display/dc/dce110/dce110_opp_csc_v.c:	int arr_size = sizeof(input_csc_matrix)/sizeof(struct input_csc_matrix);
> drivers/gpu/drm/amd/display/dc/dml/dsc/rc_calc_fpu.c:	table_size = sizeof(qp_table_##mode##_##bpc##bpc_##max)/sizeof(*qp_table_##mode##_##bpc##bpc_##max); \
> drivers/gpu/drm/amd/display/dc/dml/dcn20/dcn20_fpu.c:	for (k = 0; k < sizeof(wb_arb_params->cli_watermark)/sizeof(wb_arb_params->cli_watermark[0]); k++) {
> drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c:#define NUM_ELEMENTS(a) (sizeof(a) / sizeof((a)[0]))
> drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c:#define NUM_ELEMENTS(a) (sizeof(a) / sizeof((a)[0]))
> 
> Note the number of places in that subsystem which calculate the length
> of an array; much of that can be abbreviated by now taking advantage
> of the kernel header file include/linux/array_size.h (only relevant
> line shown here):
> 
> #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) +
> __must_be_array(arr))
> 
> That would seem to be obvious janitor work -- simplifying code a
> subsystem at a time (do *not* try to submit a single patch that
> covers the entire source tree).

Noted.

>   I have other examples, I should clean them up and post them.

This sounds like a good idea. I assume there are many like me who don't
mind some scout work in the name of OSS.

> rday

Thanks for the reply. I'll make a note of this and make one or two
patches based on this info.

-- Linus

  reply	other threads:[~2026-03-30 20:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-30 12:10 Status of kernel-janitors? Linus Probert
2026-03-30 12:25 ` Dan Carpenter
2026-03-30 12:51   ` Linus Probert
2026-03-30 13:27 ` Robert P. J. Day
2026-03-30 20:32   ` Linus Probert [this message]
2026-03-30 20:48   ` Dan Carpenter
2026-03-30 21:09     ` Robert P. J. Day
2026-04-02 21:57     ` Linus Probert
2026-04-03  0:01       ` Julia Lawall
2026-04-03 21:12         ` Linus Probert
2026-04-03 22:20           ` Rolf Reintjes
2026-04-03 22:26             ` Linus Probert
2026-04-04 16:29           ` Ethan Tidmore

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=acrcLLzBOSOyz9mz@mosquito \
    --to=linus.probert@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=rpjday@crashcourse.ca \
    /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.