mirror of
https://github.com/torvalds/linux.git
synced 2024-12-14 07:02:23 +00:00
mtd: brcmnand: refactor bcm63138 SoC layering
Removes an unnecessary allocation and saves a little bit of pointer chasing. Signed-off-by: Brian Norris <computersforpeace@gmail.com>
This commit is contained in:
parent
b6a02c0847
commit
7af67226fb
@ -22,7 +22,8 @@
|
||||
|
||||
#include "brcmnand.h"
|
||||
|
||||
struct bcm63138_nand_soc_priv {
|
||||
struct bcm63138_nand_soc {
|
||||
struct brcmnand_soc soc;
|
||||
void __iomem *base;
|
||||
};
|
||||
|
||||
@ -35,7 +36,8 @@ enum {
|
||||
|
||||
static bool bcm63138_nand_intc_ack(struct brcmnand_soc *soc)
|
||||
{
|
||||
struct bcm63138_nand_soc_priv *priv = soc->priv;
|
||||
struct bcm63138_nand_soc *priv =
|
||||
container_of(soc, struct bcm63138_nand_soc, soc);
|
||||
void __iomem *mmio = priv->base + BCM63138_NAND_INT_STATUS;
|
||||
u32 val = brcmnand_readl(mmio);
|
||||
|
||||
@ -49,7 +51,8 @@ static bool bcm63138_nand_intc_ack(struct brcmnand_soc *soc)
|
||||
|
||||
static void bcm63138_nand_intc_set(struct brcmnand_soc *soc, bool en)
|
||||
{
|
||||
struct bcm63138_nand_soc_priv *priv = soc->priv;
|
||||
struct bcm63138_nand_soc *priv =
|
||||
container_of(soc, struct bcm63138_nand_soc, soc);
|
||||
void __iomem *mmio = priv->base + BCM63138_NAND_INT_EN;
|
||||
u32 val = brcmnand_readl(mmio);
|
||||
|
||||
@ -64,25 +67,20 @@ static void bcm63138_nand_intc_set(struct brcmnand_soc *soc, bool en)
|
||||
static int bcm63138_nand_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
struct bcm63138_nand_soc_priv *priv;
|
||||
struct bcm63138_nand_soc *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;
|
||||
soc = &priv->soc;
|
||||
|
||||
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "nand-int-base");
|
||||
priv->base = devm_ioremap_resource(dev, res);
|
||||
if (IS_ERR(priv->base))
|
||||
return PTR_ERR(priv->base);
|
||||
|
||||
soc->pdev = pdev;
|
||||
soc->priv = priv;
|
||||
soc->ctlrdy_ack = bcm63138_nand_intc_ack;
|
||||
soc->ctlrdy_set_enabled = bcm63138_nand_intc_set;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user