From: Keith Packard <keithp@keithp.com>
Cc: intel-gfx@lists.freedesktop.org, linux-acpi@vger.kernel.org,
Matthew Garrett <mjg@redhat.com>
Subject: Re: [PATCH] i915: Fix opregion notifications
Date: Tue, 12 Jul 2011 15:20:23 -0700 [thread overview]
Message-ID: <yunhb6rjg48.fsf@aiko.keithp.com> (raw)
In-Reply-To: <1310507496-20116-1-git-send-email-mjg@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1688 bytes --]
On Tue, 12 Jul 2011 17:51:36 -0400, Matthew Garrett <mjg@redhat.com> wrote:
> - keycode = KEY_SWITCHVIDEOMODE;
> + if (!acpi_notifier_call_chain(device, event, 0))
> + keycode = KEY_SWITCHVIDEOMODE;
Right, acpi_notify_call_chain returns -EINVAL when the underlying
function call returns NOTIFY_BAD.
> - acpi_notifier_call_chain(device, event, 0);
> + if (event != ACPI_VIDEO_NOTIFY_SWITCH)
> + acpi_notifier_call_chain(device, event, 0);
Not ideal to have two calls to this function only one of which will be
used. Could look like
bool check_call_chain = false;
...
case ACPI_VIDEO_NOTIFY_SWITCH:
acpi_bus_generate_proc_event(device, event, 0);
keycode = KEY_SWITCHVIDEOMODE;
check_call_chain = true
break;
...
if (acpi_notifier_call_chain(device, event, 0) < 0)
if (check_call_chain)
keycode = 0;
Feel free to just call me for bikeshedding.
> + if (strcmp(event->device_class, ACPI_VIDEO_CLASS))
> + return NOTIFY_DONE;
I'm not entirely clear on accepted coding style here, but I'd much
rather this look like:
if (strcmp(event->device_class, ACPI_VIDEO_CLASS) != 0)
I must have read this four times before I figured out that you weren't
early returning on all "video" devices...
> +
> + if (event->type == 0x80 && !(acpi->cevt & 0x1))
> + ret = NOTIFY_BAD;
> +
Seriously? It's some kind of magic non-switch switch event? And you can
tell by checking magic bits within the event?
How can I test this and know if it works?
--
keith.packard@intel.com
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2011-07-12 22:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-12 21:51 [PATCH] i915: Fix opregion notifications Matthew Garrett
2011-07-12 22:20 ` Keith Packard [this message]
2011-07-12 22:30 ` Matthew Garrett
2011-07-12 22:30 ` [PATCH V2] " Matthew Garrett
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=yunhb6rjg48.fsf@aiko.keithp.com \
--to=keithp@keithp.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=linux-acpi@vger.kernel.org \
--cc=mjg@redhat.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