linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Shrikanth Hegde <sshegde@linux.ibm.com>
To: linux-kernel@vger.kernel.org,
	linux-ntfs-dev@lists.sourceforge.net, linux-xfs@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org
Cc: peterz@infradead.org, sshegde@linux.ibm.com, djwong@kernel.org,
	mingo@kernel.org, anton@tuxera.com, chandan.babu@oracle.com
Subject: [RFC PATCH v2 0/4] remove duplicate ifdefs
Date: Mon, 22 Jan 2024 23:19:00 +0530	[thread overview]
Message-ID: <20240122174904.178594-1-sshegde@linux.ibm.com> (raw)

When going through the code observed a case in scheduler,
where #ifdef CONFIG_SMP was used to inside an #ifdef CONFIG_SMP.
That didn't make sense since first one is good enough and second
one is a duplicate.

This could improve code readability. No functional change is intended.

Since this might be present in other code areas wrote a very basic
python script which helps in finding these cases. It doesn't handle any
complicated #defines or space separated "# if". At some places the
log collected had to be manually corrected due to space separated ifdefs.
Thats why its not a treewide change.
There might be an opportunity for other files as well.

Logic is very simple. If there is #ifdef or #if or #ifndef add that
variable to list. Upon every subsequent #ifdef or #if or #ifndef
check if the same variable is in the list. If yes flag
an error. Verification was done manually later checking for any #undef
or any error due to script. These were the ones that flagged out and
made sense after going through code.

More details about how the logs were collected and the script used for
processing the logs are mentioned in v1 cover letter.

v2->v1:
split the fs change into two patches as suggested by Chandan Babu R.
v1: https://lore.kernel.org/all/20240118080326.13137-1-sshegde@linux.ibm.com/

Shrikanth Hegde (4):
  sched: remove duplicate ifdefs
  xfs: remove duplicate ifdefs
  ntfs: remove duplicate ifdefs
  arch/powerpc: remove duplicate ifdefs

 arch/powerpc/include/asm/paca.h           | 4 ----
 arch/powerpc/kernel/asm-offsets.c         | 2 --
 arch/powerpc/platforms/powermac/feature.c | 2 --
 arch/powerpc/xmon/xmon.c                  | 2 --
 fs/ntfs/inode.c                           | 2 --
 fs/xfs/xfs_sysfs.c                        | 4 ----
 kernel/sched/core.c                       | 4 +---
 kernel/sched/fair.c                       | 2 --
 8 files changed, 1 insertion(+), 21 deletions(-)

--
2.39.3


             reply	other threads:[~2024-01-22 17:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-22 17:49 Shrikanth Hegde [this message]
2024-01-22 17:49 ` [RFC PATCH v2 1/4] sched: remove duplicate ifdefs Shrikanth Hegde
2024-01-22 17:49 ` [RFC PATCH v2 2/4] xfs: " Shrikanth Hegde
2024-01-22 17:49 ` [RFC PATCH v2 3/4] ntfs: " Shrikanth Hegde
2024-01-22 17:49 ` [RFC PATCH v2 4/4] arch/powerpc: " Shrikanth Hegde

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=20240122174904.178594-1-sshegde@linux.ibm.com \
    --to=sshegde@linux.ibm.com \
    --cc=anton@tuxera.com \
    --cc=chandan.babu@oracle.com \
    --cc=djwong@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-ntfs-dev@lists.sourceforge.net \
    --cc=linux-xfs@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).