Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5239390img; Wed, 27 Mar 2019 05:00:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqzDxmy0Ga+jqCJs9qZY05ipwoxpu2h97d8FponRNHZPSmT8JuaqQRte8n4jP5cNvMH8vSfM X-Received: by 2002:a63:30c5:: with SMTP id w188mr9959854pgw.76.1553688026186; Wed, 27 Mar 2019 05:00:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553688026; cv=none; d=google.com; s=arc-20160816; b=p09jw1sH4Jyqwf5J2s9AU4whrZxoXgx5Weh5WTjUccNTjG2kgKKyLL0fsXs14llvYL VSimN5uM1RaK4dzMM/1DIeSFyrODaOeBoA3y6wNFdJ+vCNt/IQy5H6XpjcKieSb3jAWr IV3c9Ee34m0O5D/Fo7q9O3nv9wv3uMkYJhKoMI1B3QdGqe///QeEanififpJUGAcVy4W uOQHvFB9UgDQ70XKyWUgnu4NbaL102Hgb7l4WjKAYRwb6qe/A27TRxQ9aefhuQHLyvc1 nqJ/o1/v55gKhaA+IKf0NLSPLEVfvnF3EIlilPQ0W7jB9d13QTZgfmE4jPTsdTBG2TW7 /VmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=VFWKFuSwLV/4A6SoUjdbQFm8al6ndpn+nV25n+zRhkE=; b=R/NN1sRX9cW56BdNBRXhaOP+JKznMyTwxYK7f628PW1COhsUNoakiM1PD2st7hdkGf keJxV6A72pUKIAO2mYRzsysy+bXrgEELxtfIFY7LD2GMuq1ZIupIqLB3I9rElYEaAJnV fWkyxE6a+RADAbQRcJUjE6NIVSvJQg1OO8wwkCZ3rbhkzxvwrv4hVeuUsYVFadd4Ufxn lfwzaXwGyMcu0e7K896KRjWECD+67uPggtD/Zw+qotI3G8mcNovHMBm01UbmFNQquxde 0d2QQDRqevmJAe4qXQhsI5ExNLNsuEzLEY0t7t8JgxPYTNN2gUwRopALsiUTLkvtKsk8 4xCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=NKBokYG3; 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=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b9si12695463pgn.457.2019.03.27.05.00.11; Wed, 27 Mar 2019 05:00:26 -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=@oracle.com header.s=corp-2018-07-02 header.b=NKBokYG3; 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=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728368AbfC0L7f (ORCPT + 99 others); Wed, 27 Mar 2019 07:59:35 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:51868 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726241AbfC0L7f (ORCPT ); Wed, 27 Mar 2019 07:59:35 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x2RBwh0X134577; Wed, 27 Mar 2019 11:59:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2018-07-02; bh=VFWKFuSwLV/4A6SoUjdbQFm8al6ndpn+nV25n+zRhkE=; b=NKBokYG3blLVTERw6vVi8ztQPZXCo/zsJy0KBkR0woPvVAfiB7BiUrY9EQe7n0q94JuA 0zZwaRqqivWvjNJGXA8AqIK7dD/Cha8MGC++le5VPo0fiFw/KpPUddn1xggplSSDxbWd 5iu1iC0gxRQ+hNmszqisgeP1c8O4zB2ku1il8DReVZlWeDFQLMH+C/lgL7UX99TZbIkB IMLImTpF4kEVwER0/2R9WBnatOdNPSaXRtHxFx+Jkzz5/Yi2U60zJOzz21NS2neb5LGh sD1hiYnEpbW2jjuHawUPQX3Zy75xpGvYjrgOEEERG0a46QDJf47zWbZzBE26pyJHMdcW 8w== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2120.oracle.com with ESMTP id 2re6djg33r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2019 11:59:30 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id x2RBxUGO011580 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2019 11:59:30 GMT Received: from abhmp0007.oracle.com (abhmp0007.oracle.com [141.146.116.13]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x2RBxT1s011980; Wed, 27 Mar 2019 11:59:29 GMT Received: from kadam (/197.157.0.42) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 27 Mar 2019 04:59:28 -0700 Date: Wed, 27 Mar 2019 14:59:22 +0300 From: Dan Carpenter To: Sidong Yang Cc: Greg Kroah-Hartman , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] staging: pi433: Fix rf69_set_tx_cfg() logic Message-ID: <20190327115811.GE32590@kadam> References: <20190327081120.11152-1-realwakka@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190327081120.11152-1-realwakka@gmail.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9207 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1903270086 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 27, 2019 at 08:11:20AM +0000, Sidong Yang wrote: > Moved code to configure sync to where check enable_sync option before. > There is no need to check enable_sync twice. Configuring sync should be > executed immediately after enabling sync. > > Signed-off-by: Sidong Yang > --- > drivers/staging/pi433/pi433_if.c | 17 +++++++---------- > 1 file changed, 7 insertions(+), 10 deletions(-) > > diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c > index 53928af696a6..0a48d6cb9547 100644 > --- a/drivers/staging/pi433/pi433_if.c > +++ b/drivers/staging/pi433/pi433_if.c > @@ -318,10 +318,17 @@ rf69_set_tx_cfg(struct pi433_device *dev, struct pi433_tx_cfg *tx_cfg) > return ret; > } > > + /* configure sync, if enabled */ This comment is obvious. Just delete it. > if (tx_cfg->enable_sync == OPTION_ON) { > ret = rf69_enable_sync(dev->spi); > if (ret < 0) > return ret; > + ret = rf69_set_sync_size(dev->spi, tx_cfg->sync_length); > + if (ret < 0) > + return ret; > + ret = rf69_set_sync_values(dev->spi, tx_cfg->sync_pattern); > + if (ret < 0) > + return ret; It's weird that we enable sync before we et the size or sync values... regards, dan carpenter