Message ID | 20230303170416.1347530-6-eajames@linux.ibm.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp524064wrd; Fri, 3 Mar 2023 09:09:47 -0800 (PST) X-Google-Smtp-Source: AK7set83dZgzeVq5+aVv3pAFR1U8H82Nh/Qpl7XQrpxK+4x+zm3xxIsXGOhrtYjqZMEZNm3TBWtB X-Received: by 2002:aa7:d782:0:b0:4ad:8fc5:3d2a with SMTP id s2-20020aa7d782000000b004ad8fc53d2amr2297425edq.11.1677863387263; Fri, 03 Mar 2023 09:09:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677863387; cv=none; d=google.com; s=arc-20160816; b=eOgcSuZjeEkM6YBPGEz3x4mJnzZeN73aCWBuDJy3hLvA/K4v2N1hmHFBxb3JBB7Mrz 7lBc94mRl7whtL/410yJSNnNVLN9MsNPbsW3nFad4FDOUMx9RJE9V3DZMuMTgb65Nu6L p8ODDsQnCemfg4eXCI+JIRsE1KmZEMfwuT6yGBCrJil9MVYFEZefqlScVS2iTvqi+3Wv A0BsYM04TGCvf6fVyGdTVUif2TYcI7Bkz5XZHG2jnq2wcbJDYuwIyxOvv4Z10YJhlztp DBDfWu1m6VGbtyaW6ZHy5FuwDkbJlpo5ivZc4vfZ9OON+wnT3ghEDuduDZQKt9Ry3cBV 6NBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=tlmEo/kVrmSoI+f5eQKxgmNkhnCo7i/A1GBB4psqyLY=; b=Kkn2kQi6vo8wkIUycWXmtTZ8EU23qxy/Z5uHtDQp9YGysawIKLH/XBuXOVx4WMi7R2 NaMT7xH/c9LkvS2a0H8roElijhxYOihV0t0ocgnUXUhDt6VHgERRcTLTR/amhwlgqJrZ es6q0pThS9AkvqlBO7dzP7U5LPalldgHhsyJ4vNoZD85GWY2kZr3MkJwC4dvvdidRnSI S493T1hNKPJlKXea0cd470DDDbgvf2B2GxTcg71PYjf7mldNS298ALDFAHsygAV6BQwu T2aNZrhlsUcv1afCVjuWnfSc/Ghjw5NWr/BPQwCETUy/x6jbKkCRk/1pE8PU6qFroah+ e6nA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=Vah+gJKk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v26-20020aa7cd5a000000b004acbebc9408si2910337edw.383.2023.03.03.09.09.24; Fri, 03 Mar 2023 09:09:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=Vah+gJKk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231230AbjCCRFB (ORCPT <rfc822;davidbtadokoro@gmail.com> + 99 others); Fri, 3 Mar 2023 12:05:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231540AbjCCREr (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 3 Mar 2023 12:04:47 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 901E622DC5; Fri, 3 Mar 2023 09:04:46 -0800 (PST) Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 323Fqs5a032495; Fri, 3 Mar 2023 17:04:31 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=tlmEo/kVrmSoI+f5eQKxgmNkhnCo7i/A1GBB4psqyLY=; b=Vah+gJKk5k65cADWQUG4eH2IMJBqXq7d7Y+v8zl9+Y7ohdRZP3eLx1SeXWodyBSawlq6 WAhnPHIM4oCL21olAqTcYex4dyOzlTYU9DEuQxOmxYt8tu9BIqC6WwLZpUcOA2TfYezi v8lUxbGAiVWnhpf8mrOWL8TX+l8rGRAZ4xx8sDOYzs3rMgVl2wM7D1ljRhbqPH5GIY+X yiLLnhtxuWYbNAy6s6eiHSdwSKZRu6+v1Eo+i2cJUU8Jj1ENz6udDVk/2QdoC7Koi/L9 oqKRdDnKjjluSXV/3q738s1+qtSJP//V+VqRIZ1qRhvjjFJ+Rqko6aR80iJ9ewjNdRFG lg== Received: from ppma04wdc.us.ibm.com (1a.90.2fa9.ip4.static.sl-reverse.com [169.47.144.26]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3p3kx4a1w2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 03 Mar 2023 17:04:31 +0000 Received: from pps.filterd (ppma04wdc.us.ibm.com [127.0.0.1]) by ppma04wdc.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 323EKZo2019104; Fri, 3 Mar 2023 17:04:30 GMT Received: from smtprelay07.wdc07v.mail.ibm.com ([9.208.129.116]) by ppma04wdc.us.ibm.com (PPS) with ESMTPS id 3nybduuybd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 03 Mar 2023 17:04:30 +0000 Received: from smtpav05.wdc07v.mail.ibm.com (smtpav05.wdc07v.mail.ibm.com [10.39.53.232]) by smtprelay07.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 323H4TNq60817778 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 3 Mar 2023 17:04:29 GMT Received: from smtpav05.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 961FD58043; Fri, 3 Mar 2023 17:04:29 +0000 (GMT) Received: from smtpav05.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B6E1758053; Fri, 3 Mar 2023 17:04:27 +0000 (GMT) Received: from slate16.aus.stglabs.ibm.com (unknown [9.77.137.234]) by smtpav05.wdc07v.mail.ibm.com (Postfix) with ESMTP; Fri, 3 Mar 2023 17:04:27 +0000 (GMT) From: Eddie James <eajames@linux.ibm.com> To: linux-fsi@lists.ozlabs.org Cc: rostedt@goodmis.org, linux-trace-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, mhiramat@kernel.org, alistair@popple.id.au, joel@jms.id.au, jk@ozlabs.org, andrew@aj.id.au, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, eajames@linux.ibm.com Subject: [PATCH v7 5/7] fsi: Add aliased device numbering Date: Fri, 3 Mar 2023 11:04:14 -0600 Message-Id: <20230303170416.1347530-6-eajames@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230303170416.1347530-1-eajames@linux.ibm.com> References: <20230303170416.1347530-1-eajames@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: VYi3n3M2Z1-I9cRhMl_XUR_cxkO7i_-0 X-Proofpoint-ORIG-GUID: VYi3n3M2Z1-I9cRhMl_XUR_cxkO7i_-0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-03_03,2023-03-03_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 spamscore=0 bulkscore=0 phishscore=0 adultscore=0 malwarescore=0 impostorscore=0 suspectscore=0 priorityscore=1501 mlxscore=0 mlxlogscore=999 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303030143 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759367279124607984?= X-GMAIL-MSGID: =?utf-8?q?1759367279124607984?= |
Series |
fsi: Add IBM I2C Responder virtual FSI master
|
|
Commit Message
Eddie James
March 3, 2023, 5:04 p.m. UTC
The I2C and SPI subsystems can use an aliased name to number the device.
Add similar support to the FSI subsystem for any device type.
Signed-off-by: Eddie James <eajames@linux.ibm.com>
---
drivers/fsi/fsi-core.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c index d591e68afd11..b77013b9d8a7 100644 --- a/drivers/fsi/fsi-core.c +++ b/drivers/fsi/fsi-core.c @@ -955,9 +955,34 @@ static int __fsi_get_new_minor(struct fsi_slave *slave, enum fsi_dev_type type, return 0; } +static const char *const fsi_dev_type_names[] = { + "cfam", + "sbefifo", + "scom", + "occ", +}; + int fsi_get_new_minor(struct fsi_device *fdev, enum fsi_dev_type type, dev_t *out_dev, int *out_index) { + if (fdev->dev.of_node) { + int aid = of_alias_get_id(fdev->dev.of_node, fsi_dev_type_names[type]); + + if (aid >= 0) { + int id = (aid << 4) | type; + + id = ida_simple_get(&fsi_minor_ida, id, id + 1, GFP_KERNEL); + if (id >= 0) { + *out_index = aid; + *out_dev = fsi_base_dev + id; + return 0; + } + + if (id != -ENOSPC) + return id; + } + } + return __fsi_get_new_minor(fdev->slave, type, out_dev, out_index); } EXPORT_SYMBOL_GPL(fsi_get_new_minor);