Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp2406219img; Sun, 24 Mar 2019 07:56:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqw3xBK6ad0L4LJ+ENv2ImN1Yo9TPkEU1QAaOjSrJsAgE4bFICDv6FKDH6ctfIspMdhELR2d X-Received: by 2002:a62:14c3:: with SMTP id 186mr19475375pfu.21.1553439383117; Sun, 24 Mar 2019 07:56:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553439383; cv=none; d=google.com; s=arc-20160816; b=grpvQwN3Qw6Ti/gU1pOkwy3J3gqQSxdCWp5SCkf1bviaIHd7dHp5GQ5VFOAVsk7kLK VBJHrlEGUyPALMn5D8dgMbQ8AmF/IqdeKt8keU/4PYMBVRtwZsxOfhHw0T+ht/JAgKQF A9jUGKf7rUSuSIFIbZG5DTUIalvl86HTkY0muFNIEf+XcdRxRJoS3LzxapwlrGmOjw/j i2APdeAIaAa2H113csFUrRuBxi4cHPYhh8dpCoGeUqE5Z6k6GFEPb6NrlLi9VunLk2mo ERmhAB4cIrM9gNatST1f9lkDpd2hIz0J0hAIoKYwTxJ8Mv+LybAbNapf7RZvjDeyR3rM IyMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=EV0mtIUAZRfpoAAvMR47kvv6+WC7oxtvXJXhTk+1wes=; b=CEXhmYuwf4lx2DJsfN43dIi/2C01cu9H5GnIibU2ahhXnEzYNSu0vvFs66jhDB8KPs m00SBu3SuOgYv/5uXFRVbL/vI9P9bTOLbNPQ6qoFTHfJilYodkz8a0ZF2XjGtc4GdGIB VHhLocong1nCAiwR/AP/JXpGfHrzts1YdRD1IeE8Dklq8OcD+vJ9ESJbkZtG1/CNRYEY Z2K3zTfwcREOFGaiHrDhURnY8mJWyQg1Kf5VmDyVNAtrtxIJYnOLGZo/sjQq1KHo0l81 RjLf8k0pAunuwbvlAM7hb1jZM5Fih+DEnq+rjeZk2HQGauPTvmUC60N3+uz/Oe0v28o3 9Ddw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tGKjTtMc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p2si11328541pfi.103.2019.03.24.07.55.53; Sun, 24 Mar 2019 07:56:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tGKjTtMc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727471AbfCXOyz (ORCPT + 99 others); Sun, 24 Mar 2019 10:54:55 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:37496 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726603AbfCXOyz (ORCPT ); Sun, 24 Mar 2019 10:54:55 -0400 Received: by mail-pf1-f196.google.com with SMTP id 8so4611026pfr.4 for ; Sun, 24 Mar 2019 07:54:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=EV0mtIUAZRfpoAAvMR47kvv6+WC7oxtvXJXhTk+1wes=; b=tGKjTtMcbfkgYDwCTNLSSZE7OFMBUz6tpdMRv2cG090DsYEgqpFLTay56OTEMO4SQU 5l9tccGnugeFZuoUWtpjVmyXt/xnpTn1a79zECaAQ72yOyHswkSxgHUVwDmHMy7u5lBo UiquzoOydvu+MSl0HDsIIVhQttYWBmV+1aNOghhzzhOVkYiw+7Pah917Po1a5SWvdyzH Y1JC8RhzhVUHCD+GgNMm75gWKkRpSQKq2RPiIsNn4zgAWAS73G+3cT7QcHj0tId53gxR hQju77C3Hlx9RDbyO31se3qLSyCsNZjgK1HCnk05MdFIIE2er2nXwr0kisUmrzr7O1Zt MmYw== 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; bh=EV0mtIUAZRfpoAAvMR47kvv6+WC7oxtvXJXhTk+1wes=; b=ezo/ySuyFzkcBvCqEWsjq2i2pnZP5L/z827vA4ibXyo8MzFuII4fWMVDlDahu+BWYz ctrbYPilqAy/RApvqHE5q5HXpkaREhx3voTvEnRMmdlkWlb66Sd7R3ryWCkiZjTft+fi FNV+vR8PSoAyiGXGm6T5rOJiR8vpON/cgI47pDI6Cf/cLjJjg2jMMlsdLklrkMlSUWuu iIxGNFGf2+ZYiRmeU4/ChBkXMc/q0cF9uzJnVh6KQah74Qm96o4HM6AmGbIJCb34V5Kb D+e5/lMSsLh0o/ayVRqeKL0UStAZbCzmxT1gfQkyhJFbvO1DT8SB1X5niM5uCH3CNFdi 1Yiw== X-Gm-Message-State: APjAAAXBq9QKwrgOTuTH5gr5HBKo6QwmvvZuE4sqgk41BdvDAKbT6oxD EW4zzjDbE4px9zX8pSh49ctkbDae X-Received: by 2002:a17:902:e40a:: with SMTP id ci10mr20248567plb.77.1553439294445; Sun, 24 Mar 2019 07:54:54 -0700 (PDT) Received: from localhost.localdomain ([61.83.141.141]) by smtp.gmail.com with ESMTPSA id 10sm20777961pft.83.2019.03.24.07.54.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 24 Mar 2019 07:54:53 -0700 (PDT) From: Sidong Yang To: Greg Kroah-Hartman Cc: Sidong Yang , Michael Straube , Hugo Lefeuvre , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH] staging: pi433: remove unnecessary calling rf69_set_mode() Date: Sun, 24 Mar 2019 14:54:41 +0000 Message-Id: <20190324145441.10013-1-realwakka@gmail.com> X-Mailer: git-send-email 2.11.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Remove unnecessary rf69_set_mode() function call when rx is waiting for a telegram. There is waste to call rf69_set_mode() twice for becoming standby mode. Signed-off-by: Sidong Yang --- drivers/staging/pi433/pi433_if.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c index 53928af696a6..e822f87fc533 100644 --- a/drivers/staging/pi433/pi433_if.c +++ b/drivers/staging/pi433/pi433_if.c @@ -650,21 +650,19 @@ pi433_tx_thread(void *data) disable_irq(device->irq_num[DIO0]); device->tx_active = true; + /* clear fifo, set fifo threshold, set payload length */ + retval = rf69_set_mode(spi, standby); /* this clears the fifo */ + if (retval < 0) + return retval; + if (device->rx_active && !rx_interrupted) { /* * rx is currently waiting for a telegram; * we need to set the radio module to standby */ - retval = rf69_set_mode(device->spi, standby); - if (retval < 0) - return retval; rx_interrupted = true; } - /* clear fifo, set fifo threshold, set payload length */ - retval = rf69_set_mode(spi, standby); /* this clears the fifo */ - if (retval < 0) - return retval; retval = rf69_set_fifo_threshold(spi, FIFO_THRESHOLD); if (retval < 0) return retval; -- 2.11.0