lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y5C3qTuNl9fhrO4/@intel.com>
Date:   Wed, 7 Dec 2022 10:56:25 -0500
From:   Rodrigo Vivi <rodrigo.vivi@...el.com>
To:     Paul Cercueil <paul@...pouillou.net>
CC:     David Airlie <airlied@...il.com>, Daniel Vetter <daniel@...ll.ch>,
        <intel-gfx@...ts.freedesktop.org>, <linux-kernel@...r.kernel.org>,
        <dri-devel@...ts.freedesktop.org>
Subject: Re: [Intel-gfx] [PATCH v2 26/26] drm/i915/gt: Remove #ifdef guards
 for PM related functions

On Tue, Nov 29, 2022 at 07:19:42PM +0000, Paul Cercueil wrote:
> Instead of defining two versions of intel_sysfs_rc6_init(), one for each
> value of CONFIG_PM, add a check on !IS_ENABLED(CONFIG_PM) early in the
> function. This will allow the compiler to automatically drop the dead
> code when CONFIG_PM is disabled, without having to use #ifdef guards.
> 
> This has the advantage of always compiling these functions in,
> independently of any Kconfig option. Thanks to that, bugs and other
> regressions are subsequently easier to catch.
> 
> Signed-off-by: Paul Cercueil <paul@...pouillou.net>
> ---
> Cc: Jani Nikula <jani.nikula@...ux.intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@...ux.intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi@...el.com>


Reviewed-by: Rodrigo Vivi <rodrigo.vivi@...el.com>


> Cc: Tvrtko Ursulin <tvrtko.ursulin@...ux.intel.com>
> Cc: intel-gfx@...ts.freedesktop.org
> ---
>  drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c b/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c
> index cf71305ad586..09b9365ededd 100644
> --- a/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c
> +++ b/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c
> @@ -164,7 +164,6 @@ sysfs_gt_attribute_r_func(struct kobject *kobj, struct attribute *attr,
>  								 NULL);			\
>  	INTEL_GT_ATTR_RO(_name)
>  
> -#ifdef CONFIG_PM
>  static u32 get_residency(struct intel_gt *gt, enum intel_rc6_res_type id)
>  {
>  	intel_wakeref_t wakeref;
> @@ -300,7 +299,7 @@ static void intel_sysfs_rc6_init(struct intel_gt *gt, struct kobject *kobj)
>  {
>  	int ret;
>  
> -	if (!HAS_RC6(gt->i915))
> +	if (!IS_ENABLED(CONFIG_PM) || !HAS_RC6(gt->i915))
>  		return;
>  
>  	ret = __intel_gt_sysfs_create_group(kobj, rc6_attr_group);
> @@ -329,11 +328,6 @@ static void intel_sysfs_rc6_init(struct intel_gt *gt, struct kobject *kobj)
>  				 gt->info.id, ERR_PTR(ret));
>  	}
>  }
> -#else
> -static void intel_sysfs_rc6_init(struct intel_gt *gt, struct kobject *kobj)
> -{
> -}
> -#endif /* CONFIG_PM */
>  
>  static u32 __act_freq_mhz_show(struct intel_gt *gt)
>  {
> -- 
> 2.35.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ