From patchwork Thu Dec 5 00:10:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zijun Hu X-Patchwork-Id: 847802 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 1B826101F2 for ; Thu, 5 Dec 2024 00:11:16 +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=1733357478; cv=none; b=FTdWULAs5RYapC9vo6tZlntO9H0LUJPsiCy6iV2am77NJihRF682LEDZSDpwa+jnzyrrz9Jbs7y1TbC45MzRX+mICc8iNaCVvNmHlZPuRFYfOAxQLeFKEszgEcXQfnL6zHp92sWXWxII3QddftCrkgeTHheXKIo4V9/eabQGsLU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733357478; c=relaxed/simple; bh=bVxN+FZOfleQVmg6RLp1YA7VWhpbCqAopfI4NI1NFnA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=sdroVc+DGOEb4PM1NmijDqJJTF2Qk8I6y9op96KxmNWQG+2TqbB2v+wK90uEkQq7jgD/5/EiNNimX7Ip7KiiqhZDlizmVm4KqFYM5e6mdz9bKufSGDNatyupnyya30ykMvq6MR7AvhaNV4bzRWW/9TD/KuxiFcN/xbfAFAhBtWI= 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=RgdLtt4a; 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="RgdLtt4a" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1733357475; bh=DunB/Cza6j0J9yIEJF1/KVIA9ohiToydy/mrGuBe+NA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To: x-icloud-hme; b=RgdLtt4aFUOiBVmeQIiZeK+R6ebchgvxS1CGK9QWDm4fi6XycK0YPKcDXkKNxrZr5 +xtKJ6H39Xui76oDfpCSXqE4tOoHj+7JRKbj4DGFJPikLBsnyakQ3Xyf+JLqlKC7CK 1iPow4BKS8sS9bw1x59FVLT9xfEl3k+Mc0/6jz5b7NLkO/DmqJqcNFgQu0wVbjwsXU Vez16J5yD5UiaIoqpK2YdcUIWiYXCDQsuTIMOmqYqY4Eo8Zr6SReR+T8g09hoZ3KNz oiPm9MB2Q+TBtqrBbITTNRuqKFrVD/luXwZshbq8FNuVBnC76FT2njYcWtNu+JfgdE cxzKF4ATBNsmQ== Received: from [192.168.1.26] (pv50p00im-dlb-asmtp-mailmevip.me.com [17.56.9.10]) by pv50p00im-tydg10011801.me.com (Postfix) with ESMTPSA id BC22B80026F; Thu, 5 Dec 2024 00:11:03 +0000 (UTC) From: Zijun Hu Date: Thu, 05 Dec 2024 08:10:10 +0800 Subject: [PATCH v3 01/11] libnvdimm: Simplify nd_namespace_store() implementation Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241205-const_dfc_done-v3-1-1611f1486b5a@quicinc.com> References: <20241205-const_dfc_done-v3-0-1611f1486b5a@quicinc.com> In-Reply-To: <20241205-const_dfc_done-v3-0-1611f1486b5a@quicinc.com> To: Greg Kroah-Hartman Cc: =?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, open-iscsi@googlegroups.com, linux-usb@vger.kernel.org, linux-serial@vger.kernel.org, netdev@vger.kernel.org, Zijun Hu X-Mailer: b4 0.14.2 X-Proofpoint-ORIG-GUID: jHlIOqjc_AeZK-9ZUrdqIW7FkzMuYDHV X-Proofpoint-GUID: jHlIOqjc_AeZK-9ZUrdqIW7FkzMuYDHV 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-04_19,2024-12-04_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 clxscore=1015 phishscore=0 suspectscore=0 bulkscore=0 mlxscore=0 spamscore=0 mlxlogscore=902 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2308100000 definitions=main-2412040186 X-Apple-Remote-Links: v=1;h=KCk=;charset=UTF-8 From: Zijun Hu Simplify nd_namespace_store() implementation by device_find_child_by_name() Signed-off-by: Zijun Hu Reviewed-by: Alison Schofield --- drivers/nvdimm/claim.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/nvdimm/claim.c b/drivers/nvdimm/claim.c index 030dbde6b0882050c90fb8db106ec15b1baef7ca..9e84ab411564f9d5e7ceb687c6491562564552e3 100644 --- a/drivers/nvdimm/claim.c +++ b/drivers/nvdimm/claim.c @@ -67,13 +67,6 @@ bool nd_attach_ndns(struct device *dev, struct nd_namespace_common *attach, return claimed; } -static int namespace_match(struct device *dev, void *data) -{ - char *name = data; - - return strcmp(name, dev_name(dev)) == 0; -} - static bool is_idle(struct device *dev, struct nd_namespace_common *ndns) { struct nd_region *nd_region = to_nd_region(dev->parent); @@ -168,7 +161,7 @@ ssize_t nd_namespace_store(struct device *dev, goto out; } - found = device_find_child(dev->parent, name, namespace_match); + found = device_find_child_by_name(dev->parent, name); if (!found) { dev_dbg(dev, "'%s' not found under %s\n", name, dev_name(dev->parent)); From patchwork Thu Dec 5 00:10:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zijun Hu X-Patchwork-Id: 847801 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 A8215D2FF for ; Thu, 5 Dec 2024 00:11:38 +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=1733357501; cv=none; b=tABwbV6lvLTAO3EZlpyu9XUkUSCpDCX6JRo6qyESo29y3RdtifNEnPmgrLIW+1a2ib7NAiqF0rzncoNPIRCDgc7CWZabPwjvx0Y6wrIhEIrxfzusfO3OPa1oqYe2xQL/YekiNbmFYr7JVMnLfx6zgGpV/Ez+NhBEYVse8ip9rGs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733357501; c=relaxed/simple; bh=Txz+DMIu0HjYpVAknikfDcPuYhSiW9S4S4zdgwMhpwc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kzSBS7wXIi6KsI+J/+w//3fqMLFZc0g1dCJazGMTA2/EEkOMRK6RFfnqdvnFSQzYckpcC/5sqvYD4wdrI/gxUofraG0qdkFEU3N18xC8StnRPPxsGtAGqvEMGMSzz8KAvCzzyffJ37GdV2YuBhIVngWHaHbxez7tpnxuobo0AS0= 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=AaMBReMo; 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="AaMBReMo" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1733357498; bh=s27I9OiFEC5wqMAA52fLVTkJnWq/1PJykguAupy9zqE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To: x-icloud-hme; b=AaMBReMoVb0lSqAfWtIUZpyS48WBzfGTBOJ4idA3UTiHPD2VtroZkQ2LBN26ektJg fWn3prREbzLFl1KoR6iEfktUfII9bNpwImON/ESQxnnCGdIvgrdRLSaWxJFHci1T3+ 7NybdpqcQ0yv26rJDrTmYi/hddtW8/+6dXAto5WBo0rAWD88KO7IIA5ZvyFOLXoS3q ehVekwdLcpYLutCiajjJFG3pTCbtr0jk8alc/U2FFnmyq/Bb6zygfMsypJ4uBM5ZI9 tbuNaRvpVXLTsvhH4fEp6taGKZ0GU8hvEvaOfF2yRIJtK2DzKbEZ48vUsP4jrfOc3O hELDsSGo1WePQ== Received: from [192.168.1.26] (pv50p00im-dlb-asmtp-mailmevip.me.com [17.56.9.10]) by pv50p00im-tydg10011801.me.com (Postfix) with ESMTPSA id C8B2580027B; Thu, 5 Dec 2024 00:11:27 +0000 (UTC) From: Zijun Hu Date: Thu, 05 Dec 2024 08:10:12 +0800 Subject: [PATCH v3 03/11] bus: fsl-mc: Constify fsl_mc_device_match() Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241205-const_dfc_done-v3-3-1611f1486b5a@quicinc.com> References: <20241205-const_dfc_done-v3-0-1611f1486b5a@quicinc.com> In-Reply-To: <20241205-const_dfc_done-v3-0-1611f1486b5a@quicinc.com> To: Greg Kroah-Hartman Cc: =?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, open-iscsi@googlegroups.com, linux-usb@vger.kernel.org, linux-serial@vger.kernel.org, netdev@vger.kernel.org, Zijun Hu X-Mailer: b4 0.14.2 X-Proofpoint-ORIG-GUID: 7Q8uF-g7w7uKUYtHNcd92_FB_Q-fmK-F X-Proofpoint-GUID: 7Q8uF-g7w7uKUYtHNcd92_FB_Q-fmK-F 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-04_19,2024-12-04_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 clxscore=1015 phishscore=0 suspectscore=0 bulkscore=0 mlxscore=0 spamscore=0 mlxlogscore=820 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2308100000 definitions=main-2412040186 X-Apple-Remote-Links: v=1;h=KCk=;charset=UTF-8 From: Zijun Hu fsl_mc_device_match() does not modify caller's inputs. Constify it by simply changing its parameter types to const pointer. Signed-off-by: Zijun Hu --- drivers/bus/fsl-mc/dprc-driver.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/bus/fsl-mc/dprc-driver.c b/drivers/bus/fsl-mc/dprc-driver.c index 4b68c84ef485055c9b300b4f7912a20f959b8ac1..11c8fadcf85148b4e4ea6b97b7efb6d4ddf22d3c 100644 --- a/drivers/bus/fsl-mc/dprc-driver.c +++ b/drivers/bus/fsl-mc/dprc-driver.c @@ -22,8 +22,8 @@ struct fsl_mc_child_objs { struct fsl_mc_obj_desc *child_array; }; -static bool fsl_mc_device_match(struct fsl_mc_device *mc_dev, - struct fsl_mc_obj_desc *obj_desc) +static bool fsl_mc_device_match(const struct fsl_mc_device *mc_dev, + const struct fsl_mc_obj_desc *obj_desc) { return mc_dev->obj_desc.id == obj_desc->id && strcmp(mc_dev->obj_desc.type, obj_desc->type) == 0; From patchwork Thu Dec 5 00:10:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zijun Hu X-Patchwork-Id: 847800 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 4118B14A617 for ; Thu, 5 Dec 2024 00:12:02 +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=1733357524; cv=none; b=scUiAvQw+WVIzEO3YklUgEuf2oiqTRHKUl3KWFql/cAxvUvVO5Q59+eBLHio6bKlsE3fp9jDnPZggqV4Gtbgj2WMWE5JuTiav9PnndQSaeb66yJ8nKTZUUDRZ5XlXOiGPX8mTzuTG5N4EYZLgFA3OjBd553HiVurd6k4vCTWYvk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733357524; c=relaxed/simple; bh=GADZmka4YuYm1DhxT8gvvi2TBpPC5izf+AdJngKx+l0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=q/zGj20fRs0yvN6lvaD35zQVWaTCc+R6p/0wjbREix76txIo8Q0XpfEfvfXy5LjdGTpODOhPeBR9lPTYpnXvU9oGy9vi+KltnVP+LHxjDfBfPhjn1bjXZIYnVsjwbuM9UCI16f5nyEqzpw826c02YtNC21Hhz0piynAjdaYA70s= 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=IVuWGgnz; 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="IVuWGgnz" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1733357522; bh=IkjKR7CpPDn98sYTBYYKWLyDknZN2jQuVV1iJBo+zv4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To: x-icloud-hme; b=IVuWGgnz7EZJQeECGBnttHxtoDGtsZ2uuQ/QCPHYTO74bhz2JeY/0NPUfzoPC39gF GLFBnXK4FWKcvVDw5l7YeSoS9Pz+KnQDkKmQihxDWYapsOpxgcX5qc4Vu7FUnt99r0 RyLOD9xXpfx0p/+2pqYPd/oqaaCySRZTkeWVfw+DfNW3D+ZJoEMsJ/KM87YuCoeO7T CQJlLhaJ+oIz1herHq0DUsQpE7prIiem6U1IazFdPyy0EuS9fO/VNKFY9zLfvbX1vC odWSZWoxV5wBEpzOQGE5dxelbt7yjAymHYCLHgVzNHveTkxA0puCW2IxmhGOPwrncX N8FMNSNM/Ecxg== Received: from [192.168.1.26] (pv50p00im-dlb-asmtp-mailmevip.me.com [17.56.9.10]) by pv50p00im-tydg10011801.me.com (Postfix) with ESMTPSA id 0FBE68002AE; Thu, 5 Dec 2024 00:11:50 +0000 (UTC) From: Zijun Hu Date: Thu, 05 Dec 2024 08:10:14 +0800 Subject: [PATCH v3 05/11] driver core: Simplify API device_find_child_by_name() implementation Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241205-const_dfc_done-v3-5-1611f1486b5a@quicinc.com> References: <20241205-const_dfc_done-v3-0-1611f1486b5a@quicinc.com> In-Reply-To: <20241205-const_dfc_done-v3-0-1611f1486b5a@quicinc.com> To: Greg Kroah-Hartman Cc: =?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, open-iscsi@googlegroups.com, linux-usb@vger.kernel.org, linux-serial@vger.kernel.org, netdev@vger.kernel.org, Zijun Hu X-Mailer: b4 0.14.2 X-Proofpoint-ORIG-GUID: nR0Td9EIK3Obz30PFAIkB0fn5HoVn60t X-Proofpoint-GUID: nR0Td9EIK3Obz30PFAIkB0fn5HoVn60t 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-04_19,2024-12-04_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 clxscore=1015 phishscore=0 suspectscore=0 bulkscore=0 mlxscore=0 spamscore=0 mlxlogscore=826 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2308100000 definitions=main-2412040186 X-Apple-Remote-Links: v=1;h=KCk=;charset=UTF-8 From: Zijun Hu Simplify device_find_child_by_name() implementation by both existing API device_find_child() and device_match_name(). Signed-off-by: Zijun Hu --- drivers/base/core.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/drivers/base/core.c b/drivers/base/core.c index bc3b523a4a6366080c3c9fd190e54c7fd13c8ded..8116bc8dd6e9eba0653ca686a90c7008de9e2840 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -4110,18 +4110,7 @@ EXPORT_SYMBOL_GPL(device_find_child); struct device *device_find_child_by_name(struct device *parent, const char *name) { - struct klist_iter i; - struct device *child; - - if (!parent) - return NULL; - - klist_iter_init(&parent->p->klist_children, &i); - while ((child = next_device(&i))) - if (sysfs_streq(dev_name(child), name) && get_device(child)) - break; - klist_iter_exit(&i); - return child; + return device_find_child(parent, name, device_match_name); } EXPORT_SYMBOL_GPL(device_find_child_by_name); From patchwork Thu Dec 5 00:10:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zijun Hu X-Patchwork-Id: 847799 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 EB2D8282FB for ; Thu, 5 Dec 2024 00:12:24 +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=1733357547; cv=none; b=dVTXW3AK4w9IS3d+ukeFGfp+4IgNEjxTf5D632g0FEX9sFw/zEuyxRoaj34+tbarOferkMmUbKHO7totaFY0/2V6HykbC15jmiQlzN6Bxv5wn+rbpCZf/D9GRkp/DLnqME2++yB7axHLzovJytWSw+6cG+x57G5txZybin52uyg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733357547; c=relaxed/simple; bh=aqJ9eoPPa8OOOh32wZYRxgdRy4YcjZ2E5IS28yYIKYE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=JuQm2D1SpEUfAk8EXQsiJ4818qox9y+jq5esBTfB/R3RlkHoyr9Ab28UYtvkT8GDlXFZVZDnHYIiQXHaBWeKfc0OaBtWqTi0+5WI8pvCDQyIUunWdPJ1C7npOcS/yO9R/EMCvUZd/nyi7oNuZdNtKXtZKHfhpezADbq9oUkuorE= 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=eeZ2XF97; 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="eeZ2XF97" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1733357544; bh=+hQoPBEqfvYVUdmuiivYhmF78DtBLM3+FjVAAqudA1Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To: x-icloud-hme; b=eeZ2XF978TocDnLvYVePUFkZh400KiGF0uy1CI+80u4NNivmK/1ZTsD8aGdY77B/b 4FlfVQiXwC60tsrx3iXfdwbp0KhzUzlGCCR92PtiOWRCcWFaz6+YilRtkBFlYJqA6e zmiY1FvVhTn0dlwU4khUfTWuaeP9T9diJDemzvvRqbTFFElUwHmA7rsx+IKG54DI/z Anactc5LZXbj61yO/T+AXdgQqGsclQ7iJDDWJjjhdhjwEdVZFzXklUupbArmw+1B8e h4y3bJ9nEsptyHupvpMGlws6B89RuMVTtxtb3BH269bHuASstz4w4KTCloKnV9dz96 1Cp7aXEEAq9pg== Received: from [192.168.1.26] (pv50p00im-dlb-asmtp-mailmevip.me.com [17.56.9.10]) by pv50p00im-tydg10011801.me.com (Postfix) with ESMTPSA id 0532C800244; Thu, 5 Dec 2024 00:12:13 +0000 (UTC) From: Zijun Hu Date: Thu, 05 Dec 2024 08:10:16 +0800 Subject: [PATCH v3 07/11] slimbus: core: Simplify of_find_slim_device() implementation Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241205-const_dfc_done-v3-7-1611f1486b5a@quicinc.com> References: <20241205-const_dfc_done-v3-0-1611f1486b5a@quicinc.com> In-Reply-To: <20241205-const_dfc_done-v3-0-1611f1486b5a@quicinc.com> To: Greg Kroah-Hartman Cc: =?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, open-iscsi@googlegroups.com, linux-usb@vger.kernel.org, linux-serial@vger.kernel.org, netdev@vger.kernel.org, Zijun Hu X-Mailer: b4 0.14.2 X-Proofpoint-ORIG-GUID: dJJDXavx1M32TEUDR81XI7OMWXU6vXXl X-Proofpoint-GUID: dJJDXavx1M32TEUDR81XI7OMWXU6vXXl 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-04_19,2024-12-04_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 clxscore=1015 phishscore=0 suspectscore=0 bulkscore=0 mlxscore=0 spamscore=0 mlxlogscore=948 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2308100000 definitions=main-2412040186 X-Apple-Remote-Links: v=1;h=KCk=;charset=UTF-8 From: Zijun Hu Simplify of_find_slim_device() implementation by device_match_of_node(). Signed-off-by: Zijun Hu --- drivers/slimbus/core.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/slimbus/core.c b/drivers/slimbus/core.c index ab927fd077cb4fe1e29c004269fe52b2896c302f..005fa2ef100f526df5603d212b6334c06a366c94 100644 --- a/drivers/slimbus/core.c +++ b/drivers/slimbus/core.c @@ -385,21 +385,13 @@ struct slim_device *slim_get_device(struct slim_controller *ctrl, } EXPORT_SYMBOL_GPL(slim_get_device); -static int of_slim_match_dev(struct device *dev, const void *data) -{ - const struct device_node *np = data; - struct slim_device *sbdev = to_slim_device(dev); - - return (sbdev->dev.of_node == np); -} - static struct slim_device *of_find_slim_device(struct slim_controller *ctrl, struct device_node *np) { struct slim_device *sbdev; struct device *dev; - dev = device_find_child(ctrl->dev, np, of_slim_match_dev); + dev = device_find_child(ctrl->dev, np, device_match_of_node); if (dev) { sbdev = to_slim_device(dev); return sbdev; From patchwork Thu Dec 5 00:10:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zijun Hu X-Patchwork-Id: 847798 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 481232EB1D for ; Thu, 5 Dec 2024 00:12:47 +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=1733357569; cv=none; b=qS4wC9OUIe3xIrJhE4E5264ft8yvTZ7pEE1lGw+eZH9BO649JtIqqWG+dRFooXaqBcvrtwO6XVLblQ57zPEc3yxm6GQGhfLSnVhY1Q65OOPgWsD+wnjunJTDqxOLLFu4W9eOMJCKJmR3qf8VRqPw0qO/ayEm4L7DQzFLHUwPOnw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733357569; c=relaxed/simple; bh=2hAoHPmKi8M7RtF7sC5dxcTk4Jak3PkyalgLRNozHoE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=i6UowMUE2U7pqjafcNHXe2l065je6yZTi5OqTyUZG+zZcLs8O3KPcZyq+sjuRKlT2g+bkPKqhYpMWt8umzPxMwOOMR4HOFmCpeDehClSvsuGfhD52QWjETsXs3CK13qu/Nxk2DTJkR2PEyZyPvrBG8JyeXKI5Vb+OMUxKSiJxhk= 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=ue/7hOPG; 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="ue/7hOPG" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1733357567; bh=jqsRJBKfSOaGGEJF6cLVoAsozLNhyHwMCTK1LKcdRqg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To: x-icloud-hme; b=ue/7hOPGIPUfWh3q+WudXhkgth58fUARjhoybi3adJJAE4vvqTf6Xzva7xsr0s+YH YKx2XassaFRHQwhc7XbZw867Nsm0wsDmYT92QHmWRQW//s2rqNPftLcbmx5FyQwRiF nqgspMdaCnOa3PXEmQKTscfKx5DYTMBDURwAnQ5sujWgxPGVo2O47owSP462AtG061 m+CLgiPl5YmM1xXadKPHpIW9a8xIZRewGJfpNxUtfiAzUM3Pn2Fc8q5+pKfqtDPCGL EHX5h2pIKnW5d+oSCsIlHzuRSfwVG7HtxjVL3irFtOmiatczDDVxZ778fUcvITzlEv VBEy9F/enldYg== Received: from [192.168.1.26] (pv50p00im-dlb-asmtp-mailmevip.me.com [17.56.9.10]) by pv50p00im-tydg10011801.me.com (Postfix) with ESMTPSA id 785B18000F6; Thu, 5 Dec 2024 00:12:36 +0000 (UTC) From: Zijun Hu Date: Thu, 05 Dec 2024 08:10:18 +0800 Subject: [PATCH v3 09/11] driver core: Introduce an device matching API device_match_type() Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241205-const_dfc_done-v3-9-1611f1486b5a@quicinc.com> References: <20241205-const_dfc_done-v3-0-1611f1486b5a@quicinc.com> In-Reply-To: <20241205-const_dfc_done-v3-0-1611f1486b5a@quicinc.com> To: Greg Kroah-Hartman Cc: =?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, open-iscsi@googlegroups.com, linux-usb@vger.kernel.org, linux-serial@vger.kernel.org, netdev@vger.kernel.org, Zijun Hu X-Mailer: b4 0.14.2 X-Proofpoint-ORIG-GUID: sKMzERip61ntNGEi7eR_TlH2PqH1Nkg5 X-Proofpoint-GUID: sKMzERip61ntNGEi7eR_TlH2PqH1Nkg5 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-04_19,2024-12-04_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 clxscore=1015 phishscore=0 suspectscore=0 bulkscore=0 mlxscore=0 spamscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2308100000 definitions=main-2412040186 X-Apple-Remote-Links: v=1;h=KCk=;charset=UTF-8 From: Zijun Hu Introduce device_match_type() for purposes below: - Test if a device matches with a specified device type. - As argument of various device finding APIs to find a device with specified type. device_find_child() will use it to simplify operations later. Signed-off-by: Zijun Hu --- drivers/base/core.c | 6 ++++++ include/linux/device/bus.h | 1 + 2 files changed, 7 insertions(+) diff --git a/drivers/base/core.c b/drivers/base/core.c index 289f2dafa8f3831931d0f316d66ee12c2cb8a2e1..8bdbc9e657e832a063542391426f570ccb5c18b9 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -5228,6 +5228,12 @@ int device_match_name(struct device *dev, const void *name) } EXPORT_SYMBOL_GPL(device_match_name); +int device_match_type(struct device *dev, const void *type) +{ + return dev->type == type; +} +EXPORT_SYMBOL_GPL(device_match_type); + int device_match_of_node(struct device *dev, const void *np) { return dev->of_node == np; diff --git a/include/linux/device/bus.h b/include/linux/device/bus.h index cdc4757217f9bb4b36b5c3b8a48bab45737e44c5..bc3fd74bb763e6d2d862859bd2ec3f0d443f2d7a 100644 --- a/include/linux/device/bus.h +++ b/include/linux/device/bus.h @@ -131,6 +131,7 @@ typedef int (*device_match_t)(struct device *dev, const void *data); /* Generic device matching functions that all busses can use to match with */ int device_match_name(struct device *dev, const void *name); +int device_match_type(struct device *dev, const void *type); int device_match_of_node(struct device *dev, const void *np); int device_match_fwnode(struct device *dev, const void *fwnode); int device_match_devt(struct device *dev, const void *pdevt); From patchwork Thu Dec 5 00:10:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zijun Hu X-Patchwork-Id: 847797 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 E521F2391B8 for ; Thu, 5 Dec 2024 00:13:09 +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=1733357591; cv=none; b=CHo3TN6hyc+1zdqYpUJyRKn0vSBDl/yPqIR1VB8QCgAv5EbgvN82ssOpTjBf4Koe3OjMiUMoJPfuJN2BemaOLr85hevNf5mIJTmqhoJ5iKX7YechxsUGBP2w4fRUTpEUwXfJhyo1GBDOCdBgM5BVgkmp7DNQAXB2B0v77ItJxqA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733357591; c=relaxed/simple; bh=9CVfL3LBZDuGqTPOlB/Hz3fqVHtXJi1gTAsCkM1ms9c=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BetHDnMfQTU3anvij6lug3HSW9iQe9bCeCkAKxanwpS304udR+ThwSquZK472aX8RfzThu61rgWFOErr4QGyYzq6SWQklViw/gV1sFpqfX8TSNflvDesUQXPJqnmSkR3COMw/QvdDm2C4xXGcvm4jCYYzbV07Bx4WSiaDNj7Bbs= 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=t2KTkk30; 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="t2KTkk30" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1733357589; bh=t5prCo8UotA+1FRQmsP8HYiQwFRGgFHZ6D5HPcEJxkY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To: x-icloud-hme; b=t2KTkk30j/x8cwgwejUYwek4VjEcxvplqznK79L1VULbmbGc8ou6ycm+rwwfEhTTT JOueTBNF2mp/zwSxcMu/VtvGuDduuIvrRyjs918+nC81xYIbUQrEH3l7zNMQn45jq5 ZS2Wf15OXou1M+D9min87hMiwC20ZSLHH9UfQwFBhvNC2aqm1DVRhAVZZaydyaXO7b e93Q4ScxXqL4B+jcufIMkxNyvs8Say+zLJymJXLzwZYkfoKDBRtH/MZJasFyv+4W9Q 7VDFlrk5wo4wXg/geYB1LEf/oH1wpsLc1V2iSnMt4bHHCqtnPt4jOY1A4QtPl58UXK VhcOwTTLVWhPQ== Received: from [192.168.1.26] (pv50p00im-dlb-asmtp-mailmevip.me.com [17.56.9.10]) by pv50p00im-tydg10011801.me.com (Postfix) with ESMTPSA id 0A474800382; Thu, 5 Dec 2024 00:12:58 +0000 (UTC) From: Zijun Hu Date: Thu, 05 Dec 2024 08:10:20 +0800 Subject: [PATCH v3 11/11] usb: typec: class: Remove both cable_match() and partner_match() Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241205-const_dfc_done-v3-11-1611f1486b5a@quicinc.com> References: <20241205-const_dfc_done-v3-0-1611f1486b5a@quicinc.com> In-Reply-To: <20241205-const_dfc_done-v3-0-1611f1486b5a@quicinc.com> To: Greg Kroah-Hartman Cc: =?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, open-iscsi@googlegroups.com, linux-usb@vger.kernel.org, linux-serial@vger.kernel.org, netdev@vger.kernel.org, Zijun Hu X-Mailer: b4 0.14.2 X-Proofpoint-ORIG-GUID: VdKDrx-KLtW7yCbNEje76WJIjR4qS0Q9 X-Proofpoint-GUID: VdKDrx-KLtW7yCbNEje76WJIjR4qS0Q9 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-04_19,2024-12-04_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 clxscore=1015 phishscore=0 suspectscore=0 bulkscore=0 mlxscore=0 spamscore=0 mlxlogscore=901 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2308100000 definitions=main-2412040186 X-Apple-Remote-Links: v=1;h=KCk=;charset=UTF-8 From: Zijun Hu cable_match(), as matching function of device_find_child(), is to match a device with device type @typec_cable_dev_type, and is unnecessary. partner_match() is similar with cable_match() but with different device type @typec_partner_dev_type. Remove both functions and directly use API device_match_type() plus respective device type instead. Signed-off-by: Zijun Hu --- drivers/usb/typec/class.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c index 601a81aa1e1024265f2359393dee531a7779c6ea..3a4e0bd0131774afd0d746d2f0a306190219feec 100644 --- a/drivers/usb/typec/class.c +++ b/drivers/usb/typec/class.c @@ -1282,11 +1282,6 @@ const struct device_type typec_cable_dev_type = { .release = typec_cable_release, }; -static int cable_match(struct device *dev, const void *data) -{ - return is_typec_cable(dev); -} - /** * typec_cable_get - Get a reference to the USB Type-C cable * @port: The USB Type-C Port the cable is connected to @@ -1298,7 +1293,8 @@ struct typec_cable *typec_cable_get(struct typec_port *port) { struct device *dev; - dev = device_find_child(&port->dev, NULL, cable_match); + dev = device_find_child(&port->dev, &typec_cable_dev_type, + device_match_type); if (!dev) return NULL; @@ -2028,16 +2024,12 @@ const struct device_type typec_port_dev_type = { /* --------------------------------------- */ /* Driver callbacks to report role updates */ -static int partner_match(struct device *dev, const void *data) -{ - return is_typec_partner(dev); -} - static struct typec_partner *typec_get_partner(struct typec_port *port) { struct device *dev; - dev = device_find_child(&port->dev, NULL, partner_match); + dev = device_find_child(&port->dev, &typec_partner_dev_type, + device_match_type); if (!dev) return NULL; @@ -2170,7 +2162,9 @@ void typec_set_pwr_opmode(struct typec_port *port, sysfs_notify(&port->dev.kobj, NULL, "power_operation_mode"); kobject_uevent(&port->dev.kobj, KOBJ_CHANGE); - partner_dev = device_find_child(&port->dev, NULL, partner_match); + partner_dev = device_find_child(&port->dev, + &typec_partner_dev_type, + device_match_type); if (partner_dev) { struct typec_partner *partner = to_typec_partner(partner_dev); @@ -2334,7 +2328,9 @@ int typec_get_negotiated_svdm_version(struct typec_port *port) enum usb_pd_svdm_ver svdm_version; struct device *partner_dev; - partner_dev = device_find_child(&port->dev, NULL, partner_match); + partner_dev = device_find_child(&port->dev, + &typec_partner_dev_type, + device_match_type); if (!partner_dev) return -ENODEV; @@ -2361,7 +2357,8 @@ int typec_get_cable_svdm_version(struct typec_port *port) enum usb_pd_svdm_ver svdm_version; struct device *cable_dev; - cable_dev = device_find_child(&port->dev, NULL, cable_match); + cable_dev = device_find_child(&port->dev, &typec_cable_dev_type, + device_match_type); if (!cable_dev) return -ENODEV;