[PATCH xserver 08/20] hw/kdrive: Use NotifyFd interface for kdrive/linux APM monitoring

Adam Jackson ajax at nwnk.net
Tue Nov 17 12:11:07 PST 2015


On Wed, 2015-11-11 at 22:02 -0800, Keith Packard wrote:
> 
>  static void
> -LinuxApmWakeup(void *blockData, int result, void *pReadmask)
> +LinuxApmNotify(int fd, int mask, void *blockData)
>  {
> -    fd_set *readmask = (fd_set *) pReadmask;
> -
> -    if (result > 0 && LinuxApmFd >= 0 && FD_ISSET(LinuxApmFd, readmask)) {
> +    if (LinuxApmFd >= 0) {
>          apm_event_t event;
>          Bool running = LinuxApmRunning;
>          int cmd = APM_IOC_SUSPEND;

This tripped me up at first (here and elsewhere in the series), it
looks weird to read an fd that isn't the one passed in as an argument. 
I think you'd generate infinitesimally better code to use the argument
and not the global since the argument form is never going to be a cache
miss; I'm not sure I care enough to press the point, but maybe that's
measurable on arm or something.

- ajax


More information about the xorg-devel mailing list