From patchwork Fri Mar 12 10:39:39 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver Neukum X-Patchwork-Id: 85241 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 o2CAdk5d016220 for ; Fri, 12 Mar 2010 10:39:48 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757449Ab0CLKjq (ORCPT ); Fri, 12 Mar 2010 05:39:46 -0500 Received: from smtp-out003.kontent.com ([81.88.40.217]:46660 "EHLO smtp-out003.kontent.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757270Ab0CLKjp convert rfc822-to-8bit (ORCPT ); Fri, 12 Mar 2010 05:39:45 -0500 Received: from vanamonde.localnet (unknown [82.113.121.127]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: neukum_org@smtp-out003.kontent.com) by smtp-out003.kontent.com (Postfix) with ESMTPSA id 27326400036D; Fri, 12 Mar 2010 11:39:44 +0100 (CET) To: edouard.tisserant@wanadoo.fr Subject: [RFT 1/2] USB: acecad: Implement suspend/resume Cc: svoltz@numericable.fr, linux-input@vger.kernel.org, USB list From: Oliver Neukum Date: Fri, 12 Mar 2010 11:39:39 +0100 MIME-Version: 1.0 Message-Id: <201003121139.39631.oliver@neukum.org> 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]); Fri, 12 Mar 2010 10:39:48 +0000 (UTC) diff --git a/drivers/input/tablet/acecad.c b/drivers/input/tablet/acecad.c index 670c61c..bf5bffb 100644 --- a/drivers/input/tablet/acecad.c +++ b/drivers/input/tablet/acecad.c @@ -56,6 +56,7 @@ struct usb_acecad { unsigned char *data; dma_addr_t data_dma; + bool submitted; }; static void usb_acecad_irq(struct urb *urb) @@ -116,6 +117,7 @@ static int usb_acecad_open(struct input_dev *dev) acecad->irq->dev = acecad->usbdev; if (usb_submit_urb(acecad->irq, GFP_KERNEL)) return -EIO; + acecad->submitted = true; return 0; } @@ -124,6 +126,7 @@ static void usb_acecad_close(struct input_dev *dev) { struct usb_acecad *acecad = input_get_drvdata(dev); + acecad->submitted = false; usb_kill_urb(acecad->irq); } @@ -261,6 +264,25 @@ static void usb_acecad_disconnect(struct usb_interface *intf) } } +static int usb_acecad_suspend(struct usb_interface *intf, pm_message_t message) +{ + struct usb_acecad *acecad = usb_get_intfdata(intf); + + usb_kill_urb(acecad->irq); + return 0; +} + +static int usb_acecad_resume(struct usb_interface *intf) +{ + struct usb_acecad *acecad = usb_get_intfdata(intf); + int rv = 0; + + if (acecad->submitted) + rv = usb_submit_urb(acecad->irq, GFP_NOIO); + + return rv; +} + static struct usb_device_id usb_acecad_id_table [] = { { USB_DEVICE(USB_VENDOR_ID_ACECAD, USB_DEVICE_ID_FLAIR), .driver_info = 0 }, { USB_DEVICE(USB_VENDOR_ID_ACECAD, USB_DEVICE_ID_302), .driver_info = 1 }, @@ -273,6 +295,8 @@ static struct usb_driver usb_acecad_driver = { .name = "usb_acecad", .probe = usb_acecad_probe, .disconnect = usb_acecad_disconnect, + .suspend = usb_acecad_suspend, + .resume = usb_acecad_resume, .id_table = usb_acecad_id_table, };