public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: David Laight <david.laight.linux@gmail.com>
To: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Cc: "Rafael J . Wysocki" <rafael@kernel.org>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	Zhang Rui <rui.zhang@intel.com>,
	Lukasz Luba <lukasz.luba@arm.com>,
	Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 3/9] powercap: intel_rapl: Use GENMASK() and BIT() macros
Date: Thu, 29 Jan 2026 21:52:25 +0000	[thread overview]
Message-ID: <20260129215225.33cce6dc@pumpkin> (raw)
In-Reply-To: <20260129183646.558866-4-sathyanarayanan.kuppuswamy@linux.intel.com>

On Thu, 29 Jan 2026 10:36:40 -0800
Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com> wrote:

> Replace hardcoded bitmasks and bit shift operations with standard
> GENMASK(), GENMASK_ULL(), BIT(), and BIT_ULL() macros for better
> readability and to follow kernel coding conventions.
> 
> No functional changes.

Assuming that changing values to 'unsigned long' doesn't have any
subtle side effects.

...
>  	value = (ra.value & ENERGY_UNIT_MASK) >> ENERGY_UNIT_OFFSET;
> -	rd->energy_unit = ENERGY_UNIT_SCALE * 1000000 / (1 << value);
> +	rd->energy_unit = ENERGY_UNIT_SCALE * 1000000 / BIT(value);

That should really be:
	rd->energy_unit = ENERGY_UNIT_SCALE * 1000000 >> value;

While using BIT() for bit patterns is resonable, wholesale substition
isn't really right - and that isn't a bit pattern.

	David

  reply	other threads:[~2026-01-29 21:52 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-29 18:36 [PATCH v1 0/9] Move RAPL defaults to interface drivers Kuppuswamy Sathyanarayanan
2026-01-29 18:36 ` [PATCH v1 1/9] powercap: intel_rapl: Add a symbol namespace for intel_rapl exports Kuppuswamy Sathyanarayanan
2026-01-29 18:36 ` [PATCH v1 2/9] powercap: intel_rapl: Cleanup coding style Kuppuswamy Sathyanarayanan
2026-01-29 18:36 ` [PATCH v1 3/9] powercap: intel_rapl: Use GENMASK() and BIT() macros Kuppuswamy Sathyanarayanan
2026-01-29 21:52   ` David Laight [this message]
2026-01-29 22:17     ` Kuppuswamy Sathyanarayanan
2026-01-29 18:36 ` [PATCH v1 4/9] powercap: intel_rapl: Use unit conversion macros from units.h Kuppuswamy Sathyanarayanan
2026-01-29 18:36 ` [PATCH v1 5/9] powercap: intel_rapl: Allow interface drivers to configure rapl_defaults Kuppuswamy Sathyanarayanan
2026-01-29 18:36 ` [PATCH v1 6/9] powercap: intel_rapl: Move TPMI default settings into TPMI interface driver Kuppuswamy Sathyanarayanan
2026-01-29 18:36 ` [PATCH v1 7/9] thermal: intel: int340x: processor: Move RAPL defaults to MMIO driver Kuppuswamy Sathyanarayanan
2026-01-29 18:36 ` [PATCH v1 8/9] powercap: intel_rapl: Register PM notifier only when RAPL package exists Kuppuswamy Sathyanarayanan
2026-01-29 18:36 ` [PATCH v1 9/9] powercap: intel_rapl: Move MSR default settings into MSR interface driver Kuppuswamy Sathyanarayanan
2026-01-29 19:20 ` [PATCH v1 0/9] Move RAPL defaults to interface drivers srinivas pandruvada

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=20260129215225.33cce6dc@pumpkin \
    --to=david.laight.linux@gmail.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lukasz.luba@arm.com \
    --cc=rafael@kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=sathyanarayanan.kuppuswamy@linux.intel.com \
    --cc=srinivas.pandruvada@linux.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox