Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp580480ybl; Wed, 14 Aug 2019 02:44:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqzzgvMtjNE3CNtYN4fJmGJaQtK3tubmjdTPJdPS7IBTJCL+YPhAtUUNs0srGkyeWuT+3yVI X-Received: by 2002:a17:902:4283:: with SMTP id h3mr40439565pld.15.1565775895767; Wed, 14 Aug 2019 02:44:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565775895; cv=none; d=google.com; s=arc-20160816; b=RE7fDh8EEfsHY+JsYIyj56Gwh/HQ+4mtJyHZ0kd//CVO1WvsfXLBQQGaEFrwZhN94Q D4xoMKUEo1epzNKpcJkRV/whotLl9gFKr3NtY2kavcLZ7ywg3smDFgvzrtzlZ/neMA9Q py9P3R3SXpbkEU4COYJZi9yktvnUZQBP/KDFVSmc7xNCTP3ZQDS6iNCJBdUpa66pcg61 kq8WMX/Ufj53l7cqThFN9xpFUPIJT2trgLVQvj+KiAr4/O2+yvDvZRb9BERuGwh7cHlk CFh9c1MxRDlCrY2+0xG5KBh1wa6Aef5aPpIzAWGdm5fiE5LByS5gsVtcmgFhUFE383Ws DTrA== 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; bh=XnhB5vGCG9Iks7s5/H0yC8GlGE2pwCtHtxR3RKRY8Wo=; b=iOM8qf4syRG7+GaYdDxn6tmsEDJwPzmbKCxZLgoIvktF9XOzt7qsNl0NQQATQrlZYK gWy9d9joXaBAGGUo8yuSC3PbaFaYpVUELv6u2bpUnsQKg530ROwXx8mNTh8SoVtqJhQf n28rWThcm+XXL7B7KAMsoeujYbfxRbO7rkqmPQqPA4Ge1hWF7DfU7ienmSS4xKlj7kPA iqrKvdYnWK+WroDiINsYcvAoV1eeMxdqnxk0XE4wd4/yQ8pmqGN+EOsFdnmxPOAbAjUj CmsGBzwZJfSl7dJ1/ThrT2HtFT+oFMYTyIqfzUvGfoeXHRyZdNQZnC1qCChnvtXGCXBq M8bg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f17si3449059plj.17.2019.08.14.02.44.39; Wed, 14 Aug 2019 02:44:55 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726699AbfHNJmo (ORCPT + 99 others); Wed, 14 Aug 2019 05:42:44 -0400 Received: from inva020.nxp.com ([92.121.34.13]:59448 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726047AbfHNJmo (ORCPT ); Wed, 14 Aug 2019 05:42:44 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 7A8AC1A02C2; Wed, 14 Aug 2019 11:42:42 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 6B0CF1A0119; Wed, 14 Aug 2019 11:42:39 +0200 (CEST) Received: from titan.ap.freescale.net (TITAN.ap.freescale.net [10.192.208.233]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 2DF0240293; Wed, 14 Aug 2019 17:42:35 +0800 (SGT) From: Biwen Li To: a.zummo@towertech.it, alexandre.belloni@bootlin.com, leoyang.li@nxp.com Cc: linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org, Biwen Li Subject: rtc: pcf85363/pcf85263: fix error that failed to run hwclock -w Date: Wed, 14 Aug 2019 17:32:49 +0800 Message-Id: <20190814093249.40065-1-biwen.li@nxp.com> X-Mailer: git-send-email 2.9.5 X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Issue: # hwclock -w hwclock: RTC_SET_TIME: Invalid argument The patch fixes error when run command hwclock -w with rtc pcf85363/pcf85263 Signed-off-by: Biwen Li --- drivers/rtc/rtc-pcf85363.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/rtc/rtc-pcf85363.c b/drivers/rtc/rtc-pcf85363.c index a075e77617dc..3450d615974d 100644 --- a/drivers/rtc/rtc-pcf85363.c +++ b/drivers/rtc/rtc-pcf85363.c @@ -166,7 +166,12 @@ static int pcf85363_rtc_set_time(struct device *dev, struct rtc_time *tm) buf[DT_YEARS] = bin2bcd(tm->tm_year % 100); ret = regmap_bulk_write(pcf85363->regmap, CTRL_STOP_EN, - tmp, sizeof(tmp)); + tmp, 2); + if (ret) + return ret; + + ret = regmap_bulk_write(pcf85363->regmap, DT_100THS, + buf, sizeof(tmp) - 2); if (ret) return ret; -- 2.17.1