From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934331Ab0EZKuz (ORCPT ); Wed, 26 May 2010 06:50:55 -0400 Received: from casper.infradead.org ([85.118.1.10]:50921 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934140Ab0EZKux convert rfc822-to-8bit (ORCPT ); Wed, 26 May 2010 06:50:53 -0400 Subject: Re: [PATCH 2/8] PM: suspend_block: Add driver to access suspend blockers from user-space From: Peter Zijlstra To: Arve =?ISO-8859-1?Q?Hj=F8nnev=E5g?= Cc: linux-pm@lists.linux-foundation.org, linux-kernel@vger.kernel.org, "Rafael J. Wysocki" , Randy Dunlap , Andrew Morton , Ryusuke Konishi , Jim Collar , Greg Kroah-Hartman , Avi Kivity , Len Brown , Pavel Machek , Magnus Damm , Cornelia Huck , Nigel Cunningham , linux-doc@vger.kernel.org In-Reply-To: References: <1274482015-30899-1-git-send-email-arve@android.com> <1274482015-30899-2-git-send-email-arve@android.com> <1274482015-30899-3-git-send-email-arve@android.com> <1274863428.5882.4860.camel@twins> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT Date: Wed, 26 May 2010 12:50:05 +0200 Message-ID: <1274871005.5882.5315.camel@twins> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2010-05-26 at 03:47 -0700, Arve Hjønnevåg wrote: > 2010/5/26 Peter Zijlstra : > > On Fri, 2010-05-21 at 15:46 -0700, Arve Hjønnevåg wrote: > >> +To create a suspend blocker from user space, open the suspend_blocker > >> special > >> +device file: > >> + > >> + fd = open("/dev/suspend_blocker", O_RDWR | O_CLOEXEC); > >> + > >> +then optionally call: > >> + > >> + ioctl(fd, SUSPEND_BLOCKER_IOCTL_SET_NAME(strlen(name)), name); > >> + > >> +To activate the suspend blocker call: > >> + > >> + ioctl(fd, SUSPEND_BLOCKER_IOCTL_BLOCK); > >> + > >> +To deactivate it call: > >> + > >> + ioctl(fd, SUSPEND_BLOCKER_IOCTL_UNBLOCK); > >> + > >> +To destroy the suspend blocker, close the device: > >> + > >> + close(fd); > > > > Urgh, please let the open() be BLOCK, the close() be UNBLOCK, and keep > > the SET_NAME thing if you really care. > > > > That would be very inefficient. How so? Anyway, since you admitted this thing isn't needed at all, I say we remove it altogether.