From patchwork Tue Sep 3 17:04:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 1980233 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=nMW5qUla; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=139.178.88.99; helo=sv.mirrors.kernel.org; envelope-from=linux-gpio+bounces-9695-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WysXK5jQnz1yZ9 for ; Wed, 4 Sep 2024 03:08:33 +1000 (AEST) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 685EB285917 for ; Tue, 3 Sep 2024 17:08:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EB40E18CC1C; Tue, 3 Sep 2024 17:08:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="nMW5qUla" X-Original-To: linux-gpio@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (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 3AF916F315; Tue, 3 Sep 2024 17:08:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725383290; cv=none; b=EYJ+XPJ7ItgMo7rCGAWXK2trDEaP60stmV+baBxWzk/ZlF9OSVCXHoGmuAm/RA23s5hMaiNu4TL552I0DxafwGYfSgcw12w9ROD0Uh4olcI9yoTC+Cym01Yn15geGtH/f+ukyKT8SFCQ7nYdNPTz1EnXSHSL2hdyaKI3faqpPQ8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725383290; c=relaxed/simple; bh=9nNi3scBnr8Vk69ggkoW6jfBHFxQMg5IiD0KQUEmAqk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=S1Un+eWY6nrRKyWUEEL0xuNzfXmyxGpbU/5/IZ+Mjmk1Rwpdn5N4b2kQ5ZRGgN8oPk3irdoeW86QziGtxne65HPiW976waLStNxC1x6tOEKJcOxzB7x3FIdnS31JoTxZgBBekey/P/Di0j4OrnW8RRTutJ0cz5MDFxHka79W3XI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=nMW5qUla; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1725383289; x=1756919289; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9nNi3scBnr8Vk69ggkoW6jfBHFxQMg5IiD0KQUEmAqk=; b=nMW5qUla2NHnVClno9wWecnC7D4Aw4my5Y2JF/z6G5yu/FBfFxzjJD29 aQ3+VfxZBH7UAjEX9OR4VZoxieih9FueF9wtLH5BX+txipW7Jx7t1dQho L56XcQMNXCuYrAkoJM8rD7pIAuqPCecRZW7XClUZsug3ZF43ERm9OH5Sq 4jD0MLemLLeh/0BwWv12X31miGbn1/2THIQgpY+CX9mtFf8r3BoTbY5h1 +JvCSwDwqbWYPPvCtqkNUzMNzHJeQCrWpOIozvc8anc6pfDzB3VWtQ/c+ +Gnb8ZqHWbJizYFSAXqJaIFT6bZQSsQkyrYZROmRYmETzDnnVudreHIks w==; X-CSE-ConnectionGUID: noc8U4/kTR2lDeHwuU86sw== X-CSE-MsgGUID: gjHU/CdLRouW15j0CCPpRQ== X-IronPort-AV: E=McAfee;i="6700,10204,11184"; a="34661710" X-IronPort-AV: E=Sophos;i="6.10,199,1719903600"; d="scan'208";a="34661710" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Sep 2024 10:08:08 -0700 X-CSE-ConnectionGUID: WyKWepZKS1KLNJypnXhnhg== X-CSE-MsgGUID: VRY3WbaeRheXO9Iuq8ZfCg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,199,1719903600"; d="scan'208";a="69837981" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa004.jf.intel.com with ESMTP; 03 Sep 2024 10:08:07 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 8A92FB34; Tue, 03 Sep 2024 20:07:55 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Mika Westerberg , Andy Shevchenko , Linus Walleij Subject: [PATCH v1 1/3] pinctrl: intel: Replace ifdeffery by pm_sleep_ptr() macro Date: Tue, 3 Sep 2024 20:04:49 +0300 Message-ID: <20240903170752.3564538-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240903170752.3564538-1-andriy.shevchenko@linux.intel.com> References: <20240903170752.3564538-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Explicit ifdeffery is ugly and theoretically might be not synchronised with the rest of functions that are assigned via pm_sleep_ptr() macro. Replace ifdeffery by pm_sleep_ptr() macro to improve this. Signed-off-by: Andy Shevchenko --- drivers/pinctrl/intel/pinctrl-intel.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c index 7a790c437f68..bfe891522044 100644 --- a/drivers/pinctrl/intel/pinctrl-intel.c +++ b/drivers/pinctrl/intel/pinctrl-intel.c @@ -1482,7 +1482,6 @@ static int intel_pinctrl_add_padgroups_by_size(struct intel_pinctrl *pctrl, static int intel_pinctrl_pm_init(struct intel_pinctrl *pctrl) { -#ifdef CONFIG_PM_SLEEP const struct intel_pinctrl_soc_data *soc = pctrl->soc; struct intel_community_context *communities; struct intel_pad_context *pads; @@ -1497,7 +1496,6 @@ static int intel_pinctrl_pm_init(struct intel_pinctrl *pctrl) if (!communities) return -ENOMEM; - for (i = 0; i < pctrl->ncommunities; i++) { struct intel_community *community = &pctrl->communities[i]; u32 *intmask, *hostown; @@ -1519,7 +1517,6 @@ static int intel_pinctrl_pm_init(struct intel_pinctrl *pctrl) pctrl->context.pads = pads; pctrl->context.communities = communities; -#endif return 0; } @@ -1649,7 +1646,7 @@ int intel_pinctrl_probe(struct platform_device *pdev, if (irq < 0) return irq; - ret = intel_pinctrl_pm_init(pctrl); + ret = pm_sleep_ptr(intel_pinctrl_pm_init) ? intel_pinctrl_pm_init(pctrl) : 0; if (ret) return ret; From patchwork Tue Sep 3 17:04:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 1980232 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=iHnbzuiP; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=139.178.88.99; helo=sv.mirrors.kernel.org; envelope-from=linux-gpio+bounces-9694-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WysXJ5qXsz1yZ9 for ; Wed, 4 Sep 2024 03:08:32 +1000 (AEST) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 40185285682 for ; Tue, 3 Sep 2024 17:08:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E59DC18C92D; Tue, 3 Sep 2024 17:08:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="iHnbzuiP" X-Original-To: linux-gpio@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) (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 2EDED1E492; Tue, 3 Sep 2024 17:08:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.8 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725383290; cv=none; b=MMTDtAU8fc9Mt+dnPnW9BzHUVQeCRGVRLWf6YhOT05HqHhh3DPubVjL6POxiwaTtkNm1BLP9LKW45eWAEi9hp6Iddg2M9koTX6dtVnbKUxOsjVwLOSSx/9vjcXL7y17n8lpSAyF4iR8ONeT0v6uHyIxZzf6moS/vHqU54bHuEAg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725383290; c=relaxed/simple; bh=2h6WU4d4gnSqJg4lm2yVF0fkfzoQG2SQOxD8Q9ulcxs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cNaDHArosc04zYXQlU0pxdzdCQkFuFRX/XNUyVTlc88g/eQZXgksAw1T+RNb73Fd3BEgeqVC2nXZ4c/kgiLyAnb6FrDbqf7OfLVNzoG/n0WyOQtx/a7t6YqyVMLGzd0BuLwts7JMNDCMAS9eNi+sPywH+pyEzeNC9R91kpNMi6Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=iHnbzuiP; arc=none smtp.client-ip=192.198.163.8 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1725383289; x=1756919289; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=2h6WU4d4gnSqJg4lm2yVF0fkfzoQG2SQOxD8Q9ulcxs=; b=iHnbzuiPipiRAMv/4r3OZC1dU00vayE6hsE/WTJKAsP2COhMnmdH7MSj FS4O3s0/mWbUIDT/BdeCOB7tUSIb5jI1AcjcwKv2zQ22oAXZ1pRTJnp0u Hxo14JRW+Dvl39GS1yIYq93y9vCpwmLPqQqENVa1kuxfocr4TA6iTR5dT r/z3UT33r5fVZ3vFJdYzvzOnmRizTPhO2sC6/h6jkECAPutZvzSCRKkAv If10OTlNTlZD/IJJc1cMXhYiqzCcgpzcb+QmlHC4WVGi4qc9pX36gCn3U v2YElrfkhAWUmBQUY202dWt5ouzzo3Gm8VAEdDFZYguMn7dHaFphQgPtY A==; X-CSE-ConnectionGUID: c/6L9XWmT0qYMOmEJb28jw== X-CSE-MsgGUID: kF/tgDd3TQaOKgEkLnx0Tw== X-IronPort-AV: E=McAfee;i="6700,10204,11184"; a="41494093" X-IronPort-AV: E=Sophos;i="6.10,199,1719903600"; d="scan'208";a="41494093" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Sep 2024 10:08:08 -0700 X-CSE-ConnectionGUID: PcgFFg9rRCiABUACKkBCQQ== X-CSE-MsgGUID: XfbGCjzOT+y+8Xw+Ef6NrQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,199,1719903600"; d="scan'208";a="69767199" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa003.jf.intel.com with ESMTP; 03 Sep 2024 10:08:06 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 854FC1FA; Tue, 03 Sep 2024 20:07:55 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Mika Westerberg , Andy Shevchenko , Linus Walleij Subject: [PATCH v1 2/3] pinctrl: baytrail: Replace ifdeffery by pm_sleep_ptr() macro Date: Tue, 3 Sep 2024 20:04:50 +0300 Message-ID: <20240903170752.3564538-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240903170752.3564538-1-andriy.shevchenko@linux.intel.com> References: <20240903170752.3564538-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Explicit ifdeffery is ugly and theoretically might be not synchronised with the rest of functions that are assigned via pm_sleep_ptr() macro. Replace ifdeffery by pm_sleep_ptr() macro to improve this. Signed-off-by: Andy Shevchenko --- drivers/pinctrl/intel/pinctrl-baytrail.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c index 4533c4d0a9e7..7aa0ddca7a59 100644 --- a/drivers/pinctrl/intel/pinctrl-baytrail.c +++ b/drivers/pinctrl/intel/pinctrl-baytrail.c @@ -1514,13 +1514,6 @@ static int byt_gpio_probe(struct intel_pinctrl *vg) gc->parent = vg->dev; gc->ngpio = vg->soc->npins; -#ifdef CONFIG_PM_SLEEP - vg->context.pads = devm_kcalloc(vg->dev, gc->ngpio, sizeof(*vg->context.pads), - GFP_KERNEL); - if (!vg->context.pads) - return -ENOMEM; -#endif - /* set up interrupts */ irq = platform_get_irq_optional(pdev, 0); if (irq > 0) { @@ -1581,6 +1574,16 @@ static const struct acpi_device_id byt_gpio_acpi_match[] = { { } }; +static int byt_pinctrl_pm_init(struct intel_pinctrl *vg) +{ + vg->context.pads = devm_kcalloc(vg->dev, vg->soc->npins, + sizeof(*vg->context.pads), GFP_KERNEL); + if (!vg->context.pads) + return -ENOMEM; + + return 0; +} + static int byt_pinctrl_probe(struct platform_device *pdev) { const struct intel_pinctrl_soc_data *soc_data; @@ -1603,6 +1606,10 @@ static int byt_pinctrl_probe(struct platform_device *pdev) return ret; } + ret = pm_sleep_ptr(byt_pinctrl_pm_init) ? byt_pinctrl_pm_init(vg) : 0; + if (ret) + return ret; + vg->pctldesc = byt_pinctrl_desc; vg->pctldesc.name = dev_name(dev); vg->pctldesc.pins = vg->soc->pins; From patchwork Tue Sep 3 17:04:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 1980231 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=mX6QoEII; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:4601:e00::3; helo=am.mirrors.kernel.org; envelope-from=linux-gpio+bounces-9693-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [IPv6:2604:1380:4601:e00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WysWt6jW5z1yZ9 for ; Wed, 4 Sep 2024 03:08:10 +1000 (AEST) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 9A6081F26B95 for ; Tue, 3 Sep 2024 17:08:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1FA3E18C92D; Tue, 3 Sep 2024 17:08:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="mX6QoEII" X-Original-To: linux-gpio@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) (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 67E8B1E492; Tue, 3 Sep 2024 17:07:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.8 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725383280; cv=none; b=IVVqdvJu61nj14UBNYGw2UTugl/mM7203W4YjGmS9Kp6ouV1XHNM2WVmDtk51pMfjggJTLxjxSSRafY7Hzy3L7A260q1E0IGIOSlg3gQoDEl3KM2NwfSVxcY8d1WC231Jz4nabWY1+dvC3OdhuyUmnkMGaWjLwreZkfJ1Lve1rM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725383280; c=relaxed/simple; bh=X+TCqUJQ5rTyv8aAKraFeyml+cLPaiPiSJXWQHfz/J8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TSWphcaPmOZdrM/KIBIzjKnN4Z2GkjCPk63NePZXaZsuvIXmgXn1ZTeEzlWa7DsOoEB5u0h9e6rxf6oZKSD0exSOX3k/rI5sdXHy+z2OsGPLYCUicXsrfWGAjcLgY6grUpt9ruBp/oVhEtM2xAVaw8HimM9mnSLdXdvprVdA0OE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=mX6QoEII; arc=none smtp.client-ip=192.198.163.8 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1725383279; x=1756919279; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=X+TCqUJQ5rTyv8aAKraFeyml+cLPaiPiSJXWQHfz/J8=; b=mX6QoEII+4swQIsWPRDtNLqzwFqwr0iFN0POA/wpkhxLmf0s4T+wL+tv 1IfKib+b4fzEj6tDzHgRzRQnKxP2Q4IRIv8U4Kvll9BeFGgISAHdkwv8M uBVYK5Budx0XkQ1BBVY4Pf9ZlORtStgTURJSIDPnQZD5Khv0Kf5J3u2NA B6yEw4MSej+MEmzyZjvRYiiVQEefZp9clFgVfXVsM76YOIu6UB43spnC0 m/pDmXM93RV8epQlwSE69WR1fq8D/gncmdCoC/Kkj++nBunajs7Hm1DuR YOfcDU5xXCAWHofd9/r1vFlOkl1HAoq5BGyhU77B1HlZKWmhzg2K7IfSR g==; X-CSE-ConnectionGUID: 1UgS5UOdSK+Tz/1bu4oZ4w== X-CSE-MsgGUID: l6Eb2E84R3mAbkNO2KJ4wg== X-IronPort-AV: E=McAfee;i="6700,10204,11184"; a="41494052" X-IronPort-AV: E=Sophos;i="6.10,199,1719903600"; d="scan'208";a="41494052" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Sep 2024 10:07:59 -0700 X-CSE-ConnectionGUID: ybgYp6rNQt+mF8pgWXuqHw== X-CSE-MsgGUID: 3EVpEHrhQ/KQMVFqwMIAXA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,199,1719903600"; d="scan'208";a="69767070" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa003.jf.intel.com with ESMTP; 03 Sep 2024 10:07:56 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 9438848D; Tue, 03 Sep 2024 20:07:55 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Mika Westerberg , Andy Shevchenko , Linus Walleij Subject: [PATCH v1 3/3] pinctrl: cherryview: Replace ifdeffery by pm_sleep_ptr() macro Date: Tue, 3 Sep 2024 20:04:51 +0300 Message-ID: <20240903170752.3564538-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240903170752.3564538-1-andriy.shevchenko@linux.intel.com> References: <20240903170752.3564538-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Explicit ifdeffery is ugly and theoretically might be not synchronised with the rest of functions that are assigned via pm_sleep_ptr() macro. Replace ifdeffery by pm_sleep_ptr() macro to improve this. Signed-off-by: Andy Shevchenko --- drivers/pinctrl/intel/pinctrl-cherryview.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/pinctrl/intel/pinctrl-cherryview.c b/drivers/pinctrl/intel/pinctrl-cherryview.c index 2f0e29c78dfb..9cdffd73e345 100644 --- a/drivers/pinctrl/intel/pinctrl-cherryview.c +++ b/drivers/pinctrl/intel/pinctrl-cherryview.c @@ -1608,6 +1608,16 @@ static acpi_status chv_pinctrl_mmio_access_handler(u32 function, return AE_OK; } +static int chv_pinctrl_pm_init(struct intel_pinctrl *pctrl) +{ + pctrl->context.pads = devm_kcalloc(pctrl->dev, pctrl->soc->npins, + sizeof(*pctrl->context.pads), GFP_KERNEL); + if (!pctrl->context.pads) + return -ENOMEM; + + return 0; +} + static int chv_pinctrl_probe(struct platform_device *pdev) { const struct intel_pinctrl_soc_data *soc_data; @@ -1648,13 +1658,9 @@ static int chv_pinctrl_probe(struct platform_device *pdev) community->pad_regs = community->regs + FAMILY_PAD_REGS_OFF; -#ifdef CONFIG_PM_SLEEP - pctrl->context.pads = devm_kcalloc(dev, pctrl->soc->npins, - sizeof(*pctrl->context.pads), - GFP_KERNEL); - if (!pctrl->context.pads) - return -ENOMEM; -#endif + ret = pm_sleep_ptr(chv_pinctrl_pm_init) ? chv_pinctrl_pm_init(pctrl) : 0; + if (ret) + return ret; pctrl->context.communities = devm_kcalloc(dev, pctrl->soc->ncommunities, sizeof(*pctrl->context.communities),