Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4345954imm; Wed, 30 May 2018 04:02:51 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLhlEPAD/YbCLGlkpwap3g+/qIPTf3VrJaCnuIULCMcO0d9E9+1/hbpbNeIH6FCYlVNHxZG X-Received: by 2002:a17:902:76c3:: with SMTP id j3-v6mr2328869plt.15.1527678171138; Wed, 30 May 2018 04:02:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527678171; cv=none; d=google.com; s=arc-20160816; b=kD96pP8Z7hWOKyAQsoaQ3TbF3hd22yOyWYM7QnKIqkaU61oKRKs7KnDHfdp4SELgAc jrZ6sSDE9JoRSs//COd3yHZeZeBNxXgcdQIN+yW+kt1DJZVZwzbxcVT63YLVgUdJPOY1 IfmQ1AbNRmfrLTBhVi3AAcmiNxFv5CXMQS1kLbmMv2pqn59syhalO+VKdjXZ5MlK9wfi uJi539vOMPWElEjacfj2Kj0XIC+56VCil40Y3bRflji2wOk64wz+Nik9HL9k7r/wJ9Va AlMA8/J7ySZtNuLUcOX0mwhROVWh0Vf3Ws4wz73RYLiE8eF88m8zCrgJocVMDqUiQ0ns /cSw== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=I9YCsl1NbQx0IWGWUkOeFbeSyMw6EURioQkGh754/5M=; b=PLuWudtEBxriFsYHSl0CysoSHzxQ5l1+psFtfJCe+k988Z1QfUPoNSr8bLd5RoGobW 6ATpsYdSurA02cFfqLpY6+vIgvGDWfo3qg2WurAhb1n+sWELTx+xOPUItMpByUCJWun9 pjwbcKo8dx8TGz15fqpTEbph5Cq8Zpnzvy/qzfCq7a+Lsnjz5hcFORxZjJkNqsfI8MAr hLtVM3uTGA3KF01bgb6szTzmftPDmaJN/EUtmdNHsuN4KnrKBuVTWDQdnAY8g04etGA6 hfawYjKHOhwaxHYtxzBlUVX493e5qTPqa2SsiGGgJDKLRGAaXBaPhUMUCqhsm0u52Grv TZyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=l9ZOqZty; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y90-v6si7845926pfd.47.2018.05.30.04.02.37; Wed, 30 May 2018 04:02:51 -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=@gmail.com header.s=20161025 header.b=l9ZOqZty; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752566AbeE3LBu (ORCPT + 99 others); Wed, 30 May 2018 07:01:50 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:55621 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752485AbeE3LBi (ORCPT ); Wed, 30 May 2018 07:01:38 -0400 Received: by mail-wm0-f66.google.com with SMTP id a8-v6so47018231wmg.5; Wed, 30 May 2018 04:01:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=I9YCsl1NbQx0IWGWUkOeFbeSyMw6EURioQkGh754/5M=; b=l9ZOqZtyBnUrdRQaURY6BW0rCxDyEowXZGINXXER5plnne9Xr+qMehCQDjLOdmv5PF XA2WpRobQFrRW5JYizpyw5+1Ksqnvo2Pl6uS3vAmL9Jp1BafOUsv5VFYJQ/feQZ0oX85 iBI6QAzQUSReWfxUzVtwh8jBsOmPrY6DEohDYp0xZTzOSXd4T6efnryMyQELejgNJHJq aBaWdmtAf0XDezPBUL3JuN4RaNGkWBY8k2ySknTfwRmxsa6AVzxPLzF/ofmy6uRskh4A 8x0VYXIy9hnMnLlC/5xxPzPMXYuPqR/LbXiirhTxyolfRXcLaGTX/sOgfO8hgx6+QqMs ZPGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=I9YCsl1NbQx0IWGWUkOeFbeSyMw6EURioQkGh754/5M=; b=K2DuOnxArhR5X5Tuw6bo38JfGOx9lUsnbY4XlPIWWwL6m9bpQNKZEYn6vu3+VSu8BI v1xCmkHh2HXTX7QbMjG+/4h2LfCoOT8+cPqrOmzwJahjEWO4QmavlLD/oADSnsylm9SH 4k2H1H+8MXuRJpwosnZj540+bFvPpfUwTwaINh1fAWSjBDA4GEfFU8NnJadquUU6HkoA 8rl4utPXTe4SVWC7o11nXF2K8cky5/mKFO28kTElQVOdyj78vbhUFCACOrEMow26/llW 5hDSRSkZF7jdUBHhUNTSBF/LqbHMVZwSAaQ5xueq6uDp5m3wO/I8QtqAC/JMnicpjpbr oCzA== X-Gm-Message-State: ALKqPwcF3zNAdYLKO8ZQLrSOwqQ4wv5gyfyVcUXl0ub3HrydZ5rHt9YL StVeURYl/jBrMvJtH2zJNxJF00+w X-Received: by 2002:a1c:64d7:: with SMTP id y206-v6mr1099808wmb.43.1527678096529; Wed, 30 May 2018 04:01:36 -0700 (PDT) Received: from [192.168.42.64] (cst-prg-9-157.cust.vodafone.cz. [46.135.9.157]) by smtp.gmail.com with ESMTPSA id m134-v6sm21650928wmg.4.2018.05.30.04.01.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 May 2018 04:01:35 -0700 (PDT) Subject: Re: [PATCH 4/6] mfd: da9063: Disallow RTC on DA9063L To: Lee Jones , Steve Twiss Cc: "linux-kernel@vger.kernel.org" , Marek Vasut , Geert Uytterhoeven , Mark Brown , Wolfram Sang , "linux-renesas-soc@vger.kernel.org" References: <20180523114230.10109-1-marek.vasut+renesas@gmail.com> <20180523114230.10109-4-marek.vasut+renesas@gmail.com> <6ED8E3B22081A4459DAC7699F3695FB701941A488A@SW-EX-MBX02.diasemi.com> <20180529075505.GD4790@dell> From: Marek Vasut Message-ID: <2960b4f7-7fb4-48d4-5b2c-5cc1bdc80ef5@gmail.com> Date: Wed, 30 May 2018 12:59:08 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180529075505.GD4790@dell> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/29/2018 09:55 AM, Lee Jones wrote: > On Thu, 24 May 2018, Steve Twiss wrote: > >> Thanks Marek, >> >> On 23 May 2018 12:42 Marek Vasut wrote, >> >>> To: linux-kernel@vger.kernel.org >>> Cc: Marek Vasut ; Geert Uytterhoeven ; Lee Jones ; Mark Brown ; Steve Twiss ; Wolfram Sang ; linux-renesas-soc@vger.kernel.org >>> Subject: [PATCH 4/6] mfd: da9063: Disallow RTC on DA9063L >>> >>> The DA9063L does not contain RTC block, unlike the full DA9063. >>> Do not allow binding RTC driver on this variant of the chip. >>> >>> Signed-off-by: Marek Vasut >>> Cc: Geert Uytterhoeven >>> Cc: Lee Jones >>> Cc: Mark Brown >>> Cc: Steve Twiss >>> Cc: Wolfram Sang >>> Cc: linux-renesas-soc@vger.kernel.org >>> --- >>> drivers/mfd/da9063-core.c | 18 +++++++++++------- >>> 1 file changed, 11 insertions(+), 7 deletions(-) >>> >>> diff --git a/drivers/mfd/da9063-core.c b/drivers/mfd/da9063-core.c index 7360b76b4f72..263c83006413 100644 >>> --- a/drivers/mfd/da9063-core.c >>> +++ b/drivers/mfd/da9063-core.c >>> @@ -101,14 +101,14 @@ static const struct mfd_cell da9063_devs[] = { >>> .of_compatible = "dlg,da9063-onkey", >>> }, >>> { >>> + .name = DA9063_DRVNAME_VIBRATION, >>> + }, >>> + { /* Only present on DA9063 , not on DA9063L */ >>> .name = DA9063_DRVNAME_RTC, >>> .num_resources = ARRAY_SIZE(da9063_rtc_resources), >>> .resources = da9063_rtc_resources, >>> .of_compatible = "dlg,da9063-rtc", >>> }, >>> - { >>> - .name = DA9063_DRVNAME_VIBRATION, >>> - }, >>> }; >>> >>> static int da9063_clear_fault_log(struct da9063 *da9063) @@ -163,7 +163,7 @@ int da9063_device_init(struct da9063 *da9063, unsigned int irq) { >>> struct da9063_pdata *pdata = da9063->dev->platform_data; >>> int model, variant_id, variant_code; >>> - int ret; >>> + int da9063_devs_len, ret; >>> >>> ret = da9063_clear_fault_log(da9063); >>> if (ret < 0) >>> @@ -225,9 +225,13 @@ int da9063_device_init(struct da9063 *da9063, unsigned int irq) >>> >>> da9063->irq_base = regmap_irq_chip_get_base(da9063->regmap_irq); >>> >>> - ret = mfd_add_devices(da9063->dev, -1, da9063_devs, >>> - ARRAY_SIZE(da9063_devs), NULL, da9063->irq_base, >>> - NULL); >>> + da9063_devs_len = ARRAY_SIZE(da9063_devs); >>> + /* RTC, the last device in the list, is only present on DA9063 */ >>> + if (da9063->type == PMIC_TYPE_DA9063L) >>> + da9063_devs_len -= 1; >>> + >>> + ret = mfd_add_devices(da9063->dev, -1, da9063_devs, da9063_devs_len, >>> + NULL, da9063->irq_base, NULL); >>> if (ret) >>> dev_err(da9063->dev, "Cannot add MFD cells\n"); >>> >> >> MFD cells definitely has less impact than regmap_range and regmap_irq. >> I agree, there's no point in having a completely new >> static const struct mfd_cell da9063l_devs[] = { ... } for DA9063L > > This solution is fragile. > > I agree that a new MFD cell is not required in its entirety. It > would however, be better to split out the RTC entry into a new one and > only register it when (da9063->type == PMIC_TYPE_DA9063). This is a > better solution than messing around with passed struct sizes. This indeed is better. btw this da9063_device_init() function is missing a failpath to undo the setup done by da9063_irq_init(), so I'll be sending a patch for that too shortly. -- Best regards, Marek Vasut