From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753248AbbC3IaX (ORCPT ); Mon, 30 Mar 2015 04:30:23 -0400 Received: from mail-wi0-f171.google.com ([209.85.212.171]:38519 "EHLO mail-wi0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751482AbbC3IaU (ORCPT ); Mon, 30 Mar 2015 04:30:20 -0400 Date: Mon, 30 Mar 2015 09:30:15 +0100 From: Lee Jones To: Holger Dengler Cc: linux-kernel@vger.kernel.org, Peter Mahler , Juergen Bubeck , Benedikt Spranger , Samuel Ortiz Subject: Re: [PATCH 04/11] mfd: flexcard: add clocksrc device Message-ID: <20150330083015.GO457@x1> References: <1427277120-16924-1-git-send-email-dengler@linutronix.de> <1427277120-16924-5-git-send-email-dengler@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1427277120-16924-5-git-send-email-dengler@linutronix.de> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 25 Mar 2015, Holger Dengler wrote: > From: Benedikt Spranger > > The Flexcard offers a Flexray network synchronized counter with a > selectable resolution of 1us, 100ns or 10ns. Add an appropriate MFD-cell > to use the counter. > > Signed-off-by: Holger Dengler > Signed-off-by: Benedikt Spranger > cc: Samuel Ortiz > cc: Lee Jones > --- > drivers/mfd/flexcard/core.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 44 insertions(+) > > diff --git a/drivers/mfd/flexcard/core.c b/drivers/mfd/flexcard/core.c > index 6477019..c73ae5c 100644 > --- a/drivers/mfd/flexcard/core.c > +++ b/drivers/mfd/flexcard/core.c > @@ -28,6 +28,29 @@ static DEFINE_IDA(flexcard_ida); > > static const char drv_name[] = "flexcard"; > > +static struct resource flexcard_clk_res[] = { > + { > + .name = "flexcard-clksrc", > + .start = 0x700, We normally define these with a friendly name. > + .end = 0x713, Then use "NEW_DEFINE + 0x13" here. > + .flags = IORESOURCE_MEM, > + }, { > + .name = "flexcard-reset", > + .start = 0x144, > + .end = 0x147, > + .flags = IORESOURCE_MEM, > + }, > +}; > + > +static struct mfd_cell flexcard_clk_dev[] = { > + { > + .id = 0, You define this here. > + .name = "flexcard-clksrc", > + .num_resources = ARRAY_SIZE(flexcard_clk_res), > + .resources = flexcard_clk_res, > + }, > +}; > + [...] > +static int flexcard_clk_setup(struct flexcard_device *priv) > +{ > + struct pci_dev *pdev = priv->pdev; > + int i; > + > + for (i = 0; i < ARRAY_SIZE(flexcard_clk_res); i++) > + flexcard_clk_res[i].parent = &pdev->resource[0]; You're already providing &pdev->resource[0] as the (5th) 'mem_base' parameter of mfd_add_devices() where the core will populate .parent for you. No need to also hand-roll it here. > + flexcard_clk_dev[0].id = priv->cardnr; Then override it here? > + return mfd_add_devices(&pdev->dev, 0, flexcard_clk_dev, > + ARRAY_SIZE(flexcard_clk_dev), > + &pdev->resource[0], 0, NULL); Why do you have to register the clock as a seperate mfd_add_devices() call? How many MFD core devices are on this h/w? > +} > + > static int flexcard_misc_open(struct inode *inode, struct file *filp) > { > struct flexcard_device *priv = > @@ -233,6 +271,12 @@ static int flexcard_probe(struct pci_dev *pdev, > goto out_unmap; > } > > + ret = flexcard_clk_setup(priv); > + if (ret) { > + dev_err(&pdev->dev, "unable to register clksrc: %d\n", ret); > + goto out_remove; > + } > + > ret = misc_register(&priv->dev); > if (ret) { > dev_err(&pdev->dev, "unable to register miscdevice: %d\n", ret); -- Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog