From patchwork Tue Dec 24 13:05:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zijun Hu X-Patchwork-Id: 853805 Received: from pv50p00im-tydg10011801.me.com (pv50p00im-tydg10011801.me.com [17.58.6.52]) (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 7D4CA1DC9AE for ; Tue, 24 Dec 2024 13:09:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=17.58.6.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735045760; cv=none; b=qkd13yPmYt7HQavZugGK5VmnZObijWLuErVmCa3kP3nhh9COlbbBkKBdDGvpUGuigQkF+DWngTVSlm1PQGWVZu53mQ8GwIRlStOwzs2KYc5zfjIxl4P5yGcUBqKjMWa2KQ0/DgbhNm6mPjevPzvYRICxQTrJ8neuaFuhwZgLhMk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735045760; c=relaxed/simple; bh=IJANnshHGNRPjHK/ZL6NeKM3LmwYvWgvDO5OVdujO8A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=D6+6/CIPxI6TlVxghuf+8Igdt+ZfuFXLHzxk732VRkf8/HtwKkjD0AyRntNmi9JISdEw8GoCmrLz90ctSLHVuNjI31p6sIPgTfCahR9gOI2OvSnaiD2VVzNiRlhzX1hgqSo010aBPvTcuwQcidXeKMvJQEnDrPBSOSAly/Sl7dY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com; spf=pass smtp.mailfrom=icloud.com; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b=AQQ1El94; arc=none smtp.client-ip=17.58.6.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=icloud.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b="AQQ1El94" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1735045757; bh=9MSW9rqSXzJ69ClHo2IWjPKz+ccuE6aWbD2rifbGZik=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To: x-icloud-hme; b=AQQ1El94wxk8X1sHIsWU12DqAkCYlH6+ybS2D7Gwfu8FDOuSPOP2RZ13Pu+oimEIP I+r6mL+Y7Xl8ap8vExSj/Mh8yUHFon5ilSleyaktED+7n8oedNeS8HcjKoJAktdSMP v/Jgr4JTfPExZ+56g+05TRECcHt1Hy2MzLxJB38V10WZqKdyj0nyEUCPGR7Zid218Z DF5jZVP5ga1amuMQg++Bb1EF8YBHKge3V7lwlU1R1whG624TyJoqIx8h4Vcsckuc6Q BC6F/kqaBndfQZm6EKBvb31OpUuc/XI2dxVQSZddHuf46lounHa2Od3NIfMum9Z0T5 wzcCRN48g19yg== Received: from [192.168.1.25] (pv50p00im-dlb-asmtp-mailmevip.me.com [17.56.9.10]) by pv50p00im-tydg10011801.me.com (Postfix) with ESMTPSA id AC6ED8000B5; Tue, 24 Dec 2024 13:09:01 +0000 (UTC) From: Zijun Hu Date: Tue, 24 Dec 2024 21:05:09 +0800 Subject: [PATCH v5 10/12] cxl/pmem: Replace match_nvdimm_bridge() with API device_match_type() Precedence: bulk X-Mailing-List: linux-serial@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241224-const_dfc_done-v5-10-6623037414d4@quicinc.com> References: <20241224-const_dfc_done-v5-0-6623037414d4@quicinc.com> In-Reply-To: <20241224-const_dfc_done-v5-0-6623037414d4@quicinc.com> To: Greg Kroah-Hartman Cc: Linus Walleij , Bartosz Golaszewski , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , James Bottomley , =?utf-8?q?Thomas_?= =?utf-8?q?Wei=C3=9Fschuh?= , Zijun Hu , linux-kernel@vger.kernel.org, nvdimm@lists.linux.dev, linux-sound@vger.kernel.org, sparclinux@vger.kernel.org, linux-block@vger.kernel.org, linux-cxl@vger.kernel.org, linux1394-devel@lists.sourceforge.net, arm-scmi@vger.kernel.org, linux-efi@vger.kernel.org, linux-gpio@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, linux-hwmon@vger.kernel.org, linux-media@vger.kernel.org, linux-pwm@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-scsi@vger.kernel.org, linux-usb@vger.kernel.org, linux-serial@vger.kernel.org, netdev@vger.kernel.org, Zijun Hu , Alison Schofield X-Mailer: b4 0.14.2 X-Proofpoint-GUID: g84oVEIFZX0BLRR1gCC9sfjxWF3RJcrC X-Proofpoint-ORIG-GUID: g84oVEIFZX0BLRR1gCC9sfjxWF3RJcrC X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2024-12-24_05,2024-12-24_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 clxscore=1015 mlxscore=0 spamscore=0 mlxlogscore=999 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2308100000 definitions=main-2412240113 X-Apple-Remote-Links: v=1;h=KCk=;charset=UTF-8 From: Zijun Hu Static match_nvdimm_bridge(), as matching function of device_find_child() matches a device with device type @cxl_nvdimm_bridge_type, and its task can be simplified by the recently introduced API device_match_type(). Replace match_nvdimm_bridge() usage with device_match_type(). Reviewed-by: Alison Schofield Signed-off-by: Zijun Hu --- drivers/cxl/core/pmem.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/cxl/core/pmem.c b/drivers/cxl/core/pmem.c index a8473de24ebfd92f12f47e0556e28b81a29cff7c..0f8166e793e14fc0b1c04ffda79e756a743d9e6b 100644 --- a/drivers/cxl/core/pmem.c +++ b/drivers/cxl/core/pmem.c @@ -57,11 +57,6 @@ bool is_cxl_nvdimm_bridge(struct device *dev) } EXPORT_SYMBOL_NS_GPL(is_cxl_nvdimm_bridge, "CXL"); -static int match_nvdimm_bridge(struct device *dev, const void *data) -{ - return is_cxl_nvdimm_bridge(dev); -} - /** * cxl_find_nvdimm_bridge() - find a bridge device relative to a port * @port: any descendant port of an nvdimm-bridge associated @@ -75,7 +70,9 @@ struct cxl_nvdimm_bridge *cxl_find_nvdimm_bridge(struct cxl_port *port) if (!cxl_root) return NULL; - dev = device_find_child(&cxl_root->port.dev, NULL, match_nvdimm_bridge); + dev = device_find_child(&cxl_root->port.dev, + &cxl_nvdimm_bridge_type, + device_match_type); if (!dev) return NULL;