From patchwork Fri May 10 22:34:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 10939657 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2658892A for ; Fri, 10 May 2019 22:35:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 135121FF29 for ; Fri, 10 May 2019 22:35:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0786F1FF60; Fri, 10 May 2019 22:35:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 85DC31FE84 for ; Fri, 10 May 2019 22:35:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=lF7sAiKR5apaO5h3YkNdns0brkABV8ANljJ7vf/Qoic=; b=dbsLbBlhlS0Ve0 mMeu3qwtdr7Y3+xEy9oBNJlSFej0ShO2ETqO3nggUvgru08XWpuKYQwjhj1oXKX6IymmIsxjsua+n AIXFXCYG+vmuy0w0VjPl/KuXYonDYUWZLfH1LLJyxtumauhs1YpEPK19TjwTlf7WA3htOrC7A6duD 4Y/tpryVBe81Mr/q/hgamIGJTHiN7012gG4WRll3XcjHpMVNKuX4OR7tAlBvAqvZ193QzVpUzbGVs AQLPzV7qhVCUwKQHewY+oswgiJ01k6t3lQWc8nuIDZu1iwWp5lvYk780VDS7KcKi9pNTMTDJrv/vt AviO9CecWLyTEROmm3CQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hPE6q-0005LR-Gz; Fri, 10 May 2019 22:35:20 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hPE6m-0005GT-2F for linux-rockchip@lists.infradead.org; Fri, 10 May 2019 22:35:17 +0000 Received: by mail-pg1-x543.google.com with SMTP id 145so3649388pgg.9 for ; Fri, 10 May 2019 15:35:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QaD6p9yeCboFRN1O4f3agFfdrFqU2J5sjBMDQWDo2g0=; b=oPak1zDG4jOI/uCaxLX8GHqaGMSoiTU8gNv/Dn7HQtIJUcJqpsrpss2JiplUy66611 ublJS8OvyIhozjVuBWqpFT1OKbcYlS1+capXhghyJ5pjoxiKxdTRkFC+9mJIuVevuS+d Gp9v4NqLOyhGTqEqJgHr3umOhrqhTmwnwf91w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QaD6p9yeCboFRN1O4f3agFfdrFqU2J5sjBMDQWDo2g0=; b=B98do9/bJVGyE7v5AnJCcwCmSExEzc3pSBu2OsMgumUb8zuiawKRuhDTl6ssumW87R Fo7sys+nUkkbGD2Rl8hhRWGEYDAeFO6TXaw/ogl9H80j5zqnqhHuiVSBmPiYK3xF2Pfk YtIAhg4eBZJTuLfu8K++dBzoL/g/+wQQgzXEvwYOSmn3st8P/Gu882BlrjRC4UElgMIO WUUox9az3UTWzjzvXP2/dItL7//EAj2GJEAdAx7DINZ3O40OqzEZfyn48tqBXHUFa4y6 DTiHEcpgSjWTRck+KwN/FeJL5tDmC4Fb5zrPkjxW/ZPe9++KFdoYW9aeDgrTzOVyyPgo zyLg== X-Gm-Message-State: APjAAAUiH++o8OPTruldOXcdVf71ipvJwULLvOnaYQRgyfX+DZ7r6ijO Igamx7ZhsjathGAyfd4ighU+YrhJWVk= X-Google-Smtp-Source: APXvYqzfM5/LmGIWWgBYDTcbycKUOiDEKbIXg5w7z1nWzDfcvuqgnSrkZZgBnWXxW3V3WNmk2pnBdg== X-Received: by 2002:aa7:8b8b:: with SMTP id r11mr17507706pfd.130.1557527715309; Fri, 10 May 2019 15:35:15 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:1:24fa:e766:52c9:e3b2]) by smtp.gmail.com with ESMTPSA id j6sm7689393pfe.107.2019.05.10.15.35.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 May 2019 15:35:14 -0700 (PDT) From: Douglas Anderson To: Mark Brown , Benson Leung , Enric Balletbo i Serra Subject: [PATCH 4/4] Revert "platform/chrome: cros_ec_spi: Transfer messages at high priority" Date: Fri, 10 May 2019 15:34:37 -0700 Message-Id: <20190510223437.84368-5-dianders@chromium.org> X-Mailer: git-send-email 2.21.0.1020.gf2820cf01a-goog In-Reply-To: <20190510223437.84368-1-dianders@chromium.org> References: <20190510223437.84368-1-dianders@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190510_153516_106095_B97A316E X-CRM114-Status: GOOD ( 13.76 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: drinkcat@chromium.org, briannorris@chromium.org, Douglas Anderson , linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, mka@chromium.org, Guenter Roeck Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This reverts commit 37a186225a0c020516bafad2727fdcdfc039a1e4. We have a better solution in the patch ("platform/chrome: cros_ec_spi: Set ourselves as timing sensitive"). Let's revert the uglier and less reliable solution. Signed-off-by: Douglas Anderson Reviewed-by: Guenter Roeck --- drivers/platform/chrome/cros_ec_spi.c | 80 ++------------------------- 1 file changed, 6 insertions(+), 74 deletions(-) diff --git a/drivers/platform/chrome/cros_ec_spi.c b/drivers/platform/chrome/cros_ec_spi.c index 757a115502ec..70ff1ad09012 100644 --- a/drivers/platform/chrome/cros_ec_spi.c +++ b/drivers/platform/chrome/cros_ec_spi.c @@ -75,27 +75,6 @@ struct cros_ec_spi { unsigned int end_of_msg_delay; }; -typedef int (*cros_ec_xfer_fn_t) (struct cros_ec_device *ec_dev, - struct cros_ec_command *ec_msg); - -/** - * struct cros_ec_xfer_work_params - params for our high priority workers - * - * @work: The work_struct needed to queue work - * @fn: The function to use to transfer - * @ec_dev: ChromeOS EC device - * @ec_msg: Message to transfer - * @ret: The return value of the function - */ - -struct cros_ec_xfer_work_params { - struct work_struct work; - cros_ec_xfer_fn_t fn; - struct cros_ec_device *ec_dev; - struct cros_ec_command *ec_msg; - int ret; -}; - static void debug_packet(struct device *dev, const char *name, u8 *ptr, int len) { @@ -371,13 +350,13 @@ static int cros_ec_spi_receive_response(struct cros_ec_device *ec_dev, } /** - * do_cros_ec_pkt_xfer_spi - Transfer a packet over SPI and receive the reply + * cros_ec_pkt_xfer_spi - Transfer a packet over SPI and receive the reply * * @ec_dev: ChromeOS EC device * @ec_msg: Message to transfer */ -static int do_cros_ec_pkt_xfer_spi(struct cros_ec_device *ec_dev, - struct cros_ec_command *ec_msg) +static int cros_ec_pkt_xfer_spi(struct cros_ec_device *ec_dev, + struct cros_ec_command *ec_msg) { struct ec_host_response *response; struct cros_ec_spi *ec_spi = ec_dev->priv; @@ -514,13 +493,13 @@ static int do_cros_ec_pkt_xfer_spi(struct cros_ec_device *ec_dev, } /** - * do_cros_ec_cmd_xfer_spi - Transfer a message over SPI and receive the reply + * cros_ec_cmd_xfer_spi - Transfer a message over SPI and receive the reply * * @ec_dev: ChromeOS EC device * @ec_msg: Message to transfer */ -static int do_cros_ec_cmd_xfer_spi(struct cros_ec_device *ec_dev, - struct cros_ec_command *ec_msg) +static int cros_ec_cmd_xfer_spi(struct cros_ec_device *ec_dev, + struct cros_ec_command *ec_msg) { struct cros_ec_spi *ec_spi = ec_dev->priv; struct spi_transfer trans; @@ -632,53 +611,6 @@ static int do_cros_ec_cmd_xfer_spi(struct cros_ec_device *ec_dev, return ret; } -static void cros_ec_xfer_high_pri_work(struct work_struct *work) -{ - struct cros_ec_xfer_work_params *params; - - params = container_of(work, struct cros_ec_xfer_work_params, work); - params->ret = params->fn(params->ec_dev, params->ec_msg); -} - -static int cros_ec_xfer_high_pri(struct cros_ec_device *ec_dev, - struct cros_ec_command *ec_msg, - cros_ec_xfer_fn_t fn) -{ - struct cros_ec_xfer_work_params params; - - INIT_WORK_ONSTACK(¶ms.work, cros_ec_xfer_high_pri_work); - params.ec_dev = ec_dev; - params.ec_msg = ec_msg; - params.fn = fn; - - /* - * This looks a bit ridiculous. Why do the work on a - * different thread if we're just going to block waiting for - * the thread to finish? The key here is that the thread is - * running at high priority but the calling context might not - * be. We need to be at high priority to avoid getting - * context switched out for too long and the EC giving up on - * the transfer. - */ - queue_work(system_highpri_wq, ¶ms.work); - flush_work(¶ms.work); - destroy_work_on_stack(¶ms.work); - - return params.ret; -} - -static int cros_ec_pkt_xfer_spi(struct cros_ec_device *ec_dev, - struct cros_ec_command *ec_msg) -{ - return cros_ec_xfer_high_pri(ec_dev, ec_msg, do_cros_ec_pkt_xfer_spi); -} - -static int cros_ec_cmd_xfer_spi(struct cros_ec_device *ec_dev, - struct cros_ec_command *ec_msg) -{ - return cros_ec_xfer_high_pri(ec_dev, ec_msg, do_cros_ec_cmd_xfer_spi); -} - static void cros_ec_spi_dt_probe(struct cros_ec_spi *ec_spi, struct device *dev) { struct device_node *np = dev->of_node;