From patchwork Tue Dec 3 00:33:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zijun Hu X-Patchwork-Id: 847175 Received: from pv50p00im-zteg10011501.me.com (pv50p00im-zteg10011501.me.com [17.58.6.42]) (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 E3D1B537FF for ; Tue, 3 Dec 2024 00:35:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=17.58.6.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733186122; cv=none; b=BfGtB/clrSKWQCPGI91FsFrPQZzL0dERFUGAu8hEhsk6HPvo4uazujAFL3HSOUtsOF9tUqIf6OA09XbOwWl0zbsFvaU4K0fjuTq6wKWej6/EGzy1bdw4NNYjrXdACpVG3cn7XkGde+xLmg50UXSW60j8ncwKnWAk2qZ1AziAb5E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733186122; c=relaxed/simple; bh=iw6gaObvgoK4xPTJIhFVAQ3lR2MbnHW598a95SEbCWk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CrpcK4Vl2l6vRRDPObRNJDkmHKi5ATmswCJAMd+WaUZnXAVU5D4YaTf2eWtUloBnk3ufXBpDW4XeoWwIN1LTSKg3IWn9u9PH8JFrQEa+XIwzW9/hWK+Ku51QnwHe4c+MsPOYC+7EKk55GXRJNqumuckIklrwFsT8tWw1wdVd34k= 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=pr4JiGbg; arc=none smtp.client-ip=17.58.6.42 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="pr4JiGbg" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1733186120; bh=yQGAFPv+pJbBj/iId65BhA8VYlqddAV7eyST3/hbPmw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To: x-icloud-hme; b=pr4JiGbgDRl4jH5Qb0VGGx2xr1KK4cmnjROfS3UObcXGX0xG13I89d21nJ34wwAgJ g1qp3I97bvrYHBPEfpAH8pIdDnEZrpRcqKTfaxxMfx3oPrbV8789mePOysUhjEv9aL oEhjTy2bDoa7ZmHPC94SyJ1BDof/W7B8eOcW/iGV7waR3E7wB0AsIyjgaTFxhSTJz8 DqB4yc2WFjsPgjq/Yiemk5zagt8izivWEqBpJXmqr54sAXeTX4O5DirjiMJQf3si1P cGbukMI6SId4TX2iOzTEZiFUsp05rYzqtmjKqVLHWJtjb5jBN3F7u2lHOBVDaoCsw0 uNAEOMMXdssPQ== Received: from [192.168.1.26] (pv50p00im-dlb-asmtp-mailmevip.me.com [17.56.9.10]) by pv50p00im-zteg10011501.me.com (Postfix) with ESMTPSA id 04AE54A0549; Tue, 3 Dec 2024 00:34:59 +0000 (UTC) From: Zijun Hu Date: Tue, 03 Dec 2024 08:33:23 +0800 Subject: [PATCH v2 01/32] driver core: Constify API device_find_child() Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241203-const_dfc_done-v2-1-7436a98c497f@quicinc.com> References: <20241203-const_dfc_done-v2-0-7436a98c497f@quicinc.com> In-Reply-To: <20241203-const_dfc_done-v2-0-7436a98c497f@quicinc.com> To: Greg Kroah-Hartman , "Rafael J. Wysocki" , Chun-Kuang Hu , Philipp Zabel , David Airlie , Simona Vetter , Matthias Brugger , AngeloGioacchino Del Regno , Jean Delvare , Guenter Roeck , Martin Tuma , Mauro Carvalho Chehab , Andreas Noever , Michael Jamet , Mika Westerberg , Yehezkel Bernat , Linus Walleij , Bartosz Golaszewski , Andrew Lunn , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Dan Williams , Vishal Verma , Dave Jiang , Ira Weiny , Takashi Sakamoto , Jiri Slaby , Heikki Krogerus , Srinivas Kandagatla , Lee Duncan , Chris Leech , Mike Christie , "James E.J. Bottomley" , "Martin K. Petersen" , Nilesh Javali , Manish Rangankar , GR-QLogic-Storage-Upstream@marvell.com, Davidlohr Bueso , Jonathan Cameron , Alison Schofield , Andreas Larsson , Stuart Yoder , Laurentiu Tudor , Jens Axboe , Sudeep Holla , Cristian Marussi , Ard Biesheuvel , Bjorn Andersson , Mathieu Poirier Cc: Zijun Hu , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-hwmon@vger.kernel.org, linux-media@vger.kernel.org, linux-usb@vger.kernel.org, linux-gpio@vger.kernel.org, netdev@vger.kernel.org, linux-pwm@vger.kernel.org, nvdimm@lists.linux.dev, linux1394-devel@lists.sourceforge.net, linux-serial@vger.kernel.org, linux-sound@vger.kernel.org, open-iscsi@googlegroups.com, linux-scsi@vger.kernel.org, linux-cxl@vger.kernel.org, sparclinux@vger.kernel.org, linux-block@vger.kernel.org, arm-scmi@vger.kernel.org, linux-efi@vger.kernel.org, linux-remoteproc@vger.kernel.org, Zijun Hu X-Mailer: b4 0.14.2 X-Proofpoint-GUID: 6SgCLfUyKpGAcB9NyJdr1xbmKY272C_F X-Proofpoint-ORIG-GUID: 6SgCLfUyKpGAcB9NyJdr1xbmKY272C_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-02_14,2024-12-02_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 bulkscore=0 mlxlogscore=999 mlxscore=0 spamscore=0 suspectscore=0 malwarescore=0 clxscore=1015 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2308100000 definitions=main-2412030002 X-Apple-Remote-Links: v=1;h=KCk=;charset=UTF-8 From: Zijun Hu Constify the following API: struct device *device_find_child(struct device *dev, void *data, int (*match)(struct device *dev, void *data)); To : struct device *device_find_child(struct device *dev, const void *data, device_match_t match); typedef int (*device_match_t)(struct device *dev, const void *data); with the following reasons: - Protect caller's match data @*data which is for comparison and lookup and the API does not actually need to modify @*data. - Make the API's parameters (@match)() and @data have the same type as all of other device finding APIs (bus|class|driver)_find_device(). - All kinds of existing device match functions can be directly taken as the API's argument, they were exported by driver core. Now, no (*match)() argument of the API usages is modifying @*data in current kernel tree, so it is safe to constify the API. Signed-off-by: Zijun Hu --- drivers/base/core.c | 11 +++-------- include/linux/device.h | 4 ++-- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/base/core.c b/drivers/base/core.c index 94865c9d8adcf5f2ce5002ffd7bf0ef4fc85e4d7..a122ea1d84a3b08fce16dd1abdfa7746d31dc430 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -4079,8 +4079,8 @@ EXPORT_SYMBOL_GPL(device_for_each_child_reverse_from); * * NOTE: you will need to drop the reference with put_device() after use. */ -struct device *device_find_child(struct device *parent, void *data, - int (*match)(struct device *dev, void *data)) +struct device *device_find_child(struct device *parent, const void *data, + device_match_t match) { struct klist_iter i; struct device *child; @@ -4125,11 +4125,6 @@ struct device *device_find_child_by_name(struct device *parent, } EXPORT_SYMBOL_GPL(device_find_child_by_name); -static int match_any(struct device *dev, void *unused) -{ - return 1; -} - /** * device_find_any_child - device iterator for locating a child device, if any. * @parent: parent struct device @@ -4141,7 +4136,7 @@ static int match_any(struct device *dev, void *unused) */ struct device *device_find_any_child(struct device *parent) { - return device_find_child(parent, NULL, match_any); + return device_find_child(parent, NULL, device_match_any); } EXPORT_SYMBOL_GPL(device_find_any_child); diff --git a/include/linux/device.h b/include/linux/device.h index 667cb6db9019349c9db0233acf9e78ff6a6d9625..0e0bc9bfe0d15a8734bf3d34106300f4df6b5364 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -1081,8 +1081,8 @@ int device_for_each_child_reverse(struct device *dev, void *data, int device_for_each_child_reverse_from(struct device *parent, struct device *from, const void *data, int (*fn)(struct device *, const void *)); -struct device *device_find_child(struct device *dev, void *data, - int (*match)(struct device *dev, void *data)); +struct device *device_find_child(struct device *dev, const void *data, + device_match_t match); struct device *device_find_child_by_name(struct device *parent, const char *name); struct device *device_find_any_child(struct device *parent); From patchwork Tue Dec 3 00:33:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zijun Hu X-Patchwork-Id: 847174 Received: from pv50p00im-zteg10011501.me.com (pv50p00im-zteg10011501.me.com [17.58.6.42]) (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 2BBF9847C for ; Tue, 3 Dec 2024 00:36:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=17.58.6.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733186166; cv=none; b=IPmRZHsAS74AZyOwV5eDRiSADgqYKhhZ5fAbfDfHK2kG0mSvO23MMCK2NJzAiNkiF54A8Fdk6FRxlxI3erVLmOlO+bIlKtmMNknuRNrQk0X1Pjb/uH/aHhqdRzl08y/U/TXGEFHh0kErgnlX21lC05I8eTGnCDFMfAMAOf0Pi3E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733186166; c=relaxed/simple; bh=XgwVx3M7WixZKPRC36l6Q/SYvFE46fLJpMWmOkZL+ro=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NQeQxx6osYo6/n2cMiWdr1zmoyY6GM1VIg0KrYnhtQ/EMHENQTqhcScbtW4/QYZbGAeLhiRMuYo7SJl5dwXOrV3vnqq4PvJK3QWGalCwV7kdzlL29onXGouEXQrZFSm7lvlVejmlgsO2p3GjxFqThn7ihPy/Kf+zsB2etD4HeCA= 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=u1JlnJt5; arc=none smtp.client-ip=17.58.6.42 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="u1JlnJt5" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1733186163; bh=8oKTqrAKebW9WBOlzoM4TxO8uixngvvulXc2gSncQpE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To: x-icloud-hme; b=u1JlnJt5TlikeEAdxSGIdqpUn09/s5OJrSutqhAw4UQ3FUbpKVcLtcZq/tzWPFj0S 2ni5MzccVAEzqLTN3RdwfISAmiwWmeIiS4kSTHOG7pnkJUCl8Ltzmb/r1WRNlRyWES dJj8uC3cfQmdAXSNDNa70S8/SnZ7MQcJak+7F6NmyWOEQQ+bYmPIrK8kX0p2eVESkt AkPLvyfKoS2LrvGv7rsGHXP9JWwaZgSAoMdL0mowmC4mEYB9IccdyQ+PpzYKumyllk Fg85uB1PM/2C0OiZlaQbjsQDPuOSbwcJcTTfWk5rY7BzUQgWUVmZGlBxXUOvbDvYVj zcNQ3TmSKjQJA== Received: from [192.168.1.26] (pv50p00im-dlb-asmtp-mailmevip.me.com [17.56.9.10]) by pv50p00im-zteg10011501.me.com (Postfix) with ESMTPSA id 26EF74A0457; Tue, 3 Dec 2024 00:35:41 +0000 (UTC) From: Zijun Hu Date: Tue, 03 Dec 2024 08:33:25 +0800 Subject: [PATCH v2 03/32] drm/mediatek: Adapt for constified device_find_child() Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241203-const_dfc_done-v2-3-7436a98c497f@quicinc.com> References: <20241203-const_dfc_done-v2-0-7436a98c497f@quicinc.com> In-Reply-To: <20241203-const_dfc_done-v2-0-7436a98c497f@quicinc.com> To: Greg Kroah-Hartman , "Rafael J. Wysocki" , Chun-Kuang Hu , Philipp Zabel , David Airlie , Simona Vetter , Matthias Brugger , AngeloGioacchino Del Regno , Jean Delvare , Guenter Roeck , Martin Tuma , Mauro Carvalho Chehab , Andreas Noever , Michael Jamet , Mika Westerberg , Yehezkel Bernat , Linus Walleij , Bartosz Golaszewski , Andrew Lunn , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Dan Williams , Vishal Verma , Dave Jiang , Ira Weiny , Takashi Sakamoto , Jiri Slaby , Heikki Krogerus , Srinivas Kandagatla , Lee Duncan , Chris Leech , Mike Christie , "James E.J. Bottomley" , "Martin K. Petersen" , Nilesh Javali , Manish Rangankar , GR-QLogic-Storage-Upstream@marvell.com, Davidlohr Bueso , Jonathan Cameron , Alison Schofield , Andreas Larsson , Stuart Yoder , Laurentiu Tudor , Jens Axboe , Sudeep Holla , Cristian Marussi , Ard Biesheuvel , Bjorn Andersson , Mathieu Poirier Cc: Zijun Hu , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-hwmon@vger.kernel.org, linux-media@vger.kernel.org, linux-usb@vger.kernel.org, linux-gpio@vger.kernel.org, netdev@vger.kernel.org, linux-pwm@vger.kernel.org, nvdimm@lists.linux.dev, linux1394-devel@lists.sourceforge.net, linux-serial@vger.kernel.org, linux-sound@vger.kernel.org, open-iscsi@googlegroups.com, linux-scsi@vger.kernel.org, linux-cxl@vger.kernel.org, sparclinux@vger.kernel.org, linux-block@vger.kernel.org, arm-scmi@vger.kernel.org, linux-efi@vger.kernel.org, linux-remoteproc@vger.kernel.org, Zijun Hu X-Mailer: b4 0.14.2 X-Proofpoint-GUID: r2PHi7bIcwf9ElW8aqnD_T2_M0lSLrFl X-Proofpoint-ORIG-GUID: r2PHi7bIcwf9ElW8aqnD_T2_M0lSLrFl 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-02_14,2024-12-02_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 bulkscore=0 mlxlogscore=999 mlxscore=0 spamscore=0 suspectscore=0 malwarescore=0 clxscore=1015 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2308100000 definitions=main-2412030002 X-Apple-Remote-Links: v=1;h=KCk=;charset=UTF-8 From: Zijun Hu device_find_child() has been constified to take new match function type: typedef int (*device_match_t)(struct device *dev, const void *data); Make mtk_drm_match() take a const pointer to adapt for the new type. Signed-off-by: Zijun Hu --- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c index 9a8ef8558da921c75c1ab1986795bbc0a394899d..7a276c3965cd0e9147dffb28693fd9d1a1053fc7 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c @@ -359,7 +359,7 @@ static const struct of_device_id mtk_drm_of_ids[] = { }; MODULE_DEVICE_TABLE(of, mtk_drm_of_ids); -static int mtk_drm_match(struct device *dev, void *data) +static int mtk_drm_match(struct device *dev, const void *data) { if (!strncmp(dev_name(dev), "mediatek-drm", sizeof("mediatek-drm") - 1)) return true; From patchwork Tue Dec 3 00:33:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zijun Hu X-Patchwork-Id: 847173 Received: from pv50p00im-zteg10011501.me.com (pv50p00im-zteg10011501.me.com [17.58.6.42]) (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 F26B11CAB8 for ; Tue, 3 Dec 2024 00:36:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=17.58.6.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733186208; cv=none; b=sUo8CtL/QUn/kjmtFPHr24WZZalMJnTXGCReyuLDVBgsLBPSiiqhPszEnwnYoXjG5DFu3khwFjDkay1Fufk5y7RHt0q4GDmn+boABs1vmNXGs7itZA/GTwnm7p8ATcNDjEsJ1FxaR+6JfsK1suhMtLSX6JtSKWQ4sDviYiDIvx0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733186208; c=relaxed/simple; bh=0pmkVmkdexMzVD7CitPN355aISpwyo5n7HnGnW8xvtI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=X/KujAXfW7MfCXgg+tixZieN349wrRQR3XRWIfX2c65CR7G+vxR2HB4ydY9E6dT1bxUCFyuyenPjrEQY51BClhOK14mmxfr0o2AowQ0NZXTInlVNUnMZJBcaS3AssLVROMkizYKF1tn0aUmIlOt8X1hD0FzVvQ2kitbI+YdacIA= 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=ObmVCSyK; arc=none smtp.client-ip=17.58.6.42 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="ObmVCSyK" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1733186205; bh=SSnfrLpaIqpTBx9QqpuhLFeoWIynMtinyOBbC22fWs0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To: x-icloud-hme; b=ObmVCSyKqUug4GAR5yet0Vp5Bq6987z1bM/OQ/bP62dBxm5XJGn3KX3dNawO542Ww tb5XHH4umbuLfEQOVXx9Txu0UeLNIV22VMn1pe2J8magDSHsF1Ejf5v8XwVSIZu1Yo BgA4d0yOrZeQp8JQEO++Q+wrZHQfhRTRe/f4piT6itW1DCkH938yBM5laOHKjdHxPL VnT2Y9SUP5bbBWH5EQal391Kg/YvKlrGNj5ogF2vCLUHQGt1a6iE1dXf4watf+gSOC Yfd0VnhAlIreTlytB5FCQakfQXZ6TluqubGcqjByuE8XvabG+NiGEAWljIJN8v1UOX EQKIHiwksD2Pg== Received: from [192.168.1.26] (pv50p00im-dlb-asmtp-mailmevip.me.com [17.56.9.10]) by pv50p00im-zteg10011501.me.com (Postfix) with ESMTPSA id CF7184A0114; Tue, 3 Dec 2024 00:36:24 +0000 (UTC) From: Zijun Hu Date: Tue, 03 Dec 2024 08:33:27 +0800 Subject: [PATCH v2 05/32] media: pci: mgb4: Adapt for constified device_find_child() Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241203-const_dfc_done-v2-5-7436a98c497f@quicinc.com> References: <20241203-const_dfc_done-v2-0-7436a98c497f@quicinc.com> In-Reply-To: <20241203-const_dfc_done-v2-0-7436a98c497f@quicinc.com> To: Greg Kroah-Hartman , "Rafael J. Wysocki" , Chun-Kuang Hu , Philipp Zabel , David Airlie , Simona Vetter , Matthias Brugger , AngeloGioacchino Del Regno , Jean Delvare , Guenter Roeck , Martin Tuma , Mauro Carvalho Chehab , Andreas Noever , Michael Jamet , Mika Westerberg , Yehezkel Bernat , Linus Walleij , Bartosz Golaszewski , Andrew Lunn , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Dan Williams , Vishal Verma , Dave Jiang , Ira Weiny , Takashi Sakamoto , Jiri Slaby , Heikki Krogerus , Srinivas Kandagatla , Lee Duncan , Chris Leech , Mike Christie , "James E.J. Bottomley" , "Martin K. Petersen" , Nilesh Javali , Manish Rangankar , GR-QLogic-Storage-Upstream@marvell.com, Davidlohr Bueso , Jonathan Cameron , Alison Schofield , Andreas Larsson , Stuart Yoder , Laurentiu Tudor , Jens Axboe , Sudeep Holla , Cristian Marussi , Ard Biesheuvel , Bjorn Andersson , Mathieu Poirier Cc: Zijun Hu , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-hwmon@vger.kernel.org, linux-media@vger.kernel.org, linux-usb@vger.kernel.org, linux-gpio@vger.kernel.org, netdev@vger.kernel.org, linux-pwm@vger.kernel.org, nvdimm@lists.linux.dev, linux1394-devel@lists.sourceforge.net, linux-serial@vger.kernel.org, linux-sound@vger.kernel.org, open-iscsi@googlegroups.com, linux-scsi@vger.kernel.org, linux-cxl@vger.kernel.org, sparclinux@vger.kernel.org, linux-block@vger.kernel.org, arm-scmi@vger.kernel.org, linux-efi@vger.kernel.org, linux-remoteproc@vger.kernel.org, Zijun Hu X-Mailer: b4 0.14.2 X-Proofpoint-GUID: W-g9c5jPAdNx4vqI0xaEwGs2JJSxHZXa X-Proofpoint-ORIG-GUID: W-g9c5jPAdNx4vqI0xaEwGs2JJSxHZXa 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-02_14,2024-12-02_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 bulkscore=0 mlxlogscore=999 mlxscore=0 spamscore=0 suspectscore=0 malwarescore=0 clxscore=1015 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2308100000 definitions=main-2412030002 X-Apple-Remote-Links: v=1;h=KCk=;charset=UTF-8 From: Zijun Hu device_find_child() has been constified to take new match function type: typedef int (*device_match_t)(struct device *dev, const void *data); Make its match functions take a const pointer to adapt for the new type. Signed-off-by: Zijun Hu --- drivers/media/pci/mgb4/mgb4_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/pci/mgb4/mgb4_core.c b/drivers/media/pci/mgb4/mgb4_core.c index bc63dc81bcae0d20924174be74b93a2139d5879f..697d50bedfe285d74c702efde61e510df87c1229 100644 --- a/drivers/media/pci/mgb4/mgb4_core.c +++ b/drivers/media/pci/mgb4/mgb4_core.c @@ -123,7 +123,7 @@ static const struct hwmon_chip_info temp_chip_info = { }; #endif -static int match_i2c_adap(struct device *dev, void *data) +static int match_i2c_adap(struct device *dev, const void *data) { return i2c_verify_adapter(dev) ? 1 : 0; } @@ -139,7 +139,7 @@ static struct i2c_adapter *get_i2c_adap(struct platform_device *pdev) return dev ? to_i2c_adapter(dev) : NULL; } -static int match_spi_adap(struct device *dev, void *data) +static int match_spi_adap(struct device *dev, const void *data) { return to_spi_device(dev) ? 1 : 0; } From patchwork Tue Dec 3 00:33:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zijun Hu X-Patchwork-Id: 847172 Received: from pv50p00im-zteg10011501.me.com (pv50p00im-zteg10011501.me.com [17.58.6.42]) (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 8618B131E2D for ; Tue, 3 Dec 2024 00:37:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=17.58.6.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733186251; cv=none; b=S5tEguCknvST+jZpf2NkLUQR/JzdetwjlVfYilKK7Sw+YJKPiNqo0/W76nGXpuDJvNq1pvr05YLR2LL+RPx2hI9MXYtXs6JQQbX4G8AHeUDYoQwO/bA0d+5qfJ0ki1uCnQ8m2aKf8sCunONPESA6QyNLXFnvRIxLKX2JdFdkT5M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733186251; c=relaxed/simple; bh=7FciL78UUlibZsHod7F7YNBV/ooO8nagTnWXq3BkucY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Yk9xF+SBkiUBzHd7F704DP4nuOpRcJISSNK2vaQVZe/95o6wHaTMIusi8JeFbb4A1OISyUx5QqWEvM8XLmMuL5BJWdTaaTwKHFY3d+ii02/d7dsrStu6B5tD9o9TApUHKzVOGaNPPwADrQoDaCriAmWogRnkhrb7oN23MtQlsvo= 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=RdJmst+O; arc=none smtp.client-ip=17.58.6.42 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="RdJmst+O" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1733186249; bh=+s67f8n4U38kNtBzbNjBtNPtsaYtVPWfyTOydyoL87U=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To: x-icloud-hme; b=RdJmst+OGS1bX18zihPRnq3E4k8Mn0X9gd0De5cMNzdIENXb3O8qhxJoISLLIHPnX SmVWOv6lgiW8uxFqHQVn6CIL8UWhU+SQ5/c/GaDeD/ZBOanvXDqxIB47dCFo4/Mg9S Y7nXCVjY03OUPd8tAeu/s13OFpuatFHhJ9ranKymnlfaFEXP5HHYhXF0dGVFb7uXqO U1Tfsb6uMZjwNnqQJ47gVvxhIu5AP5uoR1PmpdGvjUdq7Oan2xvuwvvrb3ROxUCIGX 4JXq2krogrKZuYlhTFe06UWFxW1I8oIFHJR9yuwEC6FRuV/L//g7Y+QppMj7DwPT6C BvaISGX1MT84g== Received: from [192.168.1.26] (pv50p00im-dlb-asmtp-mailmevip.me.com [17.56.9.10]) by pv50p00im-zteg10011501.me.com (Postfix) with ESMTPSA id 626224A0614; Tue, 3 Dec 2024 00:37:08 +0000 (UTC) From: Zijun Hu Date: Tue, 03 Dec 2024 08:33:29 +0800 Subject: [PATCH v2 07/32] gpio: sim: Remove gpio_sim_dev_match_fwnode() Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241203-const_dfc_done-v2-7-7436a98c497f@quicinc.com> References: <20241203-const_dfc_done-v2-0-7436a98c497f@quicinc.com> In-Reply-To: <20241203-const_dfc_done-v2-0-7436a98c497f@quicinc.com> To: Greg Kroah-Hartman , "Rafael J. Wysocki" , Chun-Kuang Hu , Philipp Zabel , David Airlie , Simona Vetter , Matthias Brugger , AngeloGioacchino Del Regno , Jean Delvare , Guenter Roeck , Martin Tuma , Mauro Carvalho Chehab , Andreas Noever , Michael Jamet , Mika Westerberg , Yehezkel Bernat , Linus Walleij , Bartosz Golaszewski , Andrew Lunn , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Dan Williams , Vishal Verma , Dave Jiang , Ira Weiny , Takashi Sakamoto , Jiri Slaby , Heikki Krogerus , Srinivas Kandagatla , Lee Duncan , Chris Leech , Mike Christie , "James E.J. Bottomley" , "Martin K. Petersen" , Nilesh Javali , Manish Rangankar , GR-QLogic-Storage-Upstream@marvell.com, Davidlohr Bueso , Jonathan Cameron , Alison Schofield , Andreas Larsson , Stuart Yoder , Laurentiu Tudor , Jens Axboe , Sudeep Holla , Cristian Marussi , Ard Biesheuvel , Bjorn Andersson , Mathieu Poirier Cc: Zijun Hu , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-hwmon@vger.kernel.org, linux-media@vger.kernel.org, linux-usb@vger.kernel.org, linux-gpio@vger.kernel.org, netdev@vger.kernel.org, linux-pwm@vger.kernel.org, nvdimm@lists.linux.dev, linux1394-devel@lists.sourceforge.net, linux-serial@vger.kernel.org, linux-sound@vger.kernel.org, open-iscsi@googlegroups.com, linux-scsi@vger.kernel.org, linux-cxl@vger.kernel.org, sparclinux@vger.kernel.org, linux-block@vger.kernel.org, arm-scmi@vger.kernel.org, linux-efi@vger.kernel.org, linux-remoteproc@vger.kernel.org, Zijun Hu X-Mailer: b4 0.14.2 X-Proofpoint-GUID: LUw6jrNTlWvafXG6SgNBaGnBoiXYHqLl X-Proofpoint-ORIG-GUID: LUw6jrNTlWvafXG6SgNBaGnBoiXYHqLl 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-02_14,2024-12-02_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 bulkscore=0 mlxlogscore=999 mlxscore=0 spamscore=0 suspectscore=0 malwarescore=0 clxscore=1015 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2308100000 definitions=main-2412030002 X-Apple-Remote-Links: v=1;h=KCk=;charset=UTF-8 From: Zijun Hu device_find_child() has been constified to take new match function type: typedef int (*device_match_t)(struct device *dev, const void *data); So device_match_fwnode() is applicable for the new type directly, and remove its unnecessary wrapper gpio_sim_dev_match_fwnode(). Signed-off-by: Zijun Hu --- drivers/gpio/gpio-sim.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/gpio/gpio-sim.c b/drivers/gpio/gpio-sim.c index f387dad81f2960b5ec3c1b5fd04081ee501cc75b..b1f33cbaaaa78aca324f99c45a868e7e79a9d672 100644 --- a/drivers/gpio/gpio-sim.c +++ b/drivers/gpio/gpio-sim.c @@ -413,11 +413,6 @@ static int gpio_sim_setup_sysfs(struct gpio_sim_chip *chip) return devm_add_action_or_reset(dev, gpio_sim_sysfs_remove, chip); } -static int gpio_sim_dev_match_fwnode(struct device *dev, void *data) -{ - return device_match_fwnode(dev, data); -} - static int gpio_sim_add_bank(struct fwnode_handle *swnode, struct device *dev) { struct gpio_sim_chip *chip; @@ -503,7 +498,7 @@ static int gpio_sim_add_bank(struct fwnode_handle *swnode, struct device *dev) if (ret) return ret; - chip->dev = device_find_child(dev, swnode, gpio_sim_dev_match_fwnode); + chip->dev = device_find_child(dev, swnode, device_match_fwnode); if (!chip->dev) return -ENODEV; From patchwork Tue Dec 3 00:33:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zijun Hu X-Patchwork-Id: 847171 Received: from pv50p00im-zteg10011501.me.com (pv50p00im-zteg10011501.me.com [17.58.6.42]) (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 9352677F11 for ; Tue, 3 Dec 2024 00:38:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=17.58.6.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733186295; cv=none; b=cQw/IAEWOBeUOAwcpWEJ1HooaCHDKE/hwWunO/W15qefl3v9cvSf9pm5BtWn/7Dv7cLURw9FJvk9faVzFhbeh7ylTsgdurWFMowGq03l1CJRNzX28pQKeyAz0WTW7uI+D0sRNfyhHRSbjn7y4+exomII2fJjLXUw805TkB3SjO8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733186295; c=relaxed/simple; bh=bQfOQHO7ISWCS4Acx+hKzNVqSQAnzvcjpoObRDQrraw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Qgkrr9c+H6mP0M8dEdzN+9JyHnJFJWD7jhdz5RJDiPlqbbYUKW5ImczuZIRKoBKcXslaRL53WRoO4rY3D4T7qY/sus0Ltg3S7eYenm81ohN2vdKNQCP8IYJqndTFDav12rQR4OeN06QFkEumAB0PZKPRLFRZV6CyqtuEo/Bf1b8= 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=e0HvpemQ; arc=none smtp.client-ip=17.58.6.42 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="e0HvpemQ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1733186292; bh=96ZNc//RiTah98EplseyqK3Ez4GUZqYaNN6bjHBrHJg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To: x-icloud-hme; b=e0HvpemQeMJmmLJn6qYgvJPHj6ENfq5O176JB3a/fUzv129yHzdfJNRUUa1uEdjzS gM0RLE/UbtnocHaL9qoTxbXwHq8x1Mrp+Vk8SP//kjMGwykiF5MztyXQwGtFEr6rp/ /r9jTmEMbg7L0JyyA3i93EY9QzuTQX3TJZkDtDHRhvGPJhxeBfovyDXIsQ0ijM0McA DhChMrIwOYjMCX1PMhXA9XbEbWQihITH4yagkI//khuLBv5Rb7p060NjyYMR5ndq4M g+yizy1g0JGZZsHkUcZ2A6+tGEvmB6iLHzdEHyvvJ90SOVxXunmxdBaOtxUpaDfg+0 QwXXi3zvbH+Qg== Received: from [192.168.1.26] (pv50p00im-dlb-asmtp-mailmevip.me.com [17.56.9.10]) by pv50p00im-zteg10011501.me.com (Postfix) with ESMTPSA id 11EB94A0349; Tue, 3 Dec 2024 00:37:50 +0000 (UTC) From: Zijun Hu Date: Tue, 03 Dec 2024 08:33:31 +0800 Subject: [PATCH v2 09/32] pwm: Adapt for constified device_find_child() Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241203-const_dfc_done-v2-9-7436a98c497f@quicinc.com> References: <20241203-const_dfc_done-v2-0-7436a98c497f@quicinc.com> In-Reply-To: <20241203-const_dfc_done-v2-0-7436a98c497f@quicinc.com> To: Greg Kroah-Hartman , "Rafael J. Wysocki" , Chun-Kuang Hu , Philipp Zabel , David Airlie , Simona Vetter , Matthias Brugger , AngeloGioacchino Del Regno , Jean Delvare , Guenter Roeck , Martin Tuma , Mauro Carvalho Chehab , Andreas Noever , Michael Jamet , Mika Westerberg , Yehezkel Bernat , Linus Walleij , Bartosz Golaszewski , Andrew Lunn , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Dan Williams , Vishal Verma , Dave Jiang , Ira Weiny , Takashi Sakamoto , Jiri Slaby , Heikki Krogerus , Srinivas Kandagatla , Lee Duncan , Chris Leech , Mike Christie , "James E.J. Bottomley" , "Martin K. Petersen" , Nilesh Javali , Manish Rangankar , GR-QLogic-Storage-Upstream@marvell.com, Davidlohr Bueso , Jonathan Cameron , Alison Schofield , Andreas Larsson , Stuart Yoder , Laurentiu Tudor , Jens Axboe , Sudeep Holla , Cristian Marussi , Ard Biesheuvel , Bjorn Andersson , Mathieu Poirier Cc: Zijun Hu , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-hwmon@vger.kernel.org, linux-media@vger.kernel.org, linux-usb@vger.kernel.org, linux-gpio@vger.kernel.org, netdev@vger.kernel.org, linux-pwm@vger.kernel.org, nvdimm@lists.linux.dev, linux1394-devel@lists.sourceforge.net, linux-serial@vger.kernel.org, linux-sound@vger.kernel.org, open-iscsi@googlegroups.com, linux-scsi@vger.kernel.org, linux-cxl@vger.kernel.org, sparclinux@vger.kernel.org, linux-block@vger.kernel.org, arm-scmi@vger.kernel.org, linux-efi@vger.kernel.org, linux-remoteproc@vger.kernel.org, Zijun Hu X-Mailer: b4 0.14.2 X-Proofpoint-GUID: 8jpa5at4bS7zJPC9fx3XsXXE7tIvY-4A X-Proofpoint-ORIG-GUID: 8jpa5at4bS7zJPC9fx3XsXXE7tIvY-4A 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-02_14,2024-12-02_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 bulkscore=0 mlxlogscore=999 mlxscore=0 spamscore=0 suspectscore=0 malwarescore=0 clxscore=1015 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2308100000 definitions=main-2412030002 X-Apple-Remote-Links: v=1;h=KCk=;charset=UTF-8 From: Zijun Hu device_find_child() has been constified to take new match function type: typedef int (*device_match_t)(struct device *dev, const void *data); Make pwm_unexport_match() take a const pointer to adapt for the new type. Signed-off-by: Zijun Hu --- drivers/pwm/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c index 9c733877e98e47ac6548932cb040e91dd1008f81..6edceb89de30af0bde94de59b1c714971dbf9664 100644 --- a/drivers/pwm/core.c +++ b/drivers/pwm/core.c @@ -1276,7 +1276,7 @@ static int pwm_export_child(struct device *pwmchip_dev, struct pwm_device *pwm) return 0; } -static int pwm_unexport_match(struct device *pwm_dev, void *data) +static int pwm_unexport_match(struct device *pwm_dev, const void *data) { return pwm_from_dev(pwm_dev) == data; } From patchwork Tue Dec 3 00:33:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zijun Hu X-Patchwork-Id: 847170 Received: from pv50p00im-zteg10011501.me.com (pv50p00im-zteg10011501.me.com [17.58.6.42]) (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 8E9176F307 for ; Tue, 3 Dec 2024 00:38:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=17.58.6.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733186337; cv=none; b=YIMzqH05uaECZcEwBMbxAS4MZxn/M9ssn3rpk6+/dxrCWW9tBU5WpZrGzknv1vwu5vhTgYrWbFUiyDezveM1eHmAOWSVPJRYcECX0Wh4DBxQKlo81urrZLLLt+TenlauOQUJ4zQ4MGEWLJDQdoCugkWj0ASrce1HNnSl8Gi9GiM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733186337; c=relaxed/simple; bh=bVxN+FZOfleQVmg6RLp1YA7VWhpbCqAopfI4NI1NFnA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dhggOYgc6i1AcT/pcCq7cZnhy1TU3Kcqk2jvSAtpMHTDga6OLYOaUcSK+M6N88pByUcmn4neMI7fxRWGIQ6G8cMScdi7Hp8S2qgWyH8308IK3C8ifDz0d1sBziN5z9/nt+U2BEnGp4UhC76AeeJ2LSYYTK4+sclGTc2SwY/3T6c= 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=cNZheBgV; arc=none smtp.client-ip=17.58.6.42 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="cNZheBgV" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1733186335; bh=DunB/Cza6j0J9yIEJF1/KVIA9ohiToydy/mrGuBe+NA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To: x-icloud-hme; b=cNZheBgVFQmN8bDOAgA1O/6ilvMdUYLWH2rCw2sbVyV42b9UfWahOMUwO6MA2D3wu PS9ynWuFaT87rd3PD4MocTwkv2r4XCW+znolqO/soTSf67giOwZyPuElgZCsDCGjPD tlxClv/tibYTlDeYlsonl81S7tf7SmWu6omQ3zz/xG2MhX/msIxPaL9v0oyTyFR9Fw r7B4k0/vLKdn1SsAxgw6R0/+MQJFM4NioFAG0GKYfjVBsizaRIrVhJ2s4itJxOhsB5 Gigjpj8kjdQqUw86WbyZHXCyybV4R7w7adERzs4Ufil2RPDqc7KxPNEscKwkReaaGX 7Wkla79Wkq4hw== Received: from [192.168.1.26] (pv50p00im-dlb-asmtp-mailmevip.me.com [17.56.9.10]) by pv50p00im-zteg10011501.me.com (Postfix) with ESMTPSA id DD3E54A00A7; Tue, 3 Dec 2024 00:38:34 +0000 (UTC) From: Zijun Hu Date: Tue, 03 Dec 2024 08:33:33 +0800 Subject: [PATCH v2 11/32] libnvdimm: Simplify nd_namespace_store() implementation Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241203-const_dfc_done-v2-11-7436a98c497f@quicinc.com> References: <20241203-const_dfc_done-v2-0-7436a98c497f@quicinc.com> In-Reply-To: <20241203-const_dfc_done-v2-0-7436a98c497f@quicinc.com> To: Greg Kroah-Hartman , "Rafael J. Wysocki" , Chun-Kuang Hu , Philipp Zabel , David Airlie , Simona Vetter , Matthias Brugger , AngeloGioacchino Del Regno , Jean Delvare , Guenter Roeck , Martin Tuma , Mauro Carvalho Chehab , Andreas Noever , Michael Jamet , Mika Westerberg , Yehezkel Bernat , Linus Walleij , Bartosz Golaszewski , Andrew Lunn , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Dan Williams , Vishal Verma , Dave Jiang , Ira Weiny , Takashi Sakamoto , Jiri Slaby , Heikki Krogerus , Srinivas Kandagatla , Lee Duncan , Chris Leech , Mike Christie , "James E.J. Bottomley" , "Martin K. Petersen" , Nilesh Javali , Manish Rangankar , GR-QLogic-Storage-Upstream@marvell.com, Davidlohr Bueso , Jonathan Cameron , Alison Schofield , Andreas Larsson , Stuart Yoder , Laurentiu Tudor , Jens Axboe , Sudeep Holla , Cristian Marussi , Ard Biesheuvel , Bjorn Andersson , Mathieu Poirier Cc: Zijun Hu , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-hwmon@vger.kernel.org, linux-media@vger.kernel.org, linux-usb@vger.kernel.org, linux-gpio@vger.kernel.org, netdev@vger.kernel.org, linux-pwm@vger.kernel.org, nvdimm@lists.linux.dev, linux1394-devel@lists.sourceforge.net, linux-serial@vger.kernel.org, linux-sound@vger.kernel.org, open-iscsi@googlegroups.com, linux-scsi@vger.kernel.org, linux-cxl@vger.kernel.org, sparclinux@vger.kernel.org, linux-block@vger.kernel.org, arm-scmi@vger.kernel.org, linux-efi@vger.kernel.org, linux-remoteproc@vger.kernel.org, Zijun Hu X-Mailer: b4 0.14.2 X-Proofpoint-GUID: Mwb4WO2zvDF-UK70QCmcJRU4qe8f8eTp X-Proofpoint-ORIG-GUID: Mwb4WO2zvDF-UK70QCmcJRU4qe8f8eTp 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-02_14,2024-12-02_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 bulkscore=0 mlxlogscore=999 mlxscore=0 spamscore=0 suspectscore=0 malwarescore=0 clxscore=1015 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2308100000 definitions=main-2412030002 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 --- 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));