Received: by 10.223.185.116 with SMTP id b49csp305510wrg; Fri, 2 Mar 2018 19:50:45 -0800 (PST) X-Google-Smtp-Source: AG47ELt64P2afGtZx8PktbDQ9Vb4NZ9+DvDmHVcLFIAFskx25tUSY5jPBLWT68tzkA9ZgRmVpzmj X-Received: by 10.99.119.203 with SMTP id s194mr1793402pgc.26.1520049045592; Fri, 02 Mar 2018 19:50:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520049045; cv=none; d=google.com; s=arc-20160816; b=HbzOeRsEj6yumySgYA8x1yTedvgo1GSr9LEAPZUx3/2NUeGvBKcuyOsj3j88jcQtsv m/2Kqq1hvsYRKsn/PRh/Pr6hFJAmLgE9+U1dyCBwj7oJpU26Gm8sMhM3/YUa/j5eGVxO Cj64dTs48Yz57+7DF4GKueqbXVP/zXr6FCDKYKj2LUxjrWBVNhlbD2qRz3RZxwE9tJXz p30qYfZMFozeAxQFywEJ0paSeNqppbrpmNAxmAwZdEuEND98jQqEDWmS2oFvjfvH0/nQ V17xXaARrpr2aag3drXM/jhm5UCD8LT42D5NEtlXoTsSykEQjYBVPJlCs2hvHHZsezgA 7KXw== 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:arc-authentication-results; bh=KRSitRYt4EMtw78FDZhBuXkyDTRFZVrI8Bm+qcxESS4=; b=BvQKjD2Ipp+rYwWfp1n3Ud+GWkvcFUgyTbCdT0zpRnwKHNPfKIY039+TwCpm9J49l5 nC0hm5ukCjfmd6ShpZupJVhuNWgZoOrnpGQ99lT2DN/crDVqzeA0UGvXYHq+o5VOb7eG ZejM27MlSMOz4MvXutjEfxzWFz5i110/z3noSO4AqbMG2niSdMoxWQNfjClI42gmgFGd FvZts4OCXtIXY4MRAiM3ctFt2gMAosQp84vnvZ/PLurxjS6v6Xp0iy47p4DTHrhYTs3N m7XfjwN52LYGjldQ2LGYHMqZhrXQFxfAoJKhSvn7IMOEPeZi3WysDumzEol8bSZ11zIr RxIQ== 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 h185si1866753pfe.168.2018.03.02.19.50.31; Fri, 02 Mar 2018 19:50:45 -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 S934898AbeCBXni (ORCPT + 99 others); Fri, 2 Mar 2018 18:43:38 -0500 Received: from mail.bootlin.com ([62.4.15.54]:52974 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934783AbeCBXnh (ORCPT ); Fri, 2 Mar 2018 18:43:37 -0500 Received: by mail.bootlin.com (Postfix, from userid 110) id 42BBF2092C; Sat, 3 Mar 2018 00:43:34 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost (unknown [88.191.26.124]) by mail.bootlin.com (Postfix) with ESMTPSA id D75F020986; Sat, 3 Mar 2018 00:43:09 +0100 (CET) Date: Sat, 3 Mar 2018 00:43:11 +0100 From: Alexandre Belloni To: David Daney Cc: David Daney , Alessandro Zummo , Rob Herring , Mark Rutland , linux-rtc@vger.kernel.org, devicetree@vger.kernel.org, Linux Kernel Mailing List , Andy Shevchenko Subject: Re: [PATCH v6] rtc: isl12026: Add driver. Message-ID: <20180302234311.GE1479@piout.net> References: <20180222200432.22003-1-david.daney@cavium.com> <20180228151701.GM1479@piout.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.3 (2018-01-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/03/2018 at 08:22:22 -0800, David Daney wrote: > I am no longer able to test this patch as I lost access to the hardware. > Ah, too bad. I will take your patch as-is and then add a small patch to fixup the nvmem registration. > If someone else wants to take charge of the patch, that would be great. > > Sorry I couldn't drive this to completion, > David Daney > > On Wed, Feb 28, 2018 at 7:17 AM, Alexandre Belloni < > alexandre.belloni@free-electrons.com> wrote: > > > Hi, > > > > That's mostly good > > > > On 22/02/2018 at 12:04:32 -0800, David Daney wrote: > > > + priv->rtc->ops = &isl12026_rtc_ops; > > > + priv->rtc->nvram_old_abi = false; > > > > This allocation is not necessary and I would refer not having t so when > > the ABI goes away, it is not necessary to change this driver. > > > > > + ret = rtc_register_device(priv->rtc); > > > + if (ret) > > > + return ret; > > > + > > > + memset(&nvm_cfg, 0, sizeof(nvm_cfg)); > > > + nvm_cfg.name = "eeprom"; > > > > You probably need something more descriptive, usually the rtc model name > > else, it is difficult (but not impossible) to find where this nvmem is > > actually located when using /sys/bus/nvmem/devices > > isl12026- would be a good choice. > > > > > + nvm_cfg.read_only = false; > > > + nvm_cfg.root_only = true; > > > > any reason to have it root only? > > > > > + nvm_cfg.base_dev = &client->dev; > > > + nvm_cfg.priv = priv; > > > + nvm_cfg.stride = 1; > > > + nvm_cfg.word_size = 1; > > > + nvm_cfg.size = 512; > > > + nvm_cfg.reg_read = isl12026_nvm_read; > > > + nvm_cfg.reg_write = isl12026_nvm_write; > > > + > > > + return rtc_nvmem_register(priv->rtc, &nvm_cfg); > > > > The probe function must not fail after rtc_register_device has been > > called so you must return 0 here. > > > > It is not currently possible to call rtc_nvmem_register before > > rtc_register_device unless we move the nvmem to the parent device: > > > > diff --git a/drivers/rtc/nvmem.c b/drivers/rtc/nvmem.c > > index 3a02357eb783..17ec4c8d0fad 100644 > > --- a/drivers/rtc/nvmem.c > > +++ b/drivers/rtc/nvmem.c > > @@ -91,7 +91,7 @@ int rtc_nvmem_register(struct rtc_device *rtc, > > if (!nvmem_config) > > return -ENODEV; > > > > - nvmem_config->dev = &rtc->dev; > > + nvmem_config->dev = rtc->dev.parent; > > nvmem_config->owner = rtc->owner; > > rtc->nvmem = nvmem_register(nvmem_config); > > if (IS_ERR_OR_NULL(rtc->nvmem)) > > > > I'll submit this patch for this cycle before there are many users of the > > interface (converted drivers are still exposing the old ABI). > > > > If you prefer, you can depend on it. > > > > -- > > Alexandre Belloni, Bootlin (formerly Free Electrons) > > Embedded Linux and Kernel engineering > > https://bootlin.com > > -- > > To unsubscribe from this list: send the line "unsubscribe devicetree" in > > the body of a message to majordomo@vger.kernel.org > > More majordomo info at http://vger.kernel.org/majordomo-info.html > > -- Alexandre Belloni, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com