X86 platform drivers
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Hans de Goede <hdegoede@redhat.com>
Cc: Mark Gross <markgross@kernel.org>,
	Andy Shevchenko <andy@kernel.org>,
	platform-driver-x86@vger.kernel.org
Subject: Re: [PATCH 1/3] platform/x86: msi-laptop: Fix old-ec check for backlight registering
Date: Thu, 25 Aug 2022 18:04:13 +0300	[thread overview]
Message-ID: <YwePbbTA11UQ3FT0@smile.fi.intel.com> (raw)
In-Reply-To: <20220825141336.208597-1-hdegoede@redhat.com>

On Thu, Aug 25, 2022 at 04:13:34PM +0200, Hans de Goede wrote:
> Commit 2cc6c717799f ("msi-laptop: Port to new backlight interface
> selection API") replaced this check:
> 
> 	if (!quirks->old_ec_model || acpi_video_backlight_support())
> 		pr_info("Brightness ignored, ...");
> 	else
> 		do_register();
> 
> With:
> 
> 	if (quirks->old_ec_model ||
> 	    acpi_video_get_backlight_type() == acpi_backlight_vendor)
> 		do_register();
> 
> But since the do_register() part was part of the else branch, the entire
> condition should be inverted.  So not only the 2 statements on either
> side of the || should be inverted, but the || itself should be replaced
> with a &&.
> 
> In practice this has likely not been an issue because the new-ec models
> (old_ec_model==false) likely all support ACPI video backlight control,
> making acpi_video_get_backlight_type() return acpi_backlight_video
> turning the second part of the || also false when old_ec_model == false.

...

>  	/* Register backlight stuff */
> -
> -	if (quirks->old_ec_model ||
> +	if (quirks->old_ec_model &&
>  	    acpi_video_get_backlight_type() == acpi_backlight_vendor) {
>  		struct backlight_properties props;

checkpatch might complain for absence of blank line here, btw. Perhaps
you may just move the above one here at the same patch.

>  		memset(&props, 0, sizeof(struct backlight_properties));

-- 
With Best Regards,
Andy Shevchenko



  parent reply	other threads:[~2022-08-25 15:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-25 14:13 [PATCH 1/3] platform/x86: msi-laptop: Fix old-ec check for backlight registering Hans de Goede
2022-08-25 14:13 ` [PATCH 2/3] platform/x86: msi-laptop: Simplify ec_delay handling Hans de Goede
2022-08-25 15:05   ` Andy Shevchenko
2022-08-25 15:30     ` Hans de Goede
2022-08-25 14:13 ` [PATCH 3/3] platform/x86: msi-laptop: Fix resource cleanup Hans de Goede
2022-08-25 15:05   ` Andy Shevchenko
2022-08-25 15:37     ` Hans de Goede
2022-08-25 15:04 ` Andy Shevchenko [this message]
2022-08-26 11:17 ` [PATCH 1/3] platform/x86: msi-laptop: Fix old-ec check for backlight registering Hans de Goede

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=YwePbbTA11UQ3FT0@smile.fi.intel.com \
    --to=andriy.shevchenko@intel.com \
    --cc=andy@kernel.org \
    --cc=hdegoede@redhat.com \
    --cc=markgross@kernel.org \
    --cc=platform-driver-x86@vger.kernel.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