Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp698035imm; Tue, 5 Jun 2018 03:01:28 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJmrl8Hv9Pv4VMwjvgmSNCXpqN/NAbtnSPxpsx7nIdAAeekFTD9FTA54KemgYikYZxYWNFG X-Received: by 2002:a17:902:7603:: with SMTP id k3-v6mr22327608pll.371.1528192888900; Tue, 05 Jun 2018 03:01:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528192888; cv=none; d=google.com; s=arc-20160816; b=eFkPGmRIH6bw7LLuekQKtWiWM98iSCI4vMl+zEi1oRI8vVcsMRAkIpvRVuY83NF1XK PCP4k5DT6vzrrHGQqcXtepv6edMl94/Oq8XhTxIO279a+H/q7/75Z+HKJyAJWqsWYash 1Y2KVE6XaEcNCfVIYrsvRvrKbYoc5LV64fs8ojPxjSr5fAF1t1QEuFqGnAvD+Hf2fJPx XJ7KBkw1h8U5z6xQpmqu6TjhkRlrVY5N3UToSzvir75EFhu6QkTWWVuuid7RTeEt2XNQ +Aak8JQfMlC/Gh4Blf2gzs6hYmMmnTpATPczO2PKsD92eJkcsek8SHp324N5qFkY6YOy wMtg== 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=NdGCJ2ekcjvMI0YDWFvZNxDCyaseArj7BfrJN3jmpGA=; b=phSVkKNiOhTU9bBFySYrX/U25L/Sw01D+IO2puhMQJNBQBa06HaVAxEtnduDf3Orgo 8ZQjn+GT+DPX5zVrqaSj1eROgPo1Hqpc2QwVNvuTtMMZTTlLjgWHgbayfQ7FkC5vhAdG i+c3iOy3EtSDY7VSRd+GeAbRkFKFOc72eMyXltWyjMnXyuT9rfT5Iqa3kvJZnxYYuIiR Sc656l2ukUAeG0irN8dFZfFFZDOwhywjva5VpQb5xy/HEWSi5jp7lo4cPn/5boeYx2Me SHIPddfbuqd3mckK8LhU+baS0r3c/ai3+bJNhfDtCZaRZtLSV7h9k3ahH6HS2o/z1lxB Ot4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=inQiAVeK; 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 w23-v6si5072596pfj.144.2018.06.05.03.01.14; Tue, 05 Jun 2018 03:01:28 -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=inQiAVeK; 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 S1751805AbeFEKAp (ORCPT + 99 others); Tue, 5 Jun 2018 06:00:45 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:33861 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751498AbeFEKAm (ORCPT ); Tue, 5 Jun 2018 06:00:42 -0400 Received: by mail-wr0-f195.google.com with SMTP id a12-v6so1734524wro.1; Tue, 05 Jun 2018 03:00:41 -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=NdGCJ2ekcjvMI0YDWFvZNxDCyaseArj7BfrJN3jmpGA=; b=inQiAVeKG8CTQV2ZWQJHnx+MTK7TMs+rLh8rHCTdMueCcfXEUY1kD9OR8cUVslpcKZ ktlWpY6TIXWZlMgaZ0rvoH0DkE27ckU1fhjZJ3IrQzLvfbw+pHHAoRpQP2aiIsGwMTqT mrmIWIDoLdZan/9IvfZcb4wCaQp4ZY/+vxOKanwD9p7anwy2z+yTxojI9BhvqvJVjfLb /NWjF0n8woYFTF12J7PQKTEfjIq3he+anxaDbsi1C1VQEsnhZliGoLrHfUKAXqC3Kasa WC+nepFtrcg3zNX/J9UmHGCn2YjMTSABGNEUd9Rd4pMgs+QesWj5dh/KesvoG3KFA+kg +hnA== 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=NdGCJ2ekcjvMI0YDWFvZNxDCyaseArj7BfrJN3jmpGA=; b=JT60AEzd6EVqOQfWl3uGpA58HQsP+bzvFNfKkiARCaO9xWfEjJjAfCpCXPE0Cba6dV 7xI3pZBxNd+X2TR0YEocV4ImRMBdrcyoBZ/hy/Ia66Qd8INnee9xL/3FwxVxuJUWsCAQ y1r3FRfA3rG3JBTbkQAYIhZZeBcw/6Nq0xrI+We8gG7RFIMGTLlBqqjK19aDBE8kpkVC n6/9zhCQ/lO9tx5mRvNKnO1iXEOL96DSYYkPA5BDdtQ09o8n2bniPluHqjq4V5t7KfEy 52TmziXWc0WJvIg8/8UgpOxVXRHmABNiARCf0SP7Ul9NxUdgJFC+BusWRX4SwI0Ip1vo EnNA== X-Gm-Message-State: APt69E2dUpJDWbEkzn1mLZZN8xssCW8P/iitPiLZsH57bnatL1mgu+7B TrYmjLcZDnowHl6wA0oATDUVpl8x X-Received: by 2002:adf:858f:: with SMTP id 15-v6mr10038557wrt.31.1528192840870; Tue, 05 Jun 2018 03:00:40 -0700 (PDT) Received: from [192.168.1.4] (ip-86-49-107-50.net.upcbroadband.cz. [86.49.107.50]) by smtp.gmail.com with ESMTPSA id c53-v6sm51318794wrg.12.2018.06.05.03.00.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Jun 2018 03:00:40 -0700 (PDT) Subject: Re: [PATCH v3 08/10] mfd: da9063: Register RTC only on DA9063L To: Lee Jones Cc: linux-kernel@vger.kernel.org, Marek Vasut , Geert Uytterhoeven , Mark Brown , Steve Twiss , Wolfram Sang , linux-renesas-soc@vger.kernel.org References: <20180602101155.26375-1-marek.vasut+renesas@gmail.com> <20180602101155.26375-8-marek.vasut+renesas@gmail.com> <20180605075321.GM21163@dell> From: Marek Vasut Message-ID: Date: Tue, 5 Jun 2018 11:29:50 +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: <20180605075321.GM21163@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 06/05/2018 09:53 AM, Lee Jones wrote: > On Sat, 02 Jun 2018, Marek Vasut wrote: > >> The DA9063L does not contain RTC block, unlike the full DA9063. >> Split the RTC block into separate mfd cell and register it only >> on DA9063. >> >> 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 >> --- >> V2: No change >> V3: Rework of mfd: da9063: Disallow RTC on DA9063L >> --- >> drivers/mfd/da9063-core.c | 30 +++++++++++++++++++++++------- >> 1 file changed, 23 insertions(+), 7 deletions(-) >> >> diff --git a/drivers/mfd/da9063-core.c b/drivers/mfd/da9063-core.c >> index eebca3442cf3..b05910c797af 100644 >> --- a/drivers/mfd/da9063-core.c >> +++ b/drivers/mfd/da9063-core.c >> @@ -76,7 +76,7 @@ static struct resource da9063_hwmon_resources[] = { >> }; >> >> >> -static const struct mfd_cell da9063_devs[] = { >> +static const struct mfd_cell da9063_common_devs[] = { >> { >> .name = DA9063_DRVNAME_REGULATORS, > > Appreciate that these are historical, but these device name defines > make me shudder. They only serve to act as an obfuscation layer when > debugging at platform level. Please consider getting rid of them. The macro can be shared between the core and the drivers, so the names never run out of sync. >> .num_resources = ARRAY_SIZE(da9063_regulators_resources), >> @@ -100,15 +100,19 @@ static const struct mfd_cell da9063_devs[] = { >> .resources = da9063_onkey_resources, >> .of_compatible = "dlg,da9063-onkey", >> }, >> + { >> + .name = DA9063_DRVNAME_VIBRATION, >> + }, > > Place this on a single line please. This would only make the style inconsistent with the ie. LEDs entry. > { .name = DA9063_DRVNAME_VIBRATION }, > >> +}; >> + >> +/* Only present on DA9063 , not on DA9063L */ >> +static const struct mfd_cell da9063_devs[] = { >> { >> .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) >> @@ -225,16 +229,28 @@ 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); >> + ret = mfd_add_devices(da9063->dev, -1, da9063_common_devs, > > Please consider updating the -1's in this file with the appropriate > define in a separate patch. Done >> + ARRAY_SIZE(da9063_common_devs), >> + NULL, da9063->irq_base, NULL); >> if (ret) { >> dev_err(da9063->dev, "Cannot add MFD cells\n"); >> goto err_irq_exit; >> } >> >> + if (da9063->type == PMIC_TYPE_DA9063) { >> + ret = mfd_add_devices(da9063->dev, -1, da9063_devs, >> + ARRAY_SIZE(da9063_devs), >> + NULL, da9063->irq_base, NULL); >> + if (ret) { >> + dev_err(da9063->dev, "Cannot add MFD cells\n"); > > Better to be more general here. > > "Failed to add child devices" or such. > > Users don't tend to care about MFD cells. Hum, done. >> + goto err_mfd_cleanup; >> + } >> + } >> + >> return ret; >> >> +err_mfd_cleanup: >> + mfd_remove_devices(da9063->dev); > > Any reason why you can't use devm_*? Because we need to undo the MFD setup before the IRQ setup. >> err_irq_exit: >> da9063_irq_exit(da9063); >> return ret; > -- Best regards, Marek Vasut