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=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 7139FC06510 for ; Mon, 1 Jul 2019 14:17:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5364B21721 for ; Mon, 1 Jul 2019 14:17:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729484AbfGAORJ (ORCPT ); Mon, 1 Jul 2019 10:17:09 -0400 Received: from iolanthe.rowland.org ([192.131.102.54]:51310 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1727185AbfGAORI (ORCPT ); Mon, 1 Jul 2019 10:17:08 -0400 Received: (qmail 1620 invoked by uid 2102); 1 Jul 2019 10:17:07 -0400 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 1 Jul 2019 10:17:07 -0400 Date: Mon, 1 Jul 2019 10:17:07 -0400 (EDT) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Oliver Neukum cc: Mayuresh Kulkarni , Greg KH , , USB list Subject: Re: [PATCH] usb: core: devio: add ioctls for suspend and resume In-Reply-To: <1561972691.10014.8.camel@suse.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org On Mon, 1 Jul 2019, Oliver Neukum wrote: > Am Donnerstag, den 27.06.2019, 09:52 -0400 schrieb Alan Stern: > > > > > Or maybe the WAIT_FOR_RESUME ioctl returns because there was a remote > > wakeup. In this case also you would call FORBID_SUSPEND. > > > > In fact, you should call FORBID_SUSPEND _whenever_ WAIT_FOR_RESUME > > Well, this kind of indicates that the original syscall should bump > the counter. Perhaps it does, but... > > returns, unless your program has decided not to use the device any more > > (in which case you don't care whether the device is suspended or > > resumed). > > Then you should close the device. Exactly. Suppose WAIT_FOR_RESUME is interrupted and then the program closes the device. There's no need to force the device back to full power in this situation. Alan Stern