From: Hans de Goede <hdegoede@redhat.com> To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>, Maxime Ripard <mripard@kernel.org>, Thomas Zimmermann <tzimmermann@suse.de>, Daniel Vetter <daniel@ffwll.ch>, David Airlie <airlied@linux.ie>, Jani Nikula <jani.nikula@linux.intel.com>, Joonas Lahtinen <joonas.lahtinen@linux.intel.com>, Rodrigo Vivi <rodrigo.vivi@intel.com> Cc: Hans de Goede <hdegoede@redhat.com>, intel-gfx <intel-gfx@lists.freedesktop.org>, dri-devel@lists.freedesktop.org, Sebastien Bacher <seb128@ubuntu.com>, Marco Trevisan <marco.trevisan@canonical.com> Subject: [PATCH 7/9] platform/x86: thinkpad_acpi: Get privacy-screen / lcdshadow ACPI handles only once Date: Wed, 8 Jul 2020 18:43:33 +0200 [thread overview] Message-ID: <20200708164335.25097-8-hdegoede@redhat.com> (raw) In-Reply-To: <20200708164335.25097-1-hdegoede@redhat.com> Get the privacy-screen / lcdshadow ACPI handles once and cache them, instead of retrieving them every time we need them. Signed-off-by: Hans de Goede <hdegoede@redhat.com> --- drivers/platform/x86/thinkpad_acpi.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index ff7f0a4f2475..782e74d3167f 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -9699,19 +9699,15 @@ static struct ibm_struct battery_driver_data = { * LCD Shadow subdriver, for the Lenovo PrivacyGuard feature */ +static acpi_handle lcdshadow_get_handle; +static acpi_handle lcdshadow_set_handle; static int lcdshadow_state; static int lcdshadow_on_off(bool state) { - acpi_handle set_shadow_handle; int output; - if (ACPI_FAILURE(acpi_get_handle(hkey_handle, "SSSS", &set_shadow_handle))) { - pr_warn("Thinkpad ACPI has no %s interface.\n", "SSSS"); - return -EIO; - } - - if (!acpi_evalf(set_shadow_handle, &output, NULL, "dd", (int)state)) + if (!acpi_evalf(lcdshadow_set_handle, &output, NULL, "dd", (int)state)) return -EIO; lcdshadow_state = state; @@ -9729,15 +9725,17 @@ static int lcdshadow_set(bool on) static int tpacpi_lcdshadow_init(struct ibm_init_struct *iibm) { - acpi_handle get_shadow_handle; + acpi_status status1, status2; int output; - if (ACPI_FAILURE(acpi_get_handle(hkey_handle, "GSSS", &get_shadow_handle))) { + status1 = acpi_get_handle(hkey_handle, "GSSS", &lcdshadow_get_handle); + status2 = acpi_get_handle(hkey_handle, "SSSS", &lcdshadow_set_handle); + if (ACPI_FAILURE(status1) || ACPI_FAILURE(status2)) { lcdshadow_state = -ENODEV; return 0; } - if (!acpi_evalf(get_shadow_handle, &output, NULL, "dd", 0)) { + if (!acpi_evalf(lcdshadow_get_handle, &output, NULL, "dd", 0)) { lcdshadow_state = -EIO; return -EIO; } -- 2.26.2 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
WARNING: multiple messages have this Message-ID (diff)
From: Hans de Goede <hdegoede@redhat.com> To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>, Maxime Ripard <mripard@kernel.org>, Thomas Zimmermann <tzimmermann@suse.de>, Daniel Vetter <daniel@ffwll.ch>, David Airlie <airlied@linux.ie>, Jani Nikula <jani.nikula@linux.intel.com>, Joonas Lahtinen <joonas.lahtinen@linux.intel.com>, Rodrigo Vivi <rodrigo.vivi@intel.com> Cc: intel-gfx <intel-gfx@lists.freedesktop.org>, dri-devel@lists.freedesktop.org, Sebastien Bacher <seb128@ubuntu.com>, Marco Trevisan <marco.trevisan@canonical.com> Subject: [Intel-gfx] [PATCH 7/9] platform/x86: thinkpad_acpi: Get privacy-screen / lcdshadow ACPI handles only once Date: Wed, 8 Jul 2020 18:43:33 +0200 [thread overview] Message-ID: <20200708164335.25097-8-hdegoede@redhat.com> (raw) In-Reply-To: <20200708164335.25097-1-hdegoede@redhat.com> Get the privacy-screen / lcdshadow ACPI handles once and cache them, instead of retrieving them every time we need them. Signed-off-by: Hans de Goede <hdegoede@redhat.com> --- drivers/platform/x86/thinkpad_acpi.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index ff7f0a4f2475..782e74d3167f 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -9699,19 +9699,15 @@ static struct ibm_struct battery_driver_data = { * LCD Shadow subdriver, for the Lenovo PrivacyGuard feature */ +static acpi_handle lcdshadow_get_handle; +static acpi_handle lcdshadow_set_handle; static int lcdshadow_state; static int lcdshadow_on_off(bool state) { - acpi_handle set_shadow_handle; int output; - if (ACPI_FAILURE(acpi_get_handle(hkey_handle, "SSSS", &set_shadow_handle))) { - pr_warn("Thinkpad ACPI has no %s interface.\n", "SSSS"); - return -EIO; - } - - if (!acpi_evalf(set_shadow_handle, &output, NULL, "dd", (int)state)) + if (!acpi_evalf(lcdshadow_set_handle, &output, NULL, "dd", (int)state)) return -EIO; lcdshadow_state = state; @@ -9729,15 +9725,17 @@ static int lcdshadow_set(bool on) static int tpacpi_lcdshadow_init(struct ibm_init_struct *iibm) { - acpi_handle get_shadow_handle; + acpi_status status1, status2; int output; - if (ACPI_FAILURE(acpi_get_handle(hkey_handle, "GSSS", &get_shadow_handle))) { + status1 = acpi_get_handle(hkey_handle, "GSSS", &lcdshadow_get_handle); + status2 = acpi_get_handle(hkey_handle, "SSSS", &lcdshadow_set_handle); + if (ACPI_FAILURE(status1) || ACPI_FAILURE(status2)) { lcdshadow_state = -ENODEV; return 0; } - if (!acpi_evalf(get_shadow_handle, &output, NULL, "dd", 0)) { + if (!acpi_evalf(lcdshadow_get_handle, &output, NULL, "dd", 0)) { lcdshadow_state = -EIO; return -EIO; } -- 2.26.2 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2020-07-08 16:44 UTC|newest] Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-07-08 16:43 [PATCH 0/9] drm: Add privacy-screen class and connector properties Hans de Goede 2020-07-08 16:43 ` [Intel-gfx] " Hans de Goede 2020-07-08 16:43 ` [PATCH 1/9] drm/connector: Fix kerneldoc warning Hans de Goede 2020-07-08 16:43 ` [Intel-gfx] " Hans de Goede 2020-07-08 21:26 ` Alex Deucher 2020-07-08 21:26 ` [Intel-gfx] " Alex Deucher 2020-07-08 16:43 ` [PATCH 2/9] drm/connector: Add support for privacy-screen properties (v4) Hans de Goede 2020-07-08 16:43 ` [Intel-gfx] " Hans de Goede 2020-07-08 16:43 ` [PATCH 3/9] drm: Add privacy-screen class Hans de Goede 2020-07-08 16:43 ` [Intel-gfx] " Hans de Goede 2020-07-08 16:43 ` [PATCH 4/9] drm/privacy-screen: Add X86 specific arch init code Hans de Goede 2020-07-08 16:43 ` [Intel-gfx] " Hans de Goede 2020-07-08 16:43 ` [PATCH 5/9] drm/privacy-screen: Add notifier support Hans de Goede 2020-07-08 16:43 ` [Intel-gfx] " Hans de Goede 2020-07-08 16:43 ` [PATCH 6/9] drm/connector: Add a drm_connector privacy-screen helper functions Hans de Goede 2020-07-08 16:43 ` [Intel-gfx] " Hans de Goede 2020-07-08 20:15 ` kernel test robot 2020-07-08 20:15 ` kernel test robot 2020-07-08 20:15 ` kernel test robot 2020-07-08 20:57 ` kernel test robot 2020-07-08 20:57 ` kernel test robot 2020-07-08 20:57 ` kernel test robot 2020-07-08 16:43 ` Hans de Goede [this message] 2020-07-08 16:43 ` [Intel-gfx] [PATCH 7/9] platform/x86: thinkpad_acpi: Get privacy-screen / lcdshadow ACPI handles only once Hans de Goede 2020-07-08 16:43 ` [PATCH 8/9] platform/x86: thinkpad_acpi: Register a privacy-screen device Hans de Goede 2020-07-08 16:43 ` [Intel-gfx] " Hans de Goede 2020-07-08 21:45 ` kernel test robot 2020-07-08 21:45 ` kernel test robot 2020-07-08 21:45 ` kernel test robot 2020-07-08 16:43 ` [PATCH 9/9] drm/i915: Add privacy-screen support Hans de Goede 2020-07-08 16:43 ` [Intel-gfx] " Hans de Goede 2020-07-08 16:58 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for drm: Add privacy-screen class and connector properties Patchwork 2020-07-08 19:33 ` Hans de Goede 2020-07-08 21:25 ` [PATCH 0/9] " Alex Deucher 2020-07-08 21:25 ` [Intel-gfx] " Alex Deucher 2020-07-09 12:48 ` Hans de Goede 2020-07-09 12:48 ` [Intel-gfx] " Hans de Goede 2020-07-14 15:00 ` Alex Deucher 2020-07-14 15:00 ` [Intel-gfx] " Alex Deucher 2021-09-06 7:35 Hans de Goede 2021-09-06 7:35 ` [PATCH 7/9] platform/x86: thinkpad_acpi: Get privacy-screen / lcdshadow ACPI handles only once 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=20200708164335.25097-8-hdegoede@redhat.com \ --to=hdegoede@redhat.com \ --cc=airlied@linux.ie \ --cc=daniel@ffwll.ch \ --cc=dri-devel@lists.freedesktop.org \ --cc=intel-gfx@lists.freedesktop.org \ --cc=jani.nikula@linux.intel.com \ --cc=joonas.lahtinen@linux.intel.com \ --cc=maarten.lankhorst@linux.intel.com \ --cc=marco.trevisan@canonical.com \ --cc=mripard@kernel.org \ --cc=rodrigo.vivi@intel.com \ --cc=seb128@ubuntu.com \ --cc=tzimmermann@suse.de \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.