From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70F7EC433FF for ; Thu, 8 Aug 2019 15:37:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F205D2173E for ; Thu, 8 Aug 2019 15:37:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=kroah.com header.i=@kroah.com header.b="Gu0FgkZM"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="GXOZOXNJ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733288AbfHHPhO (ORCPT ); Thu, 8 Aug 2019 11:37:14 -0400 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]:50461 "EHLO wout4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728380AbfHHPhO (ORCPT ); Thu, 8 Aug 2019 11:37:14 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 82878447; Thu, 8 Aug 2019 11:37:10 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Thu, 08 Aug 2019 11:37:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kroah.com; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm1; bh=4ex3c4h0E8jpnEKC/wfItoI+aaM e2/EFph/b/bQe57c=; b=Gu0FgkZMIfp2ifnnPQNZKALI4PYOzu5XvI9LCVJMvea M5zl+6rBchWxctl3oH+xelkHKlTvCo2Dc41nQEG+Wbvm9DfzMENj8gYpxRYqUTTM Sgv6vUgThYhIXwj4oYn7CfibL8j0TI+LQM1eXmdlbB5GWEIXLdfTMVIYboQpZzWM lYuU43fSFGzteWiRYNUKxedyuE7b35Hjgo3T0Dt+MO0u3grFQIoeQtHIY1KqEaZt ZzbjpGCCMODHlgd9Oa/oJO2QEdzGK8wrxemisFtZW2XU1UlQOBQ/9rIMNnBlde2b Lvshwfq3RjczwsQfyLCez9sH4NtG1eUW8bF2N5dKYNg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=4ex3c4 h0E8jpnEKC/wfItoI+aaMe2/EFph/b/bQe57c=; b=GXOZOXNJtW6qGUG4enZl0m 6ErcnqtzDzIKJssAGYNVASEizzYanJuWZz4AxkdcEvK2jFjhtNCX11+46hfOGKLc VA3/ttp/bjmfqbRoJzhmeIhZyYucxsLGsirL6n/MaZk/cvuWE+ACDWgJf1ZL1Wfc dn9W4kJ4r+hERhEAxTjEneFL2E8PKan50uJKErc1BFnUZEbsNNkyDpcYojBWYRsO wCEdIAixSjorLz3whchCWmAx2rbpnMTVieZ6foLEIZtaND2DsfHKwU1x+fK/0lVG YlT4quI8LHnW5pr2LUNDQvOB32Jat3uigACsl7zxjgPbBul081vqGkFIckjLwE2w == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrudduhedgleduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjfgesthdtredttdervdenucfhrhhomhepifhrvghg ucfmjfcuoehgrhgvgheskhhrohgrhhdrtghomheqnecukfhppeekfedrkeeirdekledrud dtjeenucfrrghrrghmpehmrghilhhfrhhomhepghhrvghgsehkrhhorghhrdgtohhmnecu vehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) by mail.messagingengine.com (Postfix) with ESMTPA id 1E149380085; Thu, 8 Aug 2019 11:37:09 -0400 (EDT) Date: Thu, 8 Aug 2019 17:37:07 +0200 From: Greg KH To: Alan Stern Cc: Mayuresh Kulkarni , USB list Subject: Re: [PATCH v2] usbfs: Add ioctls for runtime power management Message-ID: <20190808153707.GA15091@kroah.com> References: <1565163465.8136.36.camel@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org On Wed, Aug 07, 2019 at 10:29:50AM -0400, Alan Stern wrote: > It has been requested that usbfs should implement runtime power > management, instead of forcing the device to remain at full power as > long as the device file is open. This patch introduces that new > feature. > > It does so by adding three new usbfs ioctls: > > USBDEVFS_FORBID_SUSPEND: Prevents the device from going into > runtime suspend (and causes a resume if the device is already > suspended). > > USBDEVFS_ALLOW_SUSPEND: Allows the device to go into runtime > suspend. Some time may elapse before the device actually is > suspended, depending on things like the autosuspend delay. > > USBDEVFS_WAIT_FOR_RESUME: Blocks until the call is interrupted > by a signal or at least one runtime resume has occurred since > the most recent ALLOW_SUSPEND ioctl call (which may mean > immediately, even if the device is currently suspended). In > the latter case, the device is prevented from suspending again > just as if FORBID_SUSPEND was called before the ioctl returns. > > For backward compatibility, when the device file is first opened > runtime suspends are forbidden. The userspace program can then allow > suspends whenever it wants, and either resume the device directly (by > forbidding suspends again) or wait for a resume from some other source > (such as a remote wakeup). URBs submitted to a suspended device will > fail or will complete with an appropriate error code. > > This combination of ioctls is sufficient for user programs to have > nearly the same degree of control over a device's runtime power > behavior as kernel drivers do. > > Still lacking is documentation for the new ioctls. I intend to add it > later, after the existing documentation for the usbfs userspace API is > straightened out into a reasonable form. > > Suggested-by: Mayuresh Kulkarni > Signed-off-by: Alan Stern > > --- > > v2: Return -EINTR instead of -ERESTARTSYS when proc_wait_for_resume() > is interrupted by a signal. Looks great, thanks for doing this. Now queued up. greg k-h