From patchwork Thu Feb 15 22:07:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 201778 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp151277dyb; Thu, 15 Feb 2024 14:10:30 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUo5bSZ53FGjdoBkjHCbi5X9Hy6VBmmipC3hh3VpyMqWHUVWOOLvozCQoh/HQ8tKfA6HpLPfz0B3bGbOifwI5rZ6KLkbA== X-Google-Smtp-Source: AGHT+IFhBaSj3niSLY1G0NVtRIYNClECUE2eT46N3j8CGp5Mw/enmtF+lwZYLlKTh6eOdam7lxv1 X-Received: by 2002:a05:6358:840a:b0:179:24b4:41ff with SMTP id b10-20020a056358840a00b0017924b441ffmr3387545rwk.1.1708035030219; Thu, 15 Feb 2024 14:10:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708035030; cv=pass; d=google.com; s=arc-20160816; b=oYh6rh0G5ZyKHGrlMr6KkFP+STdt1iq0TQZAcE+41IJO0EcVzaV4oz0pCvDSQpOCjK mgiFy7zMV11cEHvShlhc/h4NpR+p3+IBX51jlPdWQZrAY2hxg7DvEbhrqGCKAd9MgeuK llgjhbUcU4HKkz9g8pxMgBpU6/o9xsrkdxqwQlmTpq7Al8kPtx7xp2wtngnHZUCsjSEI +vLO0pk/jRfu9YgU4u7m7epMY9M/nKXBXbvGnCrOAuCydJ0kYT5lPcoWbbSXryWXdIe1 gi93loT+L6xTboPNti4niLslAEm0e4DwdTdHFEfUp2iU/vMpMJATcL5DdxBuPb+pAmLz Yo8Q== 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=Usz7XAB1EI7Q/DdLEXd449E1MLGpSzqdCCNe5XKh9R0=; b=mnsbdjaZDMElIZP3n5qjDra7VstfrGL6w8rchrm3am52s7vy6T+Dh1903yXa2qJb6f dz3rhyIlmJAs11TyWP8zd7l0/K10iZxG7Qa9CuUjSCnSwj1OTkFOR81sUfDxM4cAKtog PUsdZJMA7JUUwRfO4Itrkq1NU4+g0JDah620Oy0UThgO5KCe/4ZEY6PS0nPh4I5gy5mV 5GJvgHg1ghjRxONLNlfJ8FAkx5lq6TVa69uv05GswE9Ic+vUWhA/9tbCGNQX+S7hjWy3 RnZkU6ihDaJXdh5ltRWLo3EAYOHBgIKhqI2NXxAp1pyO8TMhIkGOAkWMtxsRUkb3L1JV ADFA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="oO/hgcS1"; 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-67734-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67734-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id e9-20020a631e09000000b005cd6507bb84si1460338pge.183.2024.02.15.14.10.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 14:10:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67734-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="oO/hgcS1"; 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-67734-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67734-ouuuleilei=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 6F7F428276D for ; Thu, 15 Feb 2024 22:09:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9A3661468EB; Thu, 15 Feb 2024 22:08:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="oO/hgcS1" Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 AE24D1419B5; Thu, 15 Feb 2024 22:08:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034903; cv=none; b=rmvO6xsO0SvAPWVS6sj9dUDacEioE9+VpSXnvc1mWTJpoLdlO4rLbsxx9UErHMFpq0Af3dBsvOdJE+2JEblHCYidNrech6mGnbhwAA1Eco541+NfPDRGq6m6HLlPWUIMb7ZOerKahRmr7doZevAu7zqfVR1f4cpPjWMjX0OrUQQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708034903; c=relaxed/simple; bh=t+fL4dbYLUcdsIq4ZMykfifG2UxgfeRtAt3E1EOP/A8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=QrSkSIfrduQLmKjiretHIOtL2P+UYcxkHCtLqGSp8dWvPPJDARelq7Xo3kJXYmUeBDeOj+GjFCzxE1Z5zLhfbNb5d2tF3InH+ehptj3B3JDQOFrtHAgylJ1d7In/ttUKyUA2yBfxSl4dLBj2VAv6hjYUeBCcxyu4ghibHiohfs4= 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=oO/hgcS1; arc=none smtp.client-ip=148.163.158.5 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 (m0353722.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41FM6OdU026556; Thu, 15 Feb 2024 22:08:07 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=oO/hgcS1eeYjUHFgTk9WVp2tStqGPRi4XIqneHPUwzqTvfxHHR2Zk4Th99GKmzJy9Wbm 6CVmfe7dATE65y3YFc/P+6szw2KFNnt5wcRicDj8OdGVQ0oXdL8yxG5YReImWNS1VurC DjmPggmChW6N2IPPMY96CKuoXKNN2B2suTTA9/VfC2cZj1FlOaXrlsCFjx3ehE4GtbAh tkg/fxnGn0c8SrkuxXU7eBi1bXO/wnx6+tzkfaHkfK45Neb+3kPZTUq/ssOsrBVF0U8u 1aV2hSZEhq05rlj75po+Fv2vpNrpoIo7RnoHqSp/Ceb+W6LKcPyzzW89L2zxI+UrVIgX dg== 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 3w9u46r133-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:06 +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 41FJHAZ4024888; Thu, 15 Feb 2024 22:08:06 GMT Received: from smtprelay06.wdc07v.mail.ibm.com ([172.16.1.73]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3w6mfpqkfs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Feb 2024 22:08:06 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay06.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41FM83MJ27656862 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 Feb 2024 22:08:05 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6833B58056; Thu, 15 Feb 2024 22:08:03 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1EC8558061; Thu, 15 Feb 2024 22:08:03 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.61.14.18]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 15 Feb 2024 22:08:03 +0000 (GMT) From: Eddie James To: linux-fsi@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-clk@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, sboyd@kernel.org, mturquette@baylibre.com, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Subject: [PATCH 04/33] fsi: Improve master indexing Date: Thu, 15 Feb 2024 16:07:30 -0600 Message-Id: <20240215220759.976998-5-eajames@linux.ibm.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240215220759.976998-1-eajames@linux.ibm.com> References: <20240215220759.976998-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 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: yacOQgyGxb1ACjOHEFL6Lk0Fd8klTmzp X-Proofpoint-GUID: yacOQgyGxb1ACjOHEFL6Lk0Fd8klTmzp 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-15_20,2024-02-14_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 priorityscore=1501 clxscore=1015 lowpriorityscore=0 mlxlogscore=999 bulkscore=0 malwarescore=0 adultscore=0 phishscore=0 suspectscore=0 impostorscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402150171 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791004539804324988 X-GMAIL-MSGID: 1791004539804324988 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;