From patchwork Mon May 2 09:02:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hector Martin X-Patchwork-Id: 12834006 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 25809C433EF for ; Mon, 2 May 2022 09:03:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=KhJ/0bV2NdzPmePk0VM+os7WRHSNIX3C/+qadkLQg4c=; b=dEvfUw/H0+jvDD srpz4W3FA7VqKejceYkYhCHPhG5AQQfl/dD56wXColcvbUAex5qucIi/NtfJn5xEZ8stzdZWVFfih dXgeUEyFIHYpgJAGLDbCXYWBe4iEWGnRwtHYMxvn+/a1Q92EfvTAxhtIZEJbIlzZ4sf6gFsT1WpY+ sKQyDCTpC1Oil4hFisHkg61xorAyA+OM+GW2rMO7HKgl31sLDhCChNXkHwv0XvZIxXkOa7ueGvUf0 FCEpQxQfoM5jOyqSqid+E3083tii+7aOIPMCaf6NF1GD8RGDjJH0f67YiOWBdZrdBqMnt8PTY/gs0 zKxIXaEXRmzpMCSMOYBw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nlRxD-000VEH-UN; Mon, 02 May 2022 09:02:52 +0000 Received: from marcansoft.com ([2a01:298:fe:f::2] helo=mail.marcansoft.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nlRx1-000VB0-Vx for linux-arm-kernel@lists.infradead.org; Mon, 02 May 2022 09:02:41 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: hector@marcansoft.com) by mail.marcansoft.com (Postfix) with ESMTPSA id 218CE419C2; Mon, 2 May 2022 09:02:32 +0000 (UTC) From: Hector Martin To: Cc: Hector Martin , Anup Patel , Vinod Koul , Sven Peter , Alyssa Rosenzweig , Mun Yew Tham , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Michal Simek , Arnd Bergmann , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev Subject: [PATCH 1/7] mailbox: zynq: Remove unused zynqmp_ipi_peek_data Date: Mon, 2 May 2022 18:02:19 +0900 Message-Id: <20220502090225.26478-2-marcan@marcan.st> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220502090225.26478-1-marcan@marcan.st> References: <20220502090225.26478-1-marcan@marcan.st> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220502_020240_211798_92377902 X-CRM114-Status: GOOD ( 14.38 ) X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This op was ambiguously specified, and the way it was interpreted for this implementation is not useful. It has no users, so remove it. Signed-off-by: Hector Martin --- drivers/mailbox/zynqmp-ipi-mailbox.c | 41 ---------------------------- 1 file changed, 41 deletions(-) diff --git a/drivers/mailbox/zynqmp-ipi-mailbox.c b/drivers/mailbox/zynqmp-ipi-mailbox.c index 31a0fa914274..7c3ef7c8078e 100644 --- a/drivers/mailbox/zynqmp-ipi-mailbox.c +++ b/drivers/mailbox/zynqmp-ipi-mailbox.c @@ -177,46 +177,6 @@ static irqreturn_t zynqmp_ipi_interrupt(int irq, void *data) return IRQ_NONE; } -/** - * zynqmp_ipi_peek_data - Peek to see if there are any rx messages. - * - * @chan: Channel Pointer - * - * Return: 'true' if there is pending rx data, 'false' if there is none. - */ -static bool zynqmp_ipi_peek_data(struct mbox_chan *chan) -{ - struct device *dev = chan->mbox->dev; - struct zynqmp_ipi_mbox *ipi_mbox = dev_get_drvdata(dev); - struct zynqmp_ipi_mchan *mchan = chan->con_priv; - int ret; - u64 arg0; - struct arm_smccc_res res; - - if (WARN_ON(!ipi_mbox)) { - dev_err(dev, "no platform drv data??\n"); - return false; - } - - arg0 = SMC_IPI_MAILBOX_STATUS_ENQUIRY; - zynqmp_ipi_fw_call(ipi_mbox, arg0, 0, &res); - ret = (int)(res.a0 & 0xFFFFFFFF); - - if (mchan->chan_type == IPI_MB_CHNL_TX) { - /* TX channel, check if the message has been acked - * by the remote, if yes, response is available. - */ - if (ret < 0 || ret & IPI_MB_STATUS_SEND_PENDING) - return false; - else - return true; - } else if (ret > 0 && ret & IPI_MB_STATUS_RECV_PENDING) { - /* RX channel, check if there is message arrived. */ - return true; - } - return false; -} - /** * zynqmp_ipi_last_tx_done - See if the last tx message is sent * @@ -387,7 +347,6 @@ static void zynqmp_ipi_shutdown(struct mbox_chan *chan) static const struct mbox_chan_ops zynqmp_ipi_chan_ops = { .startup = zynqmp_ipi_startup, .shutdown = zynqmp_ipi_shutdown, - .peek_data = zynqmp_ipi_peek_data, .last_tx_done = zynqmp_ipi_last_tx_done, .send_data = zynqmp_ipi_send_data, }; From patchwork Mon May 2 09:02:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hector Martin X-Patchwork-Id: 12834008 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 E9A89C433EF for ; Mon, 2 May 2022 09:04:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=YHXAXfr4z+WjwBT2h2mw1NcaptXq8Pa+aOV5ablzauU=; b=Ln5k0FjRVFLa04 BixH3j4xZBZy0++jhSruA3Yj7sqMklsRwvVuHWzla4wG/UKK4sQy1dvCqrMPFcdlnzH3hgDysxibv dcqrv4vvP87EMp4ocBhh7isb/KVNr2i7cL55chjlPSi+4rAEX4DJ+08QheSFgeSN2MM/3iLDO6Kob OH4Bdwel7e+b3cLUfdDw3ye0+K5DijELJFR+gDx+jeaKoZQF35HdRBvOfrzgM7tp5QzZsDDdic/6H 55XWwSzni7Xaj45xkG4Zytm39ZUUKs8BUgNO7tJORxdD2aP2aOk8rF7o0VRa9oawIBCXkZNMWTLFI g1fmyUqNO/wPgTYwJODQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nlRxP-000VJa-1y; Mon, 02 May 2022 09:03:03 +0000 Received: from marcansoft.com ([2a01:298:fe:f::2] helo=mail.marcansoft.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nlRx6-000VCN-6u for linux-arm-kernel@lists.infradead.org; Mon, 02 May 2022 09:02:45 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: hector@marcansoft.com) by mail.marcansoft.com (Postfix) with ESMTPSA id D41B041E96; Mon, 2 May 2022 09:02:37 +0000 (UTC) From: Hector Martin To: Cc: Hector Martin , Anup Patel , Vinod Koul , Sven Peter , Alyssa Rosenzweig , Mun Yew Tham , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Michal Simek , Arnd Bergmann , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev Subject: [PATCH 2/7] mailbox: sun6i: Unexport unused sun6i_msgbox_peek_data Date: Mon, 2 May 2022 18:02:20 +0900 Message-Id: <20220502090225.26478-3-marcan@marcan.st> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220502090225.26478-1-marcan@marcan.st> References: <20220502090225.26478-1-marcan@marcan.st> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220502_020244_434667_77A34D3A X-CRM114-Status: GOOD ( 11.41 ) X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This op was ambiguously specified, and the way it was interpreted for this implementation is not useful. It has no users, so remove it. The function is used internally by the driver, so just remove it from the ops structure. Signed-off-by: Hector Martin Acked-by: Samuel Holland --- drivers/mailbox/sun6i-msgbox.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/mailbox/sun6i-msgbox.c b/drivers/mailbox/sun6i-msgbox.c index 7f8d931042d3..47aedda80f3f 100644 --- a/drivers/mailbox/sun6i-msgbox.c +++ b/drivers/mailbox/sun6i-msgbox.c @@ -189,7 +189,6 @@ static const struct mbox_chan_ops sun6i_msgbox_chan_ops = { .startup = sun6i_msgbox_startup, .shutdown = sun6i_msgbox_shutdown, .last_tx_done = sun6i_msgbox_last_tx_done, - .peek_data = sun6i_msgbox_peek_data, }; static int sun6i_msgbox_probe(struct platform_device *pdev) From patchwork Mon May 2 09:02:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hector Martin X-Patchwork-Id: 12834010 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 2EE70C433EF for ; Mon, 2 May 2022 09:04:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+mUGtMTpT959lPoO30rZV3ZoKPlxIb9lDrCn4rrytG0=; b=b/Y3u9rSj1T7dj 95h8dSDVHcb5kWeINf7Sy6obolvroWQUtzWUJxnUDD703ggPNm1TNaIAQrGsnEAU0MdqtiMroZ1Eo crtp1FPhYG4/j5J1DJICPx6Za9ban6pubAwFiFEFfM8OGaO0Ts27PFuDVAAr8vVZ7pukDuapgoB7Z NVcga6nAQYRRQCglJnsukaGKgZqYXwC6uuxiIC+ZFE70d46JxItbrmRZf6ALiQfc445xKFFEbmDfM Y9oS2YUWk36jR36MS66HFnp8lTldRC4CS7apqvQ7jPc+rIBPt72mNzZ2ol3RMQen90kUR2JSpk6vj Go4ZwrOE79W/yif3sLRg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nlRxm-000VWH-9h; Mon, 02 May 2022 09:03:26 +0000 Received: from marcansoft.com ([212.63.210.85] helo=mail.marcansoft.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nlRxG-000VDY-76 for linux-arm-kernel@lists.infradead.org; Mon, 02 May 2022 09:02:57 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: hector@marcansoft.com) by mail.marcansoft.com (Postfix) with ESMTPSA id 90BE54206F; Mon, 2 May 2022 09:02:42 +0000 (UTC) From: Hector Martin To: Cc: Hector Martin , Anup Patel , Vinod Koul , Sven Peter , Alyssa Rosenzweig , Mun Yew Tham , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Michal Simek , Arnd Bergmann , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev Subject: [PATCH 3/7] mailbox: ti-msgmgr Remove unused ti_msgmgr_queue_peek_data Date: Mon, 2 May 2022 18:02:21 +0900 Message-Id: <20220502090225.26478-4-marcan@marcan.st> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220502090225.26478-1-marcan@marcan.st> References: <20220502090225.26478-1-marcan@marcan.st> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220502_020254_467219_9D67D384 X-CRM114-Status: GOOD ( 12.30 ) X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This op was ambiguously specified, and the way it was interpreted for this implementation is not useful. It has no users, so remove it. Signed-off-by: Hector Martin --- drivers/mailbox/ti-msgmgr.c | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/drivers/mailbox/ti-msgmgr.c b/drivers/mailbox/ti-msgmgr.c index ddac423ac1a9..10881b812df2 100644 --- a/drivers/mailbox/ti-msgmgr.c +++ b/drivers/mailbox/ti-msgmgr.c @@ -309,33 +309,6 @@ static irqreturn_t ti_msgmgr_queue_rx_interrupt(int irq, void *p) return IRQ_HANDLED; } -/** - * ti_msgmgr_queue_peek_data() - Peek to see if there are any rx messages. - * @chan: Channel Pointer - * - * Return: 'true' if there is pending rx data, 'false' if there is none. - */ -static bool ti_msgmgr_queue_peek_data(struct mbox_chan *chan) -{ - struct ti_queue_inst *qinst = chan->con_priv; - struct device *dev = chan->mbox->dev; - struct ti_msgmgr_inst *inst = dev_get_drvdata(dev); - const struct ti_msgmgr_desc *desc = inst->desc; - int msg_count; - - if (qinst->is_tx) - return false; - - if (ti_msgmgr_queue_is_error(desc, qinst)) { - dev_err(dev, "Error on channel %s\n", qinst->name); - return false; - } - - msg_count = ti_msgmgr_queue_get_num_messages(desc, qinst); - - return msg_count ? true : false; -} - /** * ti_msgmgr_last_tx_done() - See if all the tx messages are sent * @chan: Channel pointer @@ -744,7 +717,6 @@ static DEFINE_SIMPLE_DEV_PM_OPS(ti_msgmgr_pm_ops, ti_msgmgr_suspend, ti_msgmgr_r static const struct mbox_chan_ops ti_msgmgr_chan_ops = { .startup = ti_msgmgr_queue_startup, .shutdown = ti_msgmgr_queue_shutdown, - .peek_data = ti_msgmgr_queue_peek_data, .last_tx_done = ti_msgmgr_last_tx_done, .send_data = ti_msgmgr_send_data, }; From patchwork Mon May 2 09:02:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hector Martin X-Patchwork-Id: 12834009 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 0DEEBC433EF for ; Mon, 2 May 2022 09:04:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=aQkiHOVifsB9cW1hB86HU94CymawJdmQMCWrTMd7Jpo=; b=0YXE8whHwj2Mi2 r1cLTKryPuMhW6XHhBjVtWJcB/AGWWoG4yf+OVlMtMNG2fzfnSIsAadw+9M1xaSBLb9zBQcC3wqA0 idUJ4oMSerP24J3rp4zt6qKv2AcLI7wHTmB9OcUoao8jrR+0fN81ATc4CmRj8Nbz3HAcvNPH6ug1C m4xN/22+0QU0Jlchaj0vanmt790zCWwUxES/tgBZj50rwpkYYEyh6fVB/S9C5zfnMW//W5UxKrXYo jCX2kE6E8qid4pPgbvMs3tUI7niUDINjFWqX+E3VcsAClh9OE1y8mivvCvPDNVp0JmpCxXNW68N9s ammP/2QFhP6n5/pFAEJA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nlRxa-000VPe-VT; Mon, 02 May 2022 09:03:15 +0000 Received: from marcansoft.com ([212.63.210.85] helo=mail.marcansoft.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nlRxG-000VEc-74 for linux-arm-kernel@lists.infradead.org; Mon, 02 May 2022 09:02:56 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: hector@marcansoft.com) by mail.marcansoft.com (Postfix) with ESMTPSA id 4E52742118; Mon, 2 May 2022 09:02:47 +0000 (UTC) From: Hector Martin To: Cc: Hector Martin , Anup Patel , Vinod Koul , Sven Peter , Alyssa Rosenzweig , Mun Yew Tham , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Michal Simek , Arnd Bergmann , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev Subject: [PATCH 4/7] mailbox: altera: Remove unused altera_mbox_peek_data Date: Mon, 2 May 2022 18:02:22 +0900 Message-Id: <20220502090225.26478-5-marcan@marcan.st> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220502090225.26478-1-marcan@marcan.st> References: <20220502090225.26478-1-marcan@marcan.st> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220502_020254_462268_57788E6B X-CRM114-Status: UNSURE ( 9.76 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This op was ambiguously specified, and the way it was interpreted for this implementation is not useful. It has no users, so remove it. Signed-off-by: Hector Martin --- drivers/mailbox/mailbox-altera.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/mailbox/mailbox-altera.c b/drivers/mailbox/mailbox-altera.c index afb320e9d69c..30de424df371 100644 --- a/drivers/mailbox/mailbox-altera.c +++ b/drivers/mailbox/mailbox-altera.c @@ -238,13 +238,6 @@ static bool altera_mbox_last_tx_done(struct mbox_chan *chan) return altera_mbox_full(mbox) ? false : true; } -static bool altera_mbox_peek_data(struct mbox_chan *chan) -{ - struct altera_mbox *mbox = mbox_chan_to_altera_mbox(chan); - - return altera_mbox_pending(mbox) ? true : false; -} - static int altera_mbox_startup(struct mbox_chan *chan) { struct altera_mbox *mbox = mbox_chan_to_altera_mbox(chan); @@ -279,7 +272,6 @@ static const struct mbox_chan_ops altera_mbox_ops = { .startup = altera_mbox_startup, .shutdown = altera_mbox_shutdown, .last_tx_done = altera_mbox_last_tx_done, - .peek_data = altera_mbox_peek_data, }; static int altera_mbox_probe(struct platform_device *pdev) From patchwork Mon May 2 09:02:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hector Martin X-Patchwork-Id: 12834011 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 91298C433EF for ; Mon, 2 May 2022 09:04:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=h4a9zcQHxwANMUQIFKrlBI+uMyJt6Uh6RvNlwdu26og=; b=tcxEfnj5yNi1Gc sXYXC5XdDwOHubaEfcw8e1qosxOOT7YYdXp9KCLi59fM0M6CVHIkl/yXESaqk/cTKz3q2CthBr2QT AFi0umDw2dafRIw8KDACRBhI748V/qrqRhyHi6dIRIq+oLMmGxhDeJ0zz0UHyJUc1lBMZfSwN7RWC 2PW128ZpVx59nwHkKRt52ubx8/xM+WA9Ij/Tc6nioFcM9RtL9wc3QAUNeAOKf6lOEkXcWc1gtWfif EYUB/ty8LxO2jNijJ8LFelL2pA3Gel9sMinaCwGNaX8JUURkC9DTzAq28+YSzuUROEtaHbyJQf1fI 4VqBpZoXPnxLIO+r0/2w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nlRy0-000VhF-SQ; Mon, 02 May 2022 09:03:41 +0000 Received: from marcansoft.com ([212.63.210.85] helo=mail.marcansoft.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nlRxJ-000VGu-Mf for linux-arm-kernel@lists.infradead.org; Mon, 02 May 2022 09:03:00 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: hector@marcansoft.com) by mail.marcansoft.com (Postfix) with ESMTPSA id 1D9A0422CC; Mon, 2 May 2022 09:02:51 +0000 (UTC) From: Hector Martin To: Cc: Hector Martin , Anup Patel , Vinod Koul , Sven Peter , Alyssa Rosenzweig , Mun Yew Tham , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Michal Simek , Arnd Bergmann , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev Subject: [PATCH 5/7] mailbox: Rename peek_data to poll_data and fix documentation Date: Mon, 2 May 2022 18:02:23 +0900 Message-Id: <20220502090225.26478-6-marcan@marcan.st> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220502090225.26478-1-marcan@marcan.st> References: <20220502090225.26478-1-marcan@marcan.st> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220502_020257_983582_E792412F X-CRM114-Status: GOOD ( 27.12 ) X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org peek_data was poorly specified and the documentation implied it should just check for whether there are messages available to be received. The intent is for this function to be usable in atomic context. Just checking for available data is not useful; the subsystem needs to provide some way to poll for (and actually receive) data in atomic context for this to make sense. As one might expect, all existing drivers that implemented the "peek" semantics had zero actual users, since that interpretation of the feature doesn't lend itself to a useful purpose. There is only one driver implementing peek_data as a proper poll: flexrm. That also happens to be the only one with a user. So, rename peek_data to poll_data and fix the documentation to actually describe it properly as a synchronous poll for data. Previous patches already removed the useless implementations, so this only has to fix the bcm driver and client besides the subsystem. Signed-off-by: Hector Martin --- Documentation/driver-api/mailbox.rst | 2 +- drivers/dma/bcm-sba-raid.c | 4 ++-- drivers/mailbox/bcm-flexrm-mailbox.c | 4 ++-- drivers/mailbox/mailbox.c | 25 +++++++++++-------------- include/linux/mailbox_client.h | 2 +- include/linux/mailbox_controller.h | 6 +++--- 6 files changed, 20 insertions(+), 23 deletions(-) diff --git a/Documentation/driver-api/mailbox.rst b/Documentation/driver-api/mailbox.rst index 0ed95009cc30..e4ccafdb1e00 100644 --- a/Documentation/driver-api/mailbox.rst +++ b/Documentation/driver-api/mailbox.rst @@ -27,7 +27,7 @@ Controller Driver (See include/linux/mailbox_controller.h) Allocate mbox_controller and the array of mbox_chan. -Populate mbox_chan_ops, except peek_data() all are mandatory. +Populate mbox_chan_ops, except poll_data() all are mandatory. The controller driver might know a message has been consumed by the remote by getting an IRQ or polling some hardware flag or it can never know (the client knows by way of the protocol). diff --git a/drivers/dma/bcm-sba-raid.c b/drivers/dma/bcm-sba-raid.c index 64239da02e74..841045ecc449 100644 --- a/drivers/dma/bcm-sba-raid.c +++ b/drivers/dma/bcm-sba-raid.c @@ -223,7 +223,7 @@ static struct sba_request *sba_alloc_request(struct sba_device *sba) * would have completed which will create more * room for new requests. */ - mbox_client_peek_data(sba->mchan); + mbox_client_poll_data(sba->mchan); return NULL; } @@ -555,7 +555,7 @@ static enum dma_status sba_tx_status(struct dma_chan *dchan, if (ret == DMA_COMPLETE) return ret; - mbox_client_peek_data(sba->mchan); + mbox_client_poll_data(sba->mchan); return dma_cookie_status(dchan, cookie, txstate); } diff --git a/drivers/mailbox/bcm-flexrm-mailbox.c b/drivers/mailbox/bcm-flexrm-mailbox.c index 22acb51531cb..9decb844eff8 100644 --- a/drivers/mailbox/bcm-flexrm-mailbox.c +++ b/drivers/mailbox/bcm-flexrm-mailbox.c @@ -1223,7 +1223,7 @@ static int flexrm_send_data(struct mbox_chan *chan, void *data) return flexrm_new_request(ring, NULL, data); } -static bool flexrm_peek_data(struct mbox_chan *chan) +static bool flexrm_poll_data(struct mbox_chan *chan) { int cnt = flexrm_process_completions(chan->con_priv); @@ -1449,7 +1449,7 @@ static const struct mbox_chan_ops flexrm_mbox_chan_ops = { .send_data = flexrm_send_data, .startup = flexrm_startup, .shutdown = flexrm_shutdown, - .peek_data = flexrm_peek_data, + .poll_data = flexrm_poll_data, }; static struct mbox_chan *flexrm_mbox_of_xlate(struct mbox_controller *cntlr, diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c index 3e7d4b20ab34..6b13a7047c64 100644 --- a/drivers/mailbox/mailbox.c +++ b/drivers/mailbox/mailbox.c @@ -200,28 +200,25 @@ void mbox_client_txdone(struct mbox_chan *chan, int r) EXPORT_SYMBOL_GPL(mbox_client_txdone); /** - * mbox_client_peek_data - A way for client driver to pull data - * received from remote by the controller. + * mbox_client_poll_data - Poll for pending messages from the remote. * @chan: Mailbox channel assigned to this client. * - * A poke to controller driver for any received data. - * The data is actually passed onto client via the - * mbox_chan_received_data() - * The call can be made from atomic context, so the controller's - * implementation of peek_data() must not sleep. + * Asks the controller driver to poll for any available data from the remote. + * The data will be synchronously delivered via mbox_chan_received_data(). + * This call can be made from atomic context, so the controller's + * implementation of poll_data() must not sleep. * - * Return: True, if controller has, and is going to push after this, - * some data. - * False, if controller doesn't have any data to be read. + * Return: True if the controller received and has processed some data. + * False if controller didn't have any pending data to read. */ -bool mbox_client_peek_data(struct mbox_chan *chan) +bool mbox_client_poll_data(struct mbox_chan *chan) { - if (chan->mbox->ops->peek_data) - return chan->mbox->ops->peek_data(chan); + if (chan->mbox->ops->poll_data) + return chan->mbox->ops->poll_data(chan); return false; } -EXPORT_SYMBOL_GPL(mbox_client_peek_data); +EXPORT_SYMBOL_GPL(mbox_client_poll_data); /** * mbox_send_message - For client to submit a message to be diff --git a/include/linux/mailbox_client.h b/include/linux/mailbox_client.h index 65229a45590f..ccfc81748295 100644 --- a/include/linux/mailbox_client.h +++ b/include/linux/mailbox_client.h @@ -43,7 +43,7 @@ struct mbox_chan *mbox_request_channel(struct mbox_client *cl, int index); int mbox_send_message(struct mbox_chan *chan, void *mssg); int mbox_flush(struct mbox_chan *chan, unsigned long timeout); void mbox_client_txdone(struct mbox_chan *chan, int r); /* atomic */ -bool mbox_client_peek_data(struct mbox_chan *chan); /* atomic */ +bool mbox_client_poll_data(struct mbox_chan *chan); /* atomic */ void mbox_free_channel(struct mbox_chan *chan); /* may sleep */ #endif /* __MAILBOX_CLIENT_H */ diff --git a/include/linux/mailbox_controller.h b/include/linux/mailbox_controller.h index 36d6ce673503..70d766e623ac 100644 --- a/include/linux/mailbox_controller.h +++ b/include/linux/mailbox_controller.h @@ -40,8 +40,8 @@ struct mbox_chan; * mode 'send_data' is expected to return -EBUSY. * The controller may do stuff that need to sleep/block. * Used only if txdone_poll:=true && txdone_irq:=false - * @peek_data: Atomic check for any received data. Return true if controller - * has some data to push to the client. False otherwise. + * @poll_data: Poll atomically for received data. Return true if there + * was data available that has been processed. False otherwise. */ struct mbox_chan_ops { int (*send_data)(struct mbox_chan *chan, void *data); @@ -49,7 +49,7 @@ struct mbox_chan_ops { int (*startup)(struct mbox_chan *chan); void (*shutdown)(struct mbox_chan *chan); bool (*last_tx_done)(struct mbox_chan *chan); - bool (*peek_data)(struct mbox_chan *chan); + bool (*poll_data)(struct mbox_chan *chan); }; /** From patchwork Mon May 2 09:02:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hector Martin X-Patchwork-Id: 12834012 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 676EBC433EF for ; Mon, 2 May 2022 09:04:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=zRCYzJBOCuZLKSPFcGS+XAgQUfAMZDLZizOglQAvKC0=; b=1ZZoqrHjdiz3Yk pWZsrWqlVcnP5cUqbGtbbScPU2S/cMCYm0cerWQBL0kG+HDjpd11Su5p/eFhQaVcx/HPQyGnENAO+ Y/J6Qj41K1JIhlhXdwBXlYdAjqbS9SDIKZC8fYt/QMSE4yoVqY7zZFazRp8DKAJYAOWVnFusY/HRr q+L6kcCAL/eNPHn4pyVjsS9mHJ12RRAiTjyYyhCRTJVlIveu7LQNIu6OnbJqIS3DAGWJWMwFAgW4O dWBaJ79+x+ENoQ1N8fhtxnDePm7A0leNaZOUNjfpN05V4MMqE8JSwtK2G+eeFEGzVAzDmAE4Hocy9 D9rw7zB4BO7t5BF+xd6w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nlRyE-000Vp7-Cn; Mon, 02 May 2022 09:03:54 +0000 Received: from marcansoft.com ([2a01:298:fe:f::2] helo=mail.marcansoft.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nlRxO-000VJJ-EK for linux-arm-kernel@lists.infradead.org; Mon, 02 May 2022 09:03:04 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: hector@marcansoft.com) by mail.marcansoft.com (Postfix) with ESMTPSA id CEA984246A; Mon, 2 May 2022 09:02:56 +0000 (UTC) From: Hector Martin To: Cc: Hector Martin , Anup Patel , Vinod Koul , Sven Peter , Alyssa Rosenzweig , Mun Yew Tham , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Michal Simek , Arnd Bergmann , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev Subject: [PATCH 6/7] mailbox: apple: Implement flush() operation Date: Mon, 2 May 2022 18:02:24 +0900 Message-Id: <20220502090225.26478-7-marcan@marcan.st> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220502090225.26478-1-marcan@marcan.st> References: <20220502090225.26478-1-marcan@marcan.st> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220502_020302_746221_604E7C0B X-CRM114-Status: GOOD ( 12.53 ) X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This allows clients to use the atomic-safe mailbox API style. Signed-off-by: Hector Martin --- drivers/mailbox/apple-mailbox.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/mailbox/apple-mailbox.c b/drivers/mailbox/apple-mailbox.c index 496c4951ccb1..33e7acf71e3e 100644 --- a/drivers/mailbox/apple-mailbox.c +++ b/drivers/mailbox/apple-mailbox.c @@ -17,6 +17,7 @@ */ #include +#include #include #include #include @@ -112,6 +113,14 @@ static bool apple_mbox_hw_can_send(struct apple_mbox *apple_mbox) return !(mbox_ctrl & apple_mbox->hw->control_full); } +static bool apple_mbox_hw_send_empty(struct apple_mbox *apple_mbox) +{ + u32 mbox_ctrl = + readl_relaxed(apple_mbox->regs + apple_mbox->hw->a2i_control); + + return mbox_ctrl & apple_mbox->hw->control_empty; +} + static int apple_mbox_hw_send(struct apple_mbox *apple_mbox, struct apple_mbox_msg *msg) { @@ -219,6 +228,23 @@ static irqreturn_t apple_mbox_recv_irq(int irq, void *data) return IRQ_HANDLED; } +static int apple_mbox_chan_flush(struct mbox_chan *chan, unsigned long timeout) +{ + struct apple_mbox *apple_mbox = chan->con_priv; + unsigned long deadline = jiffies + msecs_to_jiffies(timeout); + + while (time_before(jiffies, deadline)) { + if (apple_mbox_hw_send_empty(apple_mbox)) { + mbox_chan_txdone(&apple_mbox->chan, 0); + return 0; + } + + udelay(1); + } + + return -ETIME; +} + static int apple_mbox_chan_startup(struct mbox_chan *chan) { struct apple_mbox *apple_mbox = chan->con_priv; @@ -250,6 +276,7 @@ static void apple_mbox_chan_shutdown(struct mbox_chan *chan) static const struct mbox_chan_ops apple_mbox_ops = { .send_data = apple_mbox_chan_send_data, + .flush = apple_mbox_chan_flush, .startup = apple_mbox_chan_startup, .shutdown = apple_mbox_chan_shutdown, }; From patchwork Mon May 2 09:02:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hector Martin X-Patchwork-Id: 12834013 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 3B134C433EF for ; Mon, 2 May 2022 09:05:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=nRUMBSpvK00ssEyw6G0/xyaO40/vRazaBmo1QXshHIw=; b=Lbs809tQtksGiS iDS6uKf0pFradvGACg4Isx01ZCaAwG74jJ/2JG4mx+E7RWdQ1OZO3MvV/Kap68qzS5k9+uC9l9p4l Md5Y4JRPorJH8uGiunJPzf2/myC2TEiHbfiPQoIV1vIFHYQgdqMV1GfhP8+yMaDTQhYFK2OtiNbWW g1FKqoWLiP3v+lU/tDVI0KF61Vd2Fhw6/gr5acC2VmksJhEZNu8MS1PzyLKCH/uV2fKAvrnowHJbx zKGWA31V6QI/cTuV99gGBmqPoQIR7Kv/pjfx+sLR0d4I/ldnr/OGNtYYvgV26s0JhQllK+I0Yztsf jJLruO7TtavI6q6LVuaA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nlRyT-000W0A-8w; Mon, 02 May 2022 09:04:09 +0000 Received: from marcansoft.com ([212.63.210.85] helo=mail.marcansoft.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nlRxT-000VLQ-45 for linux-arm-kernel@lists.infradead.org; Mon, 02 May 2022 09:03:08 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: hector@marcansoft.com) by mail.marcansoft.com (Postfix) with ESMTPSA id 8D5DF419B4; Mon, 2 May 2022 09:03:01 +0000 (UTC) From: Hector Martin To: Cc: Hector Martin , Anup Patel , Vinod Koul , Sven Peter , Alyssa Rosenzweig , Mun Yew Tham , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Michal Simek , Arnd Bergmann , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev Subject: [PATCH 7/7] mailbox: apple: Implement poll_data() operation Date: Mon, 2 May 2022 18:02:25 +0900 Message-Id: <20220502090225.26478-8-marcan@marcan.st> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220502090225.26478-1-marcan@marcan.st> References: <20220502090225.26478-1-marcan@marcan.st> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220502_020307_383869_927A3200 X-CRM114-Status: GOOD ( 15.43 ) X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This allows clients running in atomic context to poll for messages to arrive. Signed-off-by: Hector Martin --- drivers/mailbox/apple-mailbox.c | 37 ++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/drivers/mailbox/apple-mailbox.c b/drivers/mailbox/apple-mailbox.c index 33e7acf71e3e..e0c2bf7c6338 100644 --- a/drivers/mailbox/apple-mailbox.c +++ b/drivers/mailbox/apple-mailbox.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #define APPLE_ASC_MBOX_CONTROL_FULL BIT(16) @@ -101,6 +102,7 @@ struct apple_mbox { struct device *dev; struct mbox_controller controller; + spinlock_t rx_lock; }; static const struct of_device_id apple_mbox_of_match[]; @@ -204,13 +206,16 @@ static irqreturn_t apple_mbox_send_empty_irq(int irq, void *data) return IRQ_HANDLED; } -static irqreturn_t apple_mbox_recv_irq(int irq, void *data) +static int apple_mbox_poll_data(struct apple_mbox *apple_mbox) { - struct apple_mbox *apple_mbox = data; + struct apple_mbox_msg msg; + int ret = 0; - while (apple_mbox_hw_recv(apple_mbox, &msg) == 0) + while (apple_mbox_hw_recv(apple_mbox, &msg) == 0) { mbox_chan_received_data(&apple_mbox->chan, (void *)&msg); + ret++; + } /* * The interrupt will keep firing even if there are no more messages @@ -225,9 +230,33 @@ static irqreturn_t apple_mbox_recv_irq(int irq, void *data) apple_mbox->regs + apple_mbox->hw->irq_ack); } + return ret; +} + +static irqreturn_t apple_mbox_recv_irq(int irq, void *data) +{ + struct apple_mbox *apple_mbox = data; + + spin_lock(&apple_mbox->rx_lock); + apple_mbox_poll_data(apple_mbox); + spin_unlock(&apple_mbox->rx_lock); + return IRQ_HANDLED; } +static bool apple_mbox_chan_poll_data(struct mbox_chan *chan) +{ + struct apple_mbox *apple_mbox = chan->con_priv; + unsigned long flags; + int ret; + + spin_lock_irqsave(&apple_mbox->rx_lock, flags); + ret = apple_mbox_poll_data(apple_mbox); + spin_unlock_irqrestore(&apple_mbox->rx_lock, flags); + + return ret > 0; +} + static int apple_mbox_chan_flush(struct mbox_chan *chan, unsigned long timeout) { struct apple_mbox *apple_mbox = chan->con_priv; @@ -276,6 +305,7 @@ static void apple_mbox_chan_shutdown(struct mbox_chan *chan) static const struct mbox_chan_ops apple_mbox_ops = { .send_data = apple_mbox_chan_send_data, + .poll_data = apple_mbox_chan_poll_data, .flush = apple_mbox_chan_flush, .startup = apple_mbox_chan_startup, .shutdown = apple_mbox_chan_shutdown, @@ -331,6 +361,7 @@ static int apple_mbox_probe(struct platform_device *pdev) mbox->controller.txdone_irq = true; mbox->controller.of_xlate = apple_mbox_of_xlate; mbox->chan.con_priv = mbox; + spin_lock_init(&mbox->rx_lock); irqname = devm_kasprintf(dev, GFP_KERNEL, "%s-recv", dev_name(dev)); if (!irqname)