From patchwork Wed Dec 11 00:08:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zijun Hu X-Patchwork-Id: 13902508 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 74B8AE7717F for ; Wed, 11 Dec 2024 00:09:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=kfiQvzFLBb+n8JVxhhMp55qOpk+Rl6yzjqVikusBzaU=; b=RgQdUdv8njLKS3Br1UuSUe+V7E +NI1eU+O8DcB2geaV9YGYdqcq/lERlV6sxngdPDKAbhPjrX4Zo09UWLmMfs3RjQXjB3RO7se5Um+4 WcCtQLkeKJte8heIw9OMaoyAP0coBlLcIGBUIMA4z66KIg96u/yJU+20bmHTkJ53H7m1okEie4bby kb2p5OBNuivlbQQQUk8YIDLirSUy3LHW0BocRmz9zdI6RMPZ8k4N8lYCbyiZsZj94hmNJCCwv3pTY iuRlx2x1R4mmZpsnsOlkFV4mFnUh/Cyj2ALZA8zXGKZMxe+I/tsxYHX3t+EbjuUiSyxofS/nGhfOE 5dwSJZ0Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tLAIA-0000000DEtm-1ydl; Wed, 11 Dec 2024 00:09:26 +0000 Received: from pv50p00im-ztdg10011901.me.com ([17.58.6.50]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tLAI8-0000000DEsS-0TBL for linux-mediatek@lists.infradead.org; Wed, 11 Dec 2024 00:09:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1733875758; bh=kfiQvzFLBb+n8JVxhhMp55qOpk+Rl6yzjqVikusBzaU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To: x-icloud-hme; b=bfhTJqEx8pZusWEu8CJjZml6F8R1mqSzpkaYdwGP8NdDkUZls3C51mSYNXTWmJYUn 9UvlerdGQyq5BHM5Xn7rOFAvEuznIpbzXK+MZduFJ4bepMwDrW+f4Cpgg4cgulHuNw dRtKSFB2f7GIIFcMsCda/8sadfUpj5+pJZwHlzcEeToV3hAtpYHERC44BDVgPMZGX3 ClLm8zSUIBQIO3qu8HT1az2JKbDpt7S8UXoNF82Cx7g/uwfjx5cFXYJktyUc67dRTH +7bNJYziafpPsja/bqvNL5fKONhqX49oRhfFyp5O/VqC8J0cQMVm9n1J9q4Pd80G1f yVpQq6PzgMDHQ== Received: from [192.168.1.26] (pv50p00im-dlb-asmtp-mailmevip.me.com [17.56.9.10]) by pv50p00im-ztdg10011901.me.com (Postfix) with ESMTPSA id CE7713A0435; Wed, 11 Dec 2024 00:09:07 +0000 (UTC) From: Zijun Hu Date: Wed, 11 Dec 2024 08:08:03 +0800 Subject: [PATCH v4 01/11] libnvdimm: Replace namespace_match() with device_find_child_by_name() MIME-Version: 1.0 Message-Id: <20241211-const_dfc_done-v4-1-583cc60329df@quicinc.com> References: <20241211-const_dfc_done-v4-0-583cc60329df@quicinc.com> In-Reply-To: <20241211-const_dfc_done-v4-0-583cc60329df@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-ORIG-GUID: haxmqpQVRRO6NFqrJNaQ6uDL5F_Xiqoa X-Proofpoint-GUID: haxmqpQVRRO6NFqrJNaQ6uDL5F_Xiqoa 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-10_13,2024-12-10_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 bulkscore=0 phishscore=0 suspectscore=0 mlxscore=0 spamscore=0 mlxlogscore=928 clxscore=1015 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2308100000 definitions=main-2412100174 X-Apple-Remote-Links: v=1;h=KCk=;charset=UTF-8 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241210_160924_155937_79B525C5 X-CRM114-Status: UNSURE ( 7.77 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Zijun Hu Simplify nd_namespace_store() implementation by using device_find_child_by_name(). Reviewed-by: Alison Schofield 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));