Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964803AbbEMKtM (ORCPT ); Wed, 13 May 2015 06:49:12 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:51702 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933665AbbEMKtJ (ORCPT ); Wed, 13 May 2015 06:49:09 -0400 From: Arnd Bergmann To: Brian Norris Cc: linux-mtd@lists.infradead.org, Dmitry Torokhov , Anatol Pomazao , Ray Jui , Corneliu Doban , Jonathan Richardson , Scott Branden , Florian Fainelli , =?utf-8?B?UmFmYcWCIE1pxYJlY2tp?= , bcm-kernel-feedback-list@broadcom.com, Dan Ehrenberg , Gregory Fong , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Kevin Cernekee Subject: Re: [PATCH v4 08/11] mtd: brcmnand: add BCM63138 support Date: Wed, 13 May 2015 12:49:01 +0200 Message-ID: <7133995.DH7aRmliCR@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: <1431478424-29230-9-git-send-email-computersforpeace@gmail.com> References: <1431478424-29230-1-git-send-email-computersforpeace@gmail.com> <1431478424-29230-9-git-send-email-computersforpeace@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:iDMtXMwUzzGs+bo8HRZrTkD9JLwtrtrCXGyqVZKKXfj96w3esP3 JI9k3J08FIdsoRCoNnUWrpVIF01+nnrmNfj0MrFqPRhsOkU9qX9/WslYpsDg1LnPjzSCkkG wfo/QjscyxHt24/Q+MsdO53Qj1VUgOSFp+TipbJ5y/32Yodutmwwc7R0GEqlepsocLl32mM MudTN7LcXSv5VkyyMtgyg== X-UI-Out-Filterresults: notjunk:1; Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1897 Lines: 64 On Tuesday 12 May 2015 17:53:41 Brian Norris wrote: > +static bool bcm63138_nand_intc_ack(struct brcmnand_soc *soc) > +{ > + struct bcm63138_nand_soc_priv *priv = soc->priv; > + void __iomem *mmio = priv->base + BCM63138_NAND_INT_STATUS; > + u32 val = brcmnand_readl(mmio); > + > + if (val & BCM63138_CTLRDY) { > + brcmnand_writel(val & ~BCM63138_CTLRDY, mmio); > + return true; > + } > + > + return false; > +} ... > +static int bcm63138_nand_probe(struct platform_device *pdev) > +{ > + struct device *dev = &pdev->dev; > + struct bcm63138_nand_soc_priv *priv; > + struct brcmnand_soc *soc; > + struct resource *res; > + > + soc = devm_kzalloc(dev, sizeof(*soc), GFP_KERNEL); > + if (!soc) > + return -ENOMEM; > + > + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); > + if (!priv) > + return -ENOMEM; > + This is a slightly unconventional method of doing the abstraction. For consistency with a lot of other drivers, I'd do it like this: struct bcm63138_controller { void __iomem *base; brcmnand_controller parent; }; static bool bcm63138_nand_intc_ack(struct brcmnand_controller *parent) { struct bcm63138_controller *controller; controller = container_of(parent, struct brcmnand_controller, parent); ... } static int bcm63138_nand_probe(...) { struct bcm63138_controller *controller; controller = devm_kzalloc(dev, sizeof(*controller), GFP_KERNEL); ... return brcmnand_probe(pdev, &controller->parent); } This also simplifies the probe() functions and means less pointer chasing. Arnd -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/