Linux Power Management development
 help / color / mirror / Atom feed
From: Rikard Falkeborn <rikard.falkeborn@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org,
	Rikard Falkeborn <rikard.falkeborn@gmail.com>,
	Sebastian Reichel <sre@kernel.org>,
	Angelo Dureghello <angelo.dureghello@timesys.com>,
	Akira Shimahara <akira215corp@gmail.com>,
	Evgeniy Polyakov <zbr@ioremap.net>,
	linux-pm@vger.kernel.org
Subject: [PATCH 0/3] w1: Constify w1_family_ops
Date: Sun,  4 Oct 2020 21:31:59 +0200	[thread overview]
Message-ID: <20201004193202.4044-1-rikard.falkeborn@gmail.com> (raw)

None of the current instances of struct w1_family_ops in the kernel is
modified. Constify these to let the compiler put them in read-only memory.

The first patch changes the fops field in w1_family struct to a pointer to
const and makes a local variable a pointer to const to avoid a compiler
warning. This patch is a prerequisite for the second and third patches
which constifies the static structs in drivers in w1 and power. These
changes was done with coccinelle (details in the commit messages).

With these changes applied, all instances of struct w1_family_ops in the
kernel are const.

Build-tested on x86 allmodconfig.

Rikard Falkeborn (3):
  w1: Constify struct w1_family_ops
  w1: Constify static w1_family_ops structs
  power: supply: Constify static w1_family_ops structs

 drivers/power/supply/bq27xxx_battery_hdq.c | 2 +-
 drivers/power/supply/ds2760_battery.c      | 2 +-
 drivers/power/supply/max1721x_battery.c    | 2 +-
 drivers/w1/slaves/w1_ds2405.c              | 2 +-
 drivers/w1/slaves/w1_ds2406.c              | 2 +-
 drivers/w1/slaves/w1_ds2408.c              | 2 +-
 drivers/w1/slaves/w1_ds2413.c              | 2 +-
 drivers/w1/slaves/w1_ds2423.c              | 2 +-
 drivers/w1/slaves/w1_ds2430.c              | 2 +-
 drivers/w1/slaves/w1_ds2431.c              | 2 +-
 drivers/w1/slaves/w1_ds2433.c              | 2 +-
 drivers/w1/slaves/w1_ds2438.c              | 2 +-
 drivers/w1/slaves/w1_ds250x.c              | 2 +-
 drivers/w1/slaves/w1_ds2780.c              | 2 +-
 drivers/w1/slaves/w1_ds2781.c              | 2 +-
 drivers/w1/slaves/w1_ds2805.c              | 2 +-
 drivers/w1/slaves/w1_ds28e04.c             | 2 +-
 drivers/w1/slaves/w1_ds28e17.c             | 2 +-
 drivers/w1/slaves/w1_therm.c               | 6 +++---
 drivers/w1/w1.c                            | 4 ++--
 include/linux/w1.h                         | 2 +-
 21 files changed, 24 insertions(+), 24 deletions(-)

-- 
2.28.0


             reply	other threads:[~2020-10-04 19:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-04 19:31 Rikard Falkeborn [this message]
2020-10-04 19:32 ` [PATCH 3/3] power: supply: Constify static w1_family_ops structs Rikard Falkeborn
2020-10-04 22:03   ` Sebastian Reichel

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=20201004193202.4044-1-rikard.falkeborn@gmail.com \
    --to=rikard.falkeborn@gmail.com \
    --cc=akira215corp@gmail.com \
    --cc=angelo.dureghello@timesys.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=sre@kernel.org \
    --cc=zbr@ioremap.net \
    /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