From patchwork Thu Jul 15 13:56:33 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver Neukum X-Patchwork-Id: 112237 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o6FDvLUh018171 for ; Thu, 15 Jul 2010 13:57:21 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933266Ab0GON5U (ORCPT ); Thu, 15 Jul 2010 09:57:20 -0400 Received: from cantor2.suse.de ([195.135.220.15]:37852 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933231Ab0GON5T convert rfc822-to-8bit (ORCPT ); Thu, 15 Jul 2010 09:57:19 -0400 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.221.2]) by mx2.suse.de (Postfix) with ESMTP id 0452779727; Thu, 15 Jul 2010 15:57:19 +0200 (CEST) From: Oliver Neukum Organization: SUSE To: Dmitry Torokhov Subject: [PATCH 1/3] usbtouchscreen: Implement basic suspend/resume Date: Thu, 15 Jul 2010 15:56:33 +0200 User-Agent: KMail/1.13.5 (Linux/2.6.34-12-desktop; KDE/4.4.4; x86_64; ; ) Cc: linux-input@vger.kernel.org, linux-usb@vger.kernel.org MIME-Version: 1.0 Message-Id: <201007151556.33259.oneukum@suse.de> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Thu, 15 Jul 2010 13:57:21 +0000 (UTC) diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c index 567d572..f51d2fd 100644 --- a/drivers/input/touchscreen/usbtouchscreen.c +++ b/drivers/input/touchscreen/usbtouchscreen.c @@ -1291,6 +1291,27 @@ static void usbtouch_close(struct input_dev *input) usb_kill_urb(usbtouch->irq); } +static int usbtouch_suspend +(struct usb_interface *intf, pm_message_t message) +{ + struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); + + usb_kill_urb(usbtouch->irq); + return 0; +} + +static int usbtouch_resume(struct usb_interface *intf) +{ + struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); + struct input_dev *input = usbtouch->input; + int result = 0; + + mutex_lock(&input->mutex); + if (input->users || usbtouch->type->irq_always) + result = usb_submit_urb(usbtouch->irq, GFP_NOIO); + mutex_unlock(&input->mutex); + return result; +} static void usbtouch_free_buffers(struct usb_device *udev, struct usbtouch_usb *usbtouch) @@ -1481,6 +1502,8 @@ static struct usb_driver usbtouch_driver = { .name = "usbtouchscreen", .probe = usbtouch_probe, .disconnect = usbtouch_disconnect, + .suspend = usbtouch_suspend, + .resume = usbtouch_resume, .id_table = usbtouch_devices, };