From patchwork Mon Mar 18 05:50:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dhruva Gole X-Patchwork-Id: 13595035 Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1148922EE0; Mon, 18 Mar 2024 06:06:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.23.248 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710742014; cv=none; b=diEss45mhLaf+upXgrMSDiosLHZMJtEm/zfqwC1bqlUmD5GjA1bZnVNRQxQsOtptMcRvEHFmUJ2nUSySOUKIJU2+P/vQ0KGugN/G89Bh8UPRJGGijbeVYXu2pMXV/TGjjYTJVOcX9zfuZaG/ysG4EP56wcO4mlF4tzDzsToVKQE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710742014; c=relaxed/simple; bh=jaZkv8i6NdJT+wHMF9ub75fSWECjyHOvXBytAWOA6+I=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=S+DaVBAABvcQYH7NZnf7yQcTJ4VZKHXmn+ARvgtM7NggLcsRTA+3JLEIcc4ti3LHQ8cej34RaRE+S9dmGSec4w8xQjTE1A7vbryo2qdP5JgXkiIAZWP8dEzIHS0Iy4VRlE1BXVZ1X/WxXzRSCMpW1d+4tJs57Uw1KnVM5Pi2Ge0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=W35K4ywy; arc=none smtp.client-ip=198.47.23.248 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="W35K4ywy" Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 42I5tVCW053441; Mon, 18 Mar 2024 00:55:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1710741331; bh=IIMeYQhVJsMjHJOrO1EdAXLf7xCV4g1QUz3hfpcGY/A=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=W35K4ywypteT3P3yrYzqpECRvbU8xZwd+e/ZAmGW/bc8CCfEK8vtTd48hP1gNPyfq oR4OTqJ4ZuVw7Fgmk3TxxMfDNiA+LYmNl/TH1EXrgSd5fMqK7VuTI606pbbwof4fPm c9U7T7JAQR1zGA5C6aE6f4S4ZAzUmh3swquGUlYs= Received: from DLEE101.ent.ti.com (dlee101.ent.ti.com [157.170.170.31]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 42I5tVNx016614 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 18 Mar 2024 00:55:31 -0500 Received: from DLEE105.ent.ti.com (157.170.170.35) by DLEE101.ent.ti.com (157.170.170.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Mon, 18 Mar 2024 00:55:30 -0500 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DLEE105.ent.ti.com (157.170.170.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Mon, 18 Mar 2024 00:55:30 -0500 Received: from dhruva.dhcp.ti.com (dhruva.dhcp.ti.com [172.24.227.68]) by lelvsmtp5.itg.ti.com (8.15.2/8.15.2) with ESMTP id 42I5tKiF082113; Mon, 18 Mar 2024 00:55:27 -0500 From: Dhruva Gole To: Ulf Hansson , "Rafael J. Wysocki" , Adrian Hunter CC: Tony Lindgren , Len Brown , Pavel Machek , Greg Kroah-Hartman , Viresh Kumar , , Dhruva Gole , , , Subject: [PATCH 1/3] PM: wakeup: make device_wakeup_disable return void Date: Mon, 18 Mar 2024 11:20:52 +0530 Message-ID: <20240318055054.1564696-2-d-gole@ti.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240318055054.1564696-1-d-gole@ti.com> References: <20240318055054.1564696-1-d-gole@ti.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 The device_wakeup_disable call only returns an error if no dev exists however there's not much a user can do at that point. Rather make this function return void. Signed-off-by: Dhruva Gole --- drivers/base/power/wakeup.c | 11 +++++++---- include/linux/pm_wakeup.h | 5 ++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c index a917219feea6..752b417e8129 100644 --- a/drivers/base/power/wakeup.c +++ b/drivers/base/power/wakeup.c @@ -451,16 +451,15 @@ static struct wakeup_source *device_wakeup_detach(struct device *dev) * Detach the @dev's wakeup source object from it, unregister this wakeup source * object and destroy it. */ -int device_wakeup_disable(struct device *dev) +void device_wakeup_disable(struct device *dev) { struct wakeup_source *ws; if (!dev || !dev->power.can_wakeup) - return -EINVAL; + return; ws = device_wakeup_detach(dev); wakeup_source_unregister(ws); - return 0; } EXPORT_SYMBOL_GPL(device_wakeup_disable); @@ -502,7 +501,11 @@ EXPORT_SYMBOL_GPL(device_set_wakeup_capable); */ int device_set_wakeup_enable(struct device *dev, bool enable) { - return enable ? device_wakeup_enable(dev) : device_wakeup_disable(dev); + if (enable) + return device_wakeup_enable(dev); + + device_wakeup_disable(dev); + return 0; } EXPORT_SYMBOL_GPL(device_set_wakeup_enable); diff --git a/include/linux/pm_wakeup.h b/include/linux/pm_wakeup.h index 6eb9adaef52b..428803eed798 100644 --- a/include/linux/pm_wakeup.h +++ b/include/linux/pm_wakeup.h @@ -107,7 +107,7 @@ extern void wakeup_sources_read_unlock(int idx); extern struct wakeup_source *wakeup_sources_walk_start(void); extern struct wakeup_source *wakeup_sources_walk_next(struct wakeup_source *ws); extern int device_wakeup_enable(struct device *dev); -extern int device_wakeup_disable(struct device *dev); +extern void device_wakeup_disable(struct device *dev); extern void device_set_wakeup_capable(struct device *dev, bool capable); extern int device_set_wakeup_enable(struct device *dev, bool enable); extern void __pm_stay_awake(struct wakeup_source *ws); @@ -154,10 +154,9 @@ static inline int device_wakeup_enable(struct device *dev) return 0; } -static inline int device_wakeup_disable(struct device *dev) +static inline void device_wakeup_disable(struct device *dev) { dev->power.should_wakeup = false; - return 0; } static inline int device_set_wakeup_enable(struct device *dev, bool enable) From patchwork Mon Mar 18 05:50:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dhruva Gole X-Patchwork-Id: 13595033 Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1B0CD2206B; Mon, 18 Mar 2024 06:06:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.23.248 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710742010; cv=none; b=RDCHiXgiaPUZdXleXz8PSNz/1NwDcKctz358rAB91BgfPdGSN7X3nUS7sNXZz1KXiNsk6YjLQb5QlTxcQr5lJUyYKq4fRK6uokDWJCSMGXmQZM4QUdbuxnzId+TOvyqRP3Yek5PqTBaflAFjw5d2Ld/BblXsiNxMo02X7iOh8ro= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710742010; c=relaxed/simple; bh=3m20nb+0fwc41U7YJQ9XAzJmFBzXIOodTQ3VpSG1EFc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=jnqlmDGITTCjyA01NcfGOUD740529/R0Y23wWRz97Lz2TZJ6qI9tx4thWDC4J4ts/RGw8Z5Y6C188+wufhSaEQjwKnaeVHlKXTsDl4YodwkW8HkzXBbbhhkhhf6yW7rMqOrc5NE8gqd+xskOlVuIUoccJukK64zPY1Vq6gEerT4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=ZC4ig9+P; arc=none smtp.client-ip=198.47.23.248 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="ZC4ig9+P" Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 42I5te7v053540; Mon, 18 Mar 2024 00:55:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1710741340; bh=dBZehhRkwqiGdVM7akbnBQ3ei6Ss2qkowGyOhsxBVUY=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=ZC4ig9+PieoM6nGPOI5B8WHPapayBcSHh6QUEua2Pb8luGMyec0EQsWN1ns0Om5LM sZn5gD3Ryj5TWg5HJ0wAIsyd55/QdnWN7DbE4AjAv5xHLP1nOqGI9m6CX48cfWoA5o OR8CUXCWN7/0iCNzsF1TbQeFe6gDNsqZOC0RZxAA= Received: from DLEE104.ent.ti.com (dlee104.ent.ti.com [157.170.170.34]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 42I5ter6027858 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 18 Mar 2024 00:55:40 -0500 Received: from DLEE109.ent.ti.com (157.170.170.41) by DLEE104.ent.ti.com (157.170.170.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Mon, 18 Mar 2024 00:55:39 -0500 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DLEE109.ent.ti.com (157.170.170.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Mon, 18 Mar 2024 00:55:39 -0500 Received: from dhruva.dhcp.ti.com (dhruva.dhcp.ti.com [172.24.227.68]) by lelvsmtp5.itg.ti.com (8.15.2/8.15.2) with ESMTP id 42I5tKiG082113; Mon, 18 Mar 2024 00:55:36 -0500 From: Dhruva Gole To: Ulf Hansson , "Rafael J. Wysocki" , Adrian Hunter CC: Tony Lindgren , Len Brown , Pavel Machek , Greg Kroah-Hartman , Viresh Kumar , , Dhruva Gole , , , Subject: [PATCH 2/3] PM: wakeup: Remove unnecessary else from device_init_wakeup Date: Mon, 18 Mar 2024 11:20:53 +0530 Message-ID: <20240318055054.1564696-3-d-gole@ti.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240318055054.1564696-1-d-gole@ti.com> References: <20240318055054.1564696-1-d-gole@ti.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Checkpatch warns that else is generally not necessary after a return condition which exists in the if part of this function. Hence, just to abide by what checkpatch recommends, follow it's guidelines. Signed-off-by: Dhruva Gole --- include/linux/pm_wakeup.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/include/linux/pm_wakeup.h b/include/linux/pm_wakeup.h index 428803eed798..76cd1f9f1365 100644 --- a/include/linux/pm_wakeup.h +++ b/include/linux/pm_wakeup.h @@ -234,11 +234,10 @@ static inline int device_init_wakeup(struct device *dev, bool enable) if (enable) { device_set_wakeup_capable(dev, true); return device_wakeup_enable(dev); - } else { - device_wakeup_disable(dev); - device_set_wakeup_capable(dev, false); - return 0; } + device_wakeup_disable(dev); + device_set_wakeup_capable(dev, false); + return 0; } #endif /* _LINUX_PM_WAKEUP_H */ From patchwork Mon Mar 18 05:50:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dhruva Gole X-Patchwork-Id: 13595034 Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 215CC2231A; Mon, 18 Mar 2024 06:06:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.23.248 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710742012; cv=none; b=PWAIrCaObAcmhHjCG5z8MEsO+dHvuxFj/Vdbjjhvb0IxyLhfS81tjQ/dE/q+l2BjvhkgEq5m2J8FMcrZU6GaxGCTGLxDZ6Z5q8LbPYWaO+x+qhLtJ7pwBfEhfo2DIifZ3rzlxgOaZgLRGX9ofm0TJLNOoiR7Vo5DkpkuRM2EgTo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710742012; c=relaxed/simple; bh=/8870Dm7p0rzChEjvnJzeI0cna0UOQm4+Lk6NWHpQ4w=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=jsDffqke07ZT3Z3SJq3D3cBeJfYK0Frcu7rqLQA1ixKkRhLAD5GkFrjrHUeHE6mvkv5qdffGZGUTf1Hy7bTYRyokZl0l6+u9B4wxTNVMZOZFUGsWs6dqX0jHvk5fdGmioAB7H0Kh2vwwd8+yd6ni0AUCR+2/Vc28w95e0MQCBQA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=eyXT3Kgj; arc=none smtp.client-ip=198.47.23.248 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="eyXT3Kgj" Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 42I5tjdm053565; Mon, 18 Mar 2024 00:55:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1710741345; bh=ZnWHo1ylR1YM6vl9GkHOqIy0gOs+L02Pz8cQsQr87ao=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=eyXT3KgjturL8Km09bHGM9ezo7KnEBaoezEJ0Jo7OH5z+LPxmT++bxf91VRHPw4VW mVzTL7oWoGdvHOrHUhYb7YLDnc0xYJt3e+JxN7v+OT3l/cI6n3iCA4WX54MosAt/1x S0bQIDCqevLWHIIMB5uJgeSRjkDU4+8MFFsaNOBs= Received: from DFLE102.ent.ti.com (dfle102.ent.ti.com [10.64.6.23]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 42I5tjIt086260 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 18 Mar 2024 00:55:45 -0500 Received: from DFLE115.ent.ti.com (10.64.6.36) by DFLE102.ent.ti.com (10.64.6.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Mon, 18 Mar 2024 00:55:45 -0500 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DFLE115.ent.ti.com (10.64.6.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Mon, 18 Mar 2024 00:55:45 -0500 Received: from dhruva.dhcp.ti.com (dhruva.dhcp.ti.com [172.24.227.68]) by lelvsmtp5.itg.ti.com (8.15.2/8.15.2) with ESMTP id 42I5tKiH082113; Mon, 18 Mar 2024 00:55:41 -0500 From: Dhruva Gole To: Ulf Hansson , "Rafael J. Wysocki" , Adrian Hunter CC: Tony Lindgren , Len Brown , Pavel Machek , Greg Kroah-Hartman , Viresh Kumar , , Dhruva Gole , , , Subject: [PATCH 3/3] mmc: sdhci-pci: Use device_set_wakeup_enable for en/disable wakeups Date: Mon, 18 Mar 2024 11:20:54 +0530 Message-ID: <20240318055054.1564696-4-d-gole@ti.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240318055054.1564696-1-d-gole@ti.com> References: <20240318055054.1564696-1-d-gole@ti.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 There exists device_set_wakeup_enable for wrapping device_wakeup_enable and device_wakeup_disable. Use that instead to avoid confusion in returning from a void vs int function. Signed-off-by: Dhruva Gole --- I do not have the hardware to test out this driver, hence requesting someone to review/ test it if atall you suspect that this change can break existing functionality. drivers/mmc/host/sdhci-pci-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c index 025b31aa712c..db614389a5fc 100644 --- a/drivers/mmc/host/sdhci-pci-core.c +++ b/drivers/mmc/host/sdhci-pci-core.c @@ -61,9 +61,9 @@ static int sdhci_pci_init_wakeup(struct sdhci_pci_chip *chip) } if ((pm_flags & MMC_PM_KEEP_POWER) && (pm_flags & MMC_PM_WAKE_SDIO_IRQ)) - return device_wakeup_enable(&chip->pdev->dev); + return device_set_wakeup_enable(&chip->pdev->dev, true); else if (!cap_cd_wake) - return device_wakeup_disable(&chip->pdev->dev); + return device_set_wakeup_enable(&chip->pdev->dev, false); return 0; }