diff options
| author | Alex Sarraf <asarraf@codeaurora.org> | 2017-03-23 13:13:06 -0700 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2017-04-19 16:19:25 -0700 |
| commit | 78f7468f2e03153e2f779ed75a76539abb9ae607 (patch) | |
| tree | 31982b79cb6c73e67a38ac6394ad476ac87d626d /drivers/input/misc | |
| parent | 1342831f8a82969fedf9d83d1799b4e24e95eaaa (diff) | |
input: misc: hbtp_input: filter out fb events
Filter out the fb events which don't need to be handled.
Change-Id: I0dd748aec54594454f0d5333255f1ccb71b49201
Signed-off-by: Alex Sarraf <asarraf@codeaurora.org>
Diffstat (limited to 'drivers/input/misc')
| -rw-r--r-- | drivers/input/misc/hbtp_input.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/drivers/input/misc/hbtp_input.c b/drivers/input/misc/hbtp_input.c index 6d2e7a569044..21898c308075 100644 --- a/drivers/input/misc/hbtp_input.c +++ b/drivers/input/misc/hbtp_input.c @@ -109,10 +109,27 @@ static int fb_notifier_callback(struct notifier_block *self, { int blank; struct fb_event *evdata = data; + struct fb_info *fbi = NULL; struct hbtp_data *hbtp_data = container_of(self, struct hbtp_data, fb_notif); - if (evdata && evdata->data && hbtp_data && + if (!evdata) { + pr_debug("evdata is NULL"); + return 0; + } + fbi = evdata->info; + + /* + * Node 0 is the primary display and others are + * external displays such as HDMI/DP. + * We need to handle only fb event for the primary display. + */ + if (!fbi || fbi->node != 0) { + pr_debug("%s: no need to handle the fb event", __func__); + return 0; + } + + if (evdata->data && hbtp_data && (event == FB_EARLY_EVENT_BLANK || event == FB_R_EARLY_EVENT_BLANK)) { blank = *(int *)(evdata->data); @@ -141,7 +158,7 @@ static int fb_notifier_callback(struct notifier_block *self, } } - if (evdata && evdata->data && hbtp_data && + if (evdata->data && hbtp_data && event == FB_EVENT_BLANK) { blank = *(int *)(evdata->data); if (blank == FB_BLANK_POWERDOWN) { |
