Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp620401ybl; Fri, 16 Aug 2019 01:05:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqx/2q6PJmskmii3SLblqYHD83B4Pb5hm6Skc3aiWYKtXldmU1k+++ERr53W1U/dJ6GY2ave X-Received: by 2002:aa7:8602:: with SMTP id p2mr9501448pfn.138.1565942730606; Fri, 16 Aug 2019 01:05:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565942730; cv=none; d=google.com; s=arc-20160816; b=Y57c6KzoPMyyCbRJyYwYzcYRXVsvQHTThwHaUv6pXg14cK/T2GAnxs2UNCD/iIWffB 7egUAnQtgfo0tnXehO+UYyXJqtqEi03cKxPK0n+VV/buP5gk0RrU+iuvDSM85zHi5PRq zxbkSCeEtn9IlfaVRtdKMnRPMpzqbCFMNf7vEOOUgqm4CUQq33Jp3YM+NJsEAJPPDd7I iTTCN3ggweVNCxmBZaRJQ8FkFNeNlxXHLy6Z1Vl/8g/9zWMnY4NljyO7rJM++Dv6kqOJ MruHJGlxUGTCa/Nsb+nty2dN2PB/PXF9ypKm2AMfNt4kSbvVn4fVjEnIrH9nEfmXokm7 J0Ng== 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; bh=HWfxcbELH/8E3KGO+52jnjD2oav4+B+XAXJSTk22M3A=; b=Af+1l6KIArIZl2U4xQsPlCiM3A3jfNBuarl46lz96xFUM+nx0mgoBEIyEyR6UAGoK2 6fkEMcWJS5pT06j60UQnLU1OIatwwYoQr/OG/X0BNcEV6AVae+6uz1Gf1iEo4duK+edo r2GTefxqKZuZ9UwGBchewFX9upnj5a7MGgEEpkH9zn0b5CZIw9I2hdeAWdPGQIrYF+3o +2C/MvJUvjDRa0yYxlAaWJxVrHsTg5GD4gTrntFydhA9gerypAupyDktrBU/2H/UMsC9 uTcpPfvxHBjy1/QxzivC5VNCYcQT/TM8gEDGYvkyVOxlAzWRYkD/tZ8Rtabtnvbg3zLP Slqw== 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 k22si3760525pfi.289.2019.08.16.01.05.12; Fri, 16 Aug 2019 01:05:30 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726759AbfHPIEW (ORCPT + 99 others); Fri, 16 Aug 2019 04:04:22 -0400 Received: from relay7-d.mail.gandi.net ([217.70.183.200]:43725 "EHLO relay7-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726596AbfHPIEV (ORCPT ); Fri, 16 Aug 2019 04:04:21 -0400 X-Originating-IP: 176.184.102.226 Received: from localhost (crj95-h02-176-184-102-226.dsl.sta.abo.bbox.fr [176.184.102.226]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 4494E20013; Fri, 16 Aug 2019 08:04:19 +0000 (UTC) Date: Fri, 16 Aug 2019 10:04:17 +0200 From: Alexandre Belloni To: Biwen Li Cc: a.zummo@towertech.it, leoyang.li@nxp.com, linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [v2] rtc: pcf85363/pcf85263: fix error that failed to run hwclock -w Message-ID: <20190816080417.GB3545@piout.net> References: <20190816024636.34738-1-biwen.li@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190816024636.34738-1-biwen.li@nxp.com> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 16/08/2019 10:46:36+0800, Biwen Li wrote: > Issue: > - # hwclock -w > hwclock: RTC_SET_TIME: Invalid argument > > Why: > - Relative patch: https://lkml.org/lkml/2019/4/3/55 , this patch > will always check for unwritable registers, it will compare reg > with max_register in regmap_writeable. > > - In drivers/rtc/rtc-pcf85363.c, CTRL_STOP_EN is 0x2e, but DT_100THS > is 0, max_regiter is 0x2f, then reg will be equal to 0x30, > '0x30 < 0x2f' is false,so regmap_writeable will return false. > > - Root cause: the buf[] was written to a wrong place in the file > drivers/rtc/rtc-pcf85363.c > This is not true, the RTC wraps the register accesses properly and this is probably something that should be handled by regmap_writable. -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com