From patchwork Mon Jan 30 18:47:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabian Frederick X-Patchwork-Id: 9545969 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 AFB47604A0 for ; Mon, 30 Jan 2017 18:50:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A209827813 for ; Mon, 30 Jan 2017 18:50:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 96B96281C3; Mon, 30 Jan 2017 18:50:53 +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 5EA4C27813 for ; Mon, 30 Jan 2017 18:50:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753999AbdA3Ssc (ORCPT ); Mon, 30 Jan 2017 13:48:32 -0500 Received: from mailrelay112.isp.belgacom.be ([195.238.20.139]:4625 "EHLO mailrelay112.isp.belgacom.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753473AbdA3Ssb (ORCPT ); Mon, 30 Jan 2017 13:48:31 -0500 X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2DbBwBCiY9Y/+M5QFddHQEXAQYBgl1pQ?= =?us-ascii?q?YEpjlCROwGQNYJEgg+CDIYigiRCFgECAQEBAQEBAWIohRcvIylxJBOJVBGtGzq?= =?us-ascii?q?EEIc1hkuJHoV/BZtUkW4NkHdIkjcmAi+BLhoYhCgBgkw/NYgyAQEB?= X-IPAS-Result: =?us-ascii?q?A2DbBwBCiY9Y/+M5QFddHQEXAQYBgl1pQYEpjlCROwGQNYJ?= =?us-ascii?q?Egg+CDIYigiRCFgECAQEBAQEBAWIohRcvIylxJBOJVBGtGzqEEIc1hkuJHoV/B?= =?us-ascii?q?ZtUkW4NkHdIkjcmAi+BLhoYhCgBgkw/NYgyAQEB?= 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:47:47 +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 07/14] PM / RUNTIME: use atomic_dec_not_zero() Date: Mon, 30 Jan 2017 19:47:43 +0100 Message-Id: <20170130184743.18402-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 --- drivers/base/power/runtime.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c index 872eac4..8ed435f 100644 --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c @@ -603,7 +603,7 @@ static int rpm_suspend(struct device *dev, int rpmflags) if (dev->parent) { parent = dev->parent; - atomic_add_unless(&parent->power.child_count, -1, 0); + atomic_dec_not_zero(&parent->power.child_count); } wake_up_all(&dev->power.wait_queue); @@ -1116,7 +1116,7 @@ int __pm_runtime_set_status(struct device *dev, unsigned int status) } if (parent) { - atomic_add_unless(&parent->power.child_count, -1, 0); + atomic_dec_not_zero(&parent->power.child_count); notify_parent = !parent->power.ignore_children; } goto out_set;