From patchwork Mon Apr 10 16:16:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elliot Berman X-Patchwork-Id: 81561 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2008081vqo; Mon, 10 Apr 2023 09:28:42 -0700 (PDT) X-Google-Smtp-Source: AKy350YKdMIDXjTpLpRe9YpVlejln1nwZHM+Jlx/qq+Z9tPxxTR5yy1aosfDn259igq4iPeOlmEW X-Received: by 2002:aa7:d8da:0:b0:4fa:7679:d44c with SMTP id k26-20020aa7d8da000000b004fa7679d44cmr10664551eds.11.1681144122491; Mon, 10 Apr 2023 09:28:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681144122; cv=none; d=google.com; s=arc-20160816; b=0SxPwlgURybkWIgWK6QfM/jUSdWRHLRBDOgxuQUgG9UJNePZONyNuhGfjaQNuCYwex 29LAUGPzA0eM28pWF7nSGLJhNjHwEs6jZuTxXiwH/ZJU37IJWSCzapqPOCMeF9CH5njo tkVVrndDgbuS86E5OLpttIZPDHQMsYsudapVOTKU1jvR256F3s7pvn1qSm1QTls9X5w4 p/EgpnCA6ztz8BeHTCAHEZc3DfQSim07sCdJ++AqzdyUTF7491tTHfLgQoD4rwkfd6fd 32jb/MNwl6b0wTcV31mkP48FhzpzsHO2VXQUVeJcpZBlRUvkl0TDC7D+THKpHjNTWZuz KJxA== 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=8YqbOZ+zPszKRteZJwJzU3+KjVpZYfDq8pQt6ZMxOqQ=; b=zQPMM2QbgX/jcJ2qatJQfwoCfHgf7n20o/LBB1WOfS0kr7k50DeSxvChwxAnI7lXXc DvHphjTd9bVXf5XKO3xDtZ7FB+2RMFmLcZaBoTePK079qbuqojmSXpkH/irwBp9NlUta +5Qn6uHIefRjAqChF1aziIzy1xC/+TdVN48KLU4+AJa2CM/BuR/R7NhXnuPMCOkGx4ZW zE/yaQ9OeSRvlPA4Lp97DQ59pZNWBfX3SEWM6VdP0T1hv0rc0O6407RGk4MBcsoAGTKo bmhVURrQ47CkrqU2NH2fUxHYFApu7UkA9E562ANM2rmRD04ck3JRz4gNW9vy6nmZ+aXx RyoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=BOmuYtll; 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=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ux4-20020a170907cf8400b0094a8a702461si2364088ejc.364.2023.04.10.09.28.18; Mon, 10 Apr 2023 09:28:42 -0700 (PDT) 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=@quicinc.com header.s=qcppdkim1 header.b=BOmuYtll; 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=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230253AbjDJQRd (ORCPT + 99 others); Mon, 10 Apr 2023 12:17:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230236AbjDJQR2 (ORCPT ); Mon, 10 Apr 2023 12:17:28 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A1CC1FDD; Mon, 10 Apr 2023 09:17:27 -0700 (PDT) Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33ADeHnE018567; Mon, 10 Apr 2023 16:17:19 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=8YqbOZ+zPszKRteZJwJzU3+KjVpZYfDq8pQt6ZMxOqQ=; b=BOmuYtllF991FlQIpBkLAvmyBldp1GR/mGOI0DKyf5qtL/uSwdgh9PMBULQ8hstQbx0G 6QvZ6IJQsI4/+7EQGAL6hxAExSmKwaRd0svbdV1BCUQugGJ1ZpFsuwPW6KN+8AdnHcW/ ly7L6eC/l0IuYyZ8Aen7XOoLm9qxWIpI65ec93iyBvnwgGyIEPwSbGVBuMMXXzSQG3Kj G5O3F07PWNl9IsDxatYVZqMiM2KsYr45Ie0tVjHrmHQsGwwIDk5JTMmGX3gBPxTQZq1f 59DHTT0T5vZPp73Bdy6dU+9X1bttntmp1hhZWUaZcm5LwBp4JFhyHx/jLeMazIfD/jVD lA== Received: from nasanppmta01.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3pu0c33cr1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 10 Apr 2023 16:17:18 +0000 Received: from nasanex01b.na.qualcomm.com (nasanex01b.na.qualcomm.com [10.46.141.250]) by NASANPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 33AGHHMM029807 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 10 Apr 2023 16:17:17 GMT Received: from hu-eberman-lv.qualcomm.com (10.49.16.6) by nasanex01b.na.qualcomm.com (10.46.141.250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Mon, 10 Apr 2023 09:17:17 -0700 From: Elliot Berman To: Jassi Brar CC: Elliot Berman , Sudeep Holla , , , Subject: [PATCH v3 2/3] mailbox: omap: Use mbox_bind_client Date: Mon, 10 Apr 2023 09:16:53 -0700 Message-ID: <20230410161654.1660757-3-quic_eberman@quicinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230410161654.1660757-1-quic_eberman@quicinc.com> References: <20230410161654.1660757-1-quic_eberman@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01b.na.qualcomm.com (10.47.209.197) To nasanex01b.na.qualcomm.com (10.46.141.250) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: NdR-6xRiWn2A2b_QdDq5ctTeofEn8jtc X-Proofpoint-ORIG-GUID: NdR-6xRiWn2A2b_QdDq5ctTeofEn8jtc X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-10_12,2023-04-06_03,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 priorityscore=1501 bulkscore=0 lowpriorityscore=0 phishscore=0 mlxscore=0 suspectscore=0 clxscore=1015 spamscore=0 malwarescore=0 adultscore=0 mlxlogscore=673 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304100139 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762807379431871109?= X-GMAIL-MSGID: =?utf-8?q?1762807379431871109?= Use generic mbox_bind_client() to bind omap mailbox channel to a client. mbox_bind_client is identical to the replaced lines, except that it: - Does the operation under con_mutex which prevents possible races in removal path - Sets TXDONE_BY_ACK if omap uses TXDONE_BY_POLL. omap uses TXDONE_BY_IRQ, so this check is not applicable. - Calls chan->mbox->ops->startup, if available. omap doesn't have, so this is not applicable. Signed-off-by: Elliot Berman --- drivers/mailbox/omap-mailbox.c | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/drivers/mailbox/omap-mailbox.c b/drivers/mailbox/omap-mailbox.c index 098c82d87137..dfe82a5ff403 100644 --- a/drivers/mailbox/omap-mailbox.c +++ b/drivers/mailbox/omap-mailbox.c @@ -417,8 +417,6 @@ struct mbox_chan *omap_mbox_request_channel(struct mbox_client *cl, struct device *dev = cl->dev; struct omap_mbox *mbox = NULL; struct omap_mbox_device *mdev; - struct mbox_chan *chan; - unsigned long flags; int ret; if (!dev) @@ -441,23 +439,11 @@ struct mbox_chan *omap_mbox_request_channel(struct mbox_client *cl, if (!mbox || !mbox->chan) return ERR_PTR(-ENOENT); - chan = mbox->chan; - spin_lock_irqsave(&chan->lock, flags); - chan->msg_free = 0; - chan->msg_count = 0; - chan->active_req = NULL; - chan->cl = cl; - init_completion(&chan->tx_complete); - spin_unlock_irqrestore(&chan->lock, flags); - - ret = chan->mbox->ops->startup(chan); - if (ret) { - pr_err("Unable to startup the chan (%d)\n", ret); - mbox_free_channel(chan); - chan = ERR_PTR(ret); - } + ret = mbox_bind_client(mbox->chan, cl); + if (ret) + return ERR_PTR(ret); - return chan; + return mbox->chan; } EXPORT_SYMBOL(omap_mbox_request_channel);