From patchwork Mon Jan 30 18:48:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabian Frederick X-Patchwork-Id: 9545967 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4C8B5604A0 for ; Mon, 30 Jan 2017 18:50:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3EF102811E for ; Mon, 30 Jan 2017 18:50:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 33E00281A7; Mon, 30 Jan 2017 18:50:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D98A22811E for ; Mon, 30 Jan 2017 18:50:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753936AbdA3SuO (ORCPT ); Mon, 30 Jan 2017 13:50:14 -0500 Received: from mailrelay112.isp.belgacom.be ([195.238.20.139]:44804 "EHLO mailrelay112.isp.belgacom.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754003AbdA3Ssd (ORCPT ); Mon, 30 Jan 2017 13:48:33 -0500 X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2ATAwBCiY9Y/+M5QFddHQEXAQYBgl1pQ?= =?us-ascii?q?YEpjlCROwGQNYJEgg+CDIYcBAKCJEAYAQIBAQEBAQEBYiiFRiMpcSQTiVQRrVW?= =?us-ascii?q?EEIc1hkuJCBaFfwWbVJFuDYFhjxZIkjcfOIEuGhiEKAGCTD81hXaCPAEBAQ?= X-IPAS-Result: =?us-ascii?q?A2ATAwBCiY9Y/+M5QFddHQEXAQYBgl1pQYEpjlCROwGQNYJ?= =?us-ascii?q?Egg+CDIYcBAKCJEAYAQIBAQEBAQEBYiiFRiMpcSQTiVQRrVWEEIc1hkuJCBaFf?= =?us-ascii?q?wWbVJFuDYFhjxZIkjcfOIEuGhiEKAGCTD81hXaCPAEBAQ?= Received: from 227.57-64-87.adsl-dyn.isp.belgacom.be (HELO localhost.localdomain) ([87.64.57.227]) by relay.skynet.be with ESMTP; 30 Jan 2017 19:48:23 +0100 From: Fabian Frederick To: Andrew Morton Cc: linux-kernel@vger.kernel.org, rjw@rjwysocki.net, linux-pm@vger.kernel.org, Fabian Frederick Subject: [PATCH 11/14] PM: use atomic_dec_not_zero() Date: Mon, 30 Jan 2017 19:48:21 +0100 Message-Id: <20170130184821.18943-1-fabf@skynet.be> X-Mailer: git-send-email 2.9.3 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP instead of atomic_add_unless(value, -1, 0) Signed-off-by: Fabian Frederick --- kernel/power/user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/power/user.c b/kernel/power/user.c index 22df9f7..c478572 100644 --- a/kernel/power/user.c +++ b/kernel/power/user.c @@ -54,7 +54,7 @@ static int snapshot_open(struct inode *inode, struct file *filp) lock_system_sleep(); - if (!atomic_add_unless(&snapshot_device_available, -1, 0)) { + if (!atomic_dec_not_zero(&snapshot_device_available)) { error = -EBUSY; goto Unlock; }