From patchwork Mon Jun 7 13:13:36 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver Neukum X-Patchwork-Id: 104769 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o57DDIQ7021888 for ; Mon, 7 Jun 2010 13:13:18 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753926Ab0FGNNS (ORCPT ); Mon, 7 Jun 2010 09:13:18 -0400 Received: from cantor2.suse.de ([195.135.220.15]:36971 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751189Ab0FGNNR convert rfc822-to-8bit (ORCPT ); Mon, 7 Jun 2010 09:13:17 -0400 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.221.2]) by mx2.suse.de (Postfix) with ESMTP id 6F2FD8655F; Mon, 7 Jun 2010 15:13:16 +0200 (CEST) From: Oliver Neukum Organization: SUSE To: linux-input@vger.kernel.org Subject: [PATCH 1/3] usbtouchscreen: Implement basic suspend/resume Date: Mon, 7 Jun 2010 15:13:36 +0200 User-Agent: KMail/1.12.4 (Linux/2.6.34-rc6-0.1-default; KDE/4.3.5; x86_64; ; ) Cc: linux-usb@vger.kernel.org, Daniel Ritz MIME-Version: 1.0 Message-Id: <201006071513.36531.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]); Mon, 07 Jun 2010 13:13:19 +0000 (UTC) diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c index 567d572..6d23c0e 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) + 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, };