Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp1838117imb; Sun, 3 Mar 2019 08:18:09 -0800 (PST) X-Google-Smtp-Source: APXvYqzdlu1TPwpn4LdDyQOy/cYwnovWRonlhinjH0mkqxITN9L9CnR+GXOPD1sE5SHbV0RfzoDN X-Received: by 2002:a17:902:b60c:: with SMTP id b12mr15689497pls.261.1551629889575; Sun, 03 Mar 2019 08:18:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551629889; cv=none; d=google.com; s=arc-20160816; b=elWg/SzuS6jJzI2Q7/wBf2S12jyc4rreNvDRJjfakmdX89q74FeY2NZaOWeVFrf67e dISElwZH8vPgdgroWN5vVNz4hmbf02kYjdzewb6cd3gW9VOSSaab4ScUB69Sk2/M+q1Y afyvJuP/7rrJwR5mkouLxHD2vLbfYOaHyJcIii6BrT1igIwicNjsISbQNb1T2DxmEsbM agz/L+GiQPM0UztFrPMvu05Adltw01JSugYCjLY7aTBC9jCOK3ResED8T+xNIL0joyuU HY0kiFK0JVInHz+ySLOq0Nw0iP+xHAhwkN8FueuFhelH230HQLaPsqKoT6/84npHVhXi HmZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=HOKNxyVmHSCMhMuhx2zEF97FSKkqDqXIFL3R78bp2XU=; b=CvcEbguthp8FClcQ5RnLeVCvOBmNyIOuPiOtx3jKg9/y5sDfXAHXz1xiN6E9dWMf5a yfBIbEzPeXrjVL1BYg3clTdQHRSRakij4CLmqEqtjqqDakf7xfzwjc8D02aiqcwq6cYi n/WaZZX8L2q3WUOM+puuefhhBAtQVXNc5vLGeQ7bPyrzD2IbAFRLl/3lcZwLpXvKY0a8 SaFYtXSi7iwwG5MpCV788qfU6dWQmBbm5LIB5Rai+ktB0knBfVMDXkfrvooZEXCvKnfC UgZ4kIUP5PuNxZAfP9q5iSDKMun0UUdVqvx0AKMb6StS1d+skoikGI5FNYwRg7I+2eSC nZbw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t7si3013177pgp.196.2019.03.03.08.17.54; Sun, 03 Mar 2019 08:18:09 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726436AbfCCQRd (ORCPT + 99 others); Sun, 3 Mar 2019 11:17:33 -0500 Received: from saturn.retrosnub.co.uk ([46.235.226.198]:54980 "EHLO saturn.retrosnub.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726387AbfCCQRd (ORCPT ); Sun, 3 Mar 2019 11:17:33 -0500 Received: from archlinux (cpc91196-cmbg18-2-0-cust659.5-4.cable.virginm.net [81.96.234.148]) by saturn.retrosnub.co.uk (Postfix; Retrosnub mail submission) with ESMTPSA id 8FDE39E77B1; Sun, 3 Mar 2019 16:17:30 +0000 (GMT) Date: Sun, 3 Mar 2019 16:17:28 +0000 From: Jonathan Cameron To: "He, Bo" Cc: "linux-kernel@vger.kernel.org" , "linux-iio@vger.kernel.org" , "ic23@kernel.org" , "knaack.h@gmx.de" , "lars@metafoo.de" , "pmeerw@pmeerw.net" , "Chen, Hu1" Subject: Re: [PATCH] io: accel: kxcjk1013: restore the range after resume. Message-ID: <20190303161728.3571869e@archlinux> In-Reply-To: References: X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 21 Feb 2019 03:13:44 +0000 "He, Bo" wrote: > restore the range register in case kxcjk1013 power is off after suspend > > we see the issue on some laptops, after system suspend and resume, > the CTRL_REG1 register changed from 0xc8 to 0x80, so acceleration range > is changed, the patch is to restore the acceleration range after resume. > > Signed-off-by: he, bo > Signed-off-by: Chen, Hu Please don't do the ret += trick, it obscures the return value which we may want to know if anything goes wrong. Handle each error independently. Thanks, Jonathan > --- > drivers/iio/accel/kxcjk-1013.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c > index 7506bd9..c6bb3be 100644 > --- a/drivers/iio/accel/kxcjk-1013.c > +++ b/drivers/iio/accel/kxcjk-1013.c > @@ -1340,6 +1340,7 @@ static int kxcjk1013_resume(struct device *dev) > > mutex_lock(&data->mutex); > ret = kxcjk1013_set_mode(data, OPERATION); > + ret += kxcjk1013_set_range(data, data->range); > mutex_unlock(&data->mutex); > > return ret;