Received: by 2002:ab2:644:0:b0:1ec:cbc4:63fb with SMTP id 4csp1144131lqn; Mon, 26 Feb 2024 08:54:26 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUE9m5VAmib9bl3Ls+S/UaWWv/M+JqgjJNVyT/4rbczNpimpbRD7gcXuI911Yh/a5Gok0jqf+bfFqjntP4t/I3nOTEMBbBIsGbWN/26pg== X-Google-Smtp-Source: AGHT+IEhLAWsswyI7spmJzLwXmw67eWXnXCdanb+rRxpHyB8/VN/9ZVsbKiWweOTettJWE99Oabn X-Received: by 2002:aa7:c657:0:b0:565:9b18:8af5 with SMTP id z23-20020aa7c657000000b005659b188af5mr5001382edr.39.1708966466619; Mon, 26 Feb 2024 08:54:26 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708966466; cv=pass; d=google.com; s=arc-20160816; b=k0v1+HNGv3Vdydp/cWDTEMyhNhbbMFJ3PXdNO/MP7cGiuIPS2/WEVtRBRCb0Tx9240 RlAe8Y/3CvQ8ZtyaVvi0qbyJGgDU3/WLjxrfMdLNhHcoA6T4hJxPw03K6/0RPA1SMG3t 2de5eDDqZ3H4Pr14yfBRUoRT4cEas70SEss0d9u/U9nANf91lD/7M6zEMHmNs4xIEoRx 3NoZSzWJkbi1U6odJ6M2s+OaY/Jt2AgdYlx5Y+otXlyVfHkKKkTSfb5//N99/yy3TzKW tddocXafCnUAIhEU2qb7bi1a6by1btUvBaUFzz0pzz11G3+2ouGsGhc1VTi2TxN0lKNK vaDw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=42KZToJ6L2oi/2I8rKEPazeyIcIc7KzaadnBTEbvxS8=; fh=hD87NRI2uXFKH7lntJG4G4naYHSrGp3lxTKSbIyEdj8=; b=Y0hY5TmLsgTecVrJ6pOiU/ZA918gOz++UXjlZCD8AY8AbUJ/8HEEMs25vNklKw8eLa od4T+4A3z8QMEkokqFGRBz64K5+RIId+pj0sl10oxwk307w846PyaH/lU3eC3LzdyXiP wRRnF1t57zD1ZjCtUkMiSSqpHa5/VfjNlbJG9vvMNmVw29l7pG/9fLM4A9u3GJlBCUgM klZ/YwLjS8wOot3w3zrENcv7KWMTAIhrvc6WF/os24ZBPl7UDVQYq6GrfQu6pE3zIgNt BRfjUEVtMCU/l+OvpfBk7ahft77ToT/znEqrOatlDmQWhFBdyFWXrz1Cb4bxbLmA2H/2 LlqA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=KLFbl+wT; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-81950-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81950-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id bm27-20020a0564020b1b00b00565fffb0d7asi785663edb.137.2024.02.26.08.54.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 08:54:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-81950-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=KLFbl+wT; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-81950-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81950-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 392FC1F26374 for ; Mon, 26 Feb 2024 16:54:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 466D112EBEB; Mon, 26 Feb 2024 16:53:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="KLFbl+wT" Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (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 C9BD412D75F; Mon, 26 Feb 2024 16:53:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708966423; cv=none; b=hg3syNll5pS3zWyNtRJ0mzlDYZs+IyvsxlqX6OTuW1/XLNlYI3Q/1hVbA5gWbWuxzrzzka+gpcWph6qQd7piFCykFNoB4WTb0T7oBZlXkVRXzZUia7Sj0ync2ArjYQRszl2d2eKmwy4HItWcgR2ZR6h0niegZoyXJnTru1+FJds= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708966423; c=relaxed/simple; bh=t+fL4dbYLUcdsIq4ZMykfifG2UxgfeRtAt3E1EOP/A8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=pGhpLx+yazkfPKcuKXP8UkZ8pqoOCP3evi55aLJyNW6MKdHWUnL7zDWWjHqNb1VN1x3mXkRg5yMnR+8P7aph/xyJlKyaw+RkpJmiozo5A+ZTyMFOIopYGLY+H1me5aGbpk5CE7Kwe498id7IxCb++2OJElt1ymY6hHrtagmFMfs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=KLFbl+wT; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Received: from pps.filterd (m0353728.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41QG5i6L026188; Mon, 26 Feb 2024 16:53:29 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=42KZToJ6L2oi/2I8rKEPazeyIcIc7KzaadnBTEbvxS8=; b=KLFbl+wTK54ENAwFCeRwOQ1RxZTLuq8qXWweplyRNmCEjoqfL8bn7Dh9QxgCqibz53aj f12/wpxdzEgh04OkHnSH/SRtu0ZCso5r+gehN4g24MwqV4a0UP+glA13ojRSoysaYc/B ZfVIwYNj63tpZyPUKAtwkl0qBU8xjyZox5p5gkRp/16B31VTPHKNPJBB9hoP12OM85o4 LELQ7onVfceggxrA/hub/UGLv+Ip7DMKrSjcPnJ1lELyRkf30+rl78RSNyzvPLXsKEaa 6+44vbmh+5NbK8vwNWAQbhqwyfLQIOPb6aq8t9X9S1gYD/f5ba4kVu/lTTTzEhzlIjEd 5w== Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3wgvsq33cc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 26 Feb 2024 16:53:28 +0000 Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41QGmIR9021306; Mon, 26 Feb 2024 16:53:27 GMT Received: from smtprelay04.dal12v.mail.ibm.com ([172.16.1.6]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3wfusntedb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 26 Feb 2024 16:53:27 +0000 Received: from smtpav05.wdc07v.mail.ibm.com (smtpav05.wdc07v.mail.ibm.com [10.39.53.232]) by smtprelay04.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41QGrOxG66650558 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 26 Feb 2024 16:53:26 GMT Received: from smtpav05.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 519AE58063; Mon, 26 Feb 2024 16:53:24 +0000 (GMT) Received: from smtpav05.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9762858043; Mon, 26 Feb 2024 16:53:23 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.57.130]) by smtpav05.wdc07v.mail.ibm.com (Postfix) with ESMTP; Mon, 26 Feb 2024 16:53:23 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, andi.shyti@kernel.org, eajames@linux.ibm.com, alistair@popple.id.au, joel@jms.id.au, jk@ozlabs.org, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, lakshmiy@us.ibmcom Subject: [PATCH v2 02/31] fsi: Improve master indexing Date: Mon, 26 Feb 2024 10:52:52 -0600 Message-Id: <20240226165321.91976-3-eajames@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240226165321.91976-1-eajames@linux.ibm.com> References: <20240226165321.91976-1-eajames@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: xLt1lVa1QntYMwhEZnW-sGBbMaMkQ8Dc X-Proofpoint-ORIG-GUID: xLt1lVa1QntYMwhEZnW-sGBbMaMkQ8Dc X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-26_11,2024-02-26_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 suspectscore=0 priorityscore=1501 phishscore=0 adultscore=0 lowpriorityscore=0 spamscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 clxscore=1015 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402260128 Master indexing is problematic if a hub is rescanned while the root master is being rescanned. Move the IDA free below the device unregistration, lock the scan mutex in the probe function, and request a specific idx in the hub driver. Signed-off-by: Eddie James --- drivers/fsi/fsi-core.c | 12 +++++------- drivers/fsi/fsi-master-hub.c | 2 ++ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c index 7bf0c96fc017..1c687eb021a0 100644 --- a/drivers/fsi/fsi-core.c +++ b/drivers/fsi/fsi-core.c @@ -1271,7 +1271,6 @@ static struct class fsi_master_class = { int fsi_master_register(struct fsi_master *master) { int rc; - struct device_node *np; mutex_init(&master->scan_lock); @@ -1295,14 +1294,13 @@ int fsi_master_register(struct fsi_master *master) rc = device_register(&master->dev); if (rc) { ida_free(&master_ida, master->idx); - goto out; - } + } else { + struct device_node *np = dev_of_node(&master->dev); - np = dev_of_node(&master->dev); - if (!of_property_read_bool(np, "no-scan-on-init")) { - fsi_master_scan(master); + if (!of_property_read_bool(np, "no-scan-on-init")) + fsi_master_scan(master); } -out: + mutex_unlock(&master->scan_lock); return rc; } diff --git a/drivers/fsi/fsi-master-hub.c b/drivers/fsi/fsi-master-hub.c index 6d8b6e8854e5..36da643b3201 100644 --- a/drivers/fsi/fsi-master-hub.c +++ b/drivers/fsi/fsi-master-hub.c @@ -12,6 +12,7 @@ #include #include "fsi-master.h" +#include "fsi-slave.h" #define FSI_ENGID_HUB_MASTER 0x1c @@ -229,6 +230,7 @@ static int hub_master_probe(struct device *dev) hub->master.dev.release = hub_master_release; hub->master.dev.of_node = of_node_get(dev_of_node(dev)); + hub->master.idx = fsi_dev->slave->link + 1; hub->master.n_links = links; hub->master.read = hub_master_read; hub->master.write = hub_master_write; -- 2.39.3