From nobody Sat Feb 7 19:08:37 2026 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.14]) (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 5869C30648C; Tue, 11 Nov 2025 14:50:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.14 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762872656; cv=none; b=Wjbr2zmb5dJxZrd7KebOO0V1vQEJtAu3qjsZaGVMhDn3NWvyl7EH0/ospBWzKQl2r9k0ixxW1siOfCaMXn5i4ZH82bWG2YF/hQGb6xU0Vqvm0oYi1uQVZi2sOBKpYSUAi8PY16UVmePpSBcB0KEdzjWSsLVih5wQPkjNqOGfCN4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762872656; c=relaxed/simple; bh=CJT2bHiYVzimb6xUOlUijV6ufxC2fzRRaAwV5VvZxnE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TidFrecelQUkiskexIN+MF6zXfxnprp13NfN0afD2GR3DVCs9+CrOITaXNFKVh0DTICOl2kb+t1R+D5gWdgkt8439+75pBEU/Jex3pMzVwk0DsHCSC6VRb3NcCd1v16muaWF+T2fLWkKWsrFG6TKqMoUGRzmKfQIUPc04DRBCsU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Vb4sHjwk; arc=none smtp.client-ip=192.198.163.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Vb4sHjwk" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1762872654; x=1794408654; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CJT2bHiYVzimb6xUOlUijV6ufxC2fzRRaAwV5VvZxnE=; b=Vb4sHjwkd95egKGjDCzV89R265peULYPNl8V65CHh/54CQKxRLu6WyW+ 5ESnC60FH3EA3yb4pCrnTeAbNJMxo32/IvXfU9SMi9RO+Qi0JEcT5Et7I BlQY+c/eqFZrb2QRTMYl4jIaAQuqU48RfYw4s8O0HlzS3LS6vMNh47p9p hKnQqbEuZQqMmjt7A+VZ9Si/vaWqTpfYGdSUcJzo71xTiatQvcKkQtdwX lU5t2KgBFpoXNDuPWteyt9SjUiMgiNIGmGxIPhwc87GloQZB56szAmPMR DgUi1mwgGq9Cz9qFF4OlOTrDHzZGUWXyVxosAMaUNmAVdV7Vjf9nyF9c/ Q==; X-CSE-ConnectionGUID: d7AVU/byRoqhohF7Cp3POw== X-CSE-MsgGUID: +i2RUADjTne/JdlMP5CYpQ== X-IronPort-AV: E=McAfee;i="6800,10657,11610"; a="64968382" X-IronPort-AV: E=Sophos;i="6.19,296,1754982000"; d="scan'208";a="64968382" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa108.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Nov 2025 06:50:52 -0800 X-CSE-ConnectionGUID: A9CUur7HSkCWf1aCqWULhQ== X-CSE-MsgGUID: aLLk3+7ZRB+BR/+ie7j+1A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.19,296,1754982000"; d="scan'208";a="189153961" Received: from black.igk.intel.com ([10.91.253.5]) by orviesa008.jf.intel.com with ESMTP; 11 Nov 2025 06:50:50 -0800 Received: by black.igk.intel.com (Postfix, from userid 1003) id AF7B597; Tue, 11 Nov 2025 15:50:48 +0100 (CET) From: Andy Shevchenko To: Andy Shevchenko , Philipp Stanner , Greg Kroah-Hartman , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jonathan Corbet , "Rafael J. Wysocki" , Danilo Krummrich Subject: [PATCH v2 1/2] devres: Remove unused devm_free_percpu() Date: Tue, 11 Nov 2025 15:49:45 +0100 Message-ID: <20251111145046.997309-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251111145046.997309-1-andriy.shevchenko@linux.intel.com> References: <20251111145046.997309-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Remove unused devm_free_percpu(). By the way, it was never used in the drivers/ from day 1. Signed-off-by: Andy Shevchenko --- .../driver-api/driver-model/devres.rst | 1 - drivers/base/devres.c | 25 ------------------- include/linux/device.h | 1 - 3 files changed, 27 deletions(-) diff --git a/Documentation/driver-api/driver-model/devres.rst b/Documentati= on/driver-api/driver-model/devres.rst index 2b36ebde9cec..0198ac65e874 100644 --- a/Documentation/driver-api/driver-model/devres.rst +++ b/Documentation/driver-api/driver-model/devres.rst @@ -383,7 +383,6 @@ NET =20 PER-CPU MEM devm_alloc_percpu() - devm_free_percpu() =20 PCI devm_pci_alloc_host_bridge() : managed PCI host bridge allocation diff --git a/drivers/base/devres.c b/drivers/base/devres.c index c948c88d3956..f54db6d138ab 100644 --- a/drivers/base/devres.c +++ b/drivers/base/devres.c @@ -1222,13 +1222,6 @@ static void devm_percpu_release(struct device *dev, = void *pdata) free_percpu(p); } =20 -static int devm_percpu_match(struct device *dev, void *data, void *p) -{ - struct devres *devr =3D container_of(data, struct devres, data); - - return *(void **)devr->data =3D=3D p; -} - /** * __devm_alloc_percpu - Resource-managed alloc_percpu * @dev: Device to allocate per-cpu memory for @@ -1264,21 +1257,3 @@ void __percpu *__devm_alloc_percpu(struct device *de= v, size_t size, return pcpu; } EXPORT_SYMBOL_GPL(__devm_alloc_percpu); - -/** - * devm_free_percpu - Resource-managed free_percpu - * @dev: Device this memory belongs to - * @pdata: Per-cpu memory to free - * - * Free memory allocated with devm_alloc_percpu(). - */ -void devm_free_percpu(struct device *dev, void __percpu *pdata) -{ - /* - * Use devres_release() to prevent memory leakage as - * devm_free_pages() does. - */ - WARN_ON(devres_release(dev, devm_percpu_release, devm_percpu_match, - (void *)(__force unsigned long)pdata)); -} -EXPORT_SYMBOL_GPL(devm_free_percpu); diff --git a/include/linux/device.h b/include/linux/device.h index b031ff71a5bd..0c6377f6631c 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -298,7 +298,6 @@ void device_remove_bin_file(struct device *dev, =20 void __percpu *__devm_alloc_percpu(struct device *dev, size_t size, size_t align); -void devm_free_percpu(struct device *dev, void __percpu *pdata); =20 struct device_dma_parameters { /* --=20 2.50.1 From nobody Sat Feb 7 19:08:37 2026 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) (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 639541A3178; Tue, 11 Nov 2025 14:50:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762872654; cv=none; b=ZN0Si/iRpr2zEYEJHyyQ++A3tYjcsqwmFllp3nqAq/FHyc0YPgnt0h80dIDmv2DqRsoN1bbceYPwd8i/S4M45vpNbZ3X3besOcqBAORdd8FDOHXiOLGRlmM1VHOb80G2y2kVMiChpXMndSXJwv/c+k1F9WfKJVwu/1/3Yc/8A34= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762872654; c=relaxed/simple; bh=v99117MGYVWmQZnJ8EGbbfXSAArRfL4nDoBBh2bne0k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oEoJ/0cLpRE/JQGYEHm5UJtWJ/UjXDaAEiC0WRhOoSY299ApFYxR0MNrF1Sqgw1jDqz4l6x15MmACFmRcgBHmlmh0zikrHbozUZwKPMFXCYomFXT7+nqdakXIrLtRHjGYMXc6Jt1ZlBf4Ow/as6ukbMFBOrsEv8tFb01Xt2uRnE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=CzTpweft; arc=none smtp.client-ip=192.198.163.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="CzTpweft" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1762872652; x=1794408652; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=v99117MGYVWmQZnJ8EGbbfXSAArRfL4nDoBBh2bne0k=; b=CzTpweftI8n3pomtIPEf3e4vAzOyVjpx57F9FtnPi1xw4hIIGCNnlexY GQuBeYTQY33vCW5zC4tJZtRAmWDcHo5luhFXiszYZSWNXgQIeudJS15xB QUIGTzqzCQxzot+660h5QMHS9fqDsO3zHBLKTbpUFzGiVFF665DiQF1cX O9rGnGlTKk7pRzGrqXFWiKdhi91BrtAMAa8Le0/RDNqWhkyXA2U4CBdyl OhU+ZEJwOjWWyxQhonwhmuX2eVStmbV15TcWAhw0g6UOIIeWeHmnJ4KT8 mWfAsAZ1w4UGNZHJ+oHSLdpXjX3lZxNZHmsvG3oxyFIQRslmLjYFlpFQ1 A==; X-CSE-ConnectionGUID: SzuYB5imQU6IkXOYx4kfHw== X-CSE-MsgGUID: szC5LjsYR56gN+G5XD+9cw== X-IronPort-AV: E=McAfee;i="6800,10657,11610"; a="75551553" X-IronPort-AV: E=Sophos;i="6.19,296,1754982000"; d="scan'208";a="75551553" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Nov 2025 06:50:52 -0800 X-CSE-ConnectionGUID: FGtMBDK+RgOAC3HYYAW2/w== X-CSE-MsgGUID: qFIxIRoeSXWx1i2ax5LMyg== X-ExtLoop1: 1 Received: from black.igk.intel.com ([10.91.253.5]) by fmviesa003.fm.intel.com with ESMTP; 11 Nov 2025 06:50:50 -0800 Received: by black.igk.intel.com (Postfix, from userid 1003) id B3F4B98; Tue, 11 Nov 2025 15:50:48 +0100 (CET) From: Andy Shevchenko To: Andy Shevchenko , Philipp Stanner , Greg Kroah-Hartman , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jonathan Corbet , "Rafael J. Wysocki" , Danilo Krummrich Subject: [PATCH v2 2/2] devres: Move devm_alloc_percpu() and related to devres.h Date: Tue, 11 Nov 2025 15:49:46 +0100 Message-ID: <20251111145046.997309-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20251111145046.997309-1-andriy.shevchenko@linux.intel.com> References: <20251111145046.997309-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Move devm_alloc_percpu() and related to devres.h where it belongs, Signed-off-by: Andy Shevchenko --- include/linux/device.h | 18 ------------------ include/linux/device/devres.h | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/include/linux/device.h b/include/linux/device.h index 0c6377f6631c..0be95294b6e6 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -281,24 +281,6 @@ int __must_check device_create_bin_file(struct device = *dev, void device_remove_bin_file(struct device *dev, const struct bin_attribute *attr); =20 -/** - * devm_alloc_percpu - Resource-managed alloc_percpu - * @dev: Device to allocate per-cpu memory for - * @type: Type to allocate per-cpu memory for - * - * Managed alloc_percpu. Per-cpu memory allocated with this function is - * automatically freed on driver detach. - * - * RETURNS: - * Pointer to allocated memory on success, NULL on failure. - */ -#define devm_alloc_percpu(dev, type) \ - ((typeof(type) __percpu *)__devm_alloc_percpu((dev), sizeof(type), \ - __alignof__(type))) - -void __percpu *__devm_alloc_percpu(struct device *dev, size_t size, - size_t align); - struct device_dma_parameters { /* * a low level driver may set these to teach IOMMU code about diff --git a/include/linux/device/devres.h b/include/linux/device/devres.h index 8c5f57e0d613..9c1e3d643d69 100644 --- a/include/linux/device/devres.h +++ b/include/linux/device/devres.h @@ -9,6 +9,7 @@ #include #include #include +#include =20 struct device; struct device_node; @@ -96,6 +97,22 @@ devm_kvasprintf(struct device *dev, gfp_t gfp, const cha= r *fmt, va_list ap); char * __printf(3, 4) __malloc devm_kasprintf(struct device *dev, gfp_t gfp, const char *fmt, ...); =20 +/** + * devm_alloc_percpu - Resource-managed alloc_percpu + * @dev: Device to allocate per-cpu memory for + * @type: Type to allocate per-cpu memory for + * + * Managed alloc_percpu. Per-cpu memory allocated with this function is + * automatically freed on driver detach. + * + * RETURNS: + * Pointer to allocated memory on success, NULL on failure. + */ +#define devm_alloc_percpu(dev, type) \ + ((typeof(type) __percpu *)__devm_alloc_percpu((dev), sizeof(type), __alig= nof__(type))) + +void __percpu *__devm_alloc_percpu(struct device *dev, size_t size, size_t= align); + unsigned long devm_get_free_pages(struct device *dev, gfp_t gfp_mask, unsi= gned int order); void devm_free_pages(struct device *dev, unsigned long addr); =20 --=20 2.50.1