From: mark.rutland@arm.com (Mark Rutland)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/3] mtd: hisilicon: add a new nand controller driver for hisilicon hip04 Soc
Date: Mon, 30 Jun 2014 11:00:25 +0100 [thread overview]
Message-ID: <20140630100025.GA7262@leverpostej> (raw)
In-Reply-To: <1404115409-20200-3-git-send-email-wangzhou.bry@gmail.com>
On Mon, Jun 30, 2014 at 09:03:28AM +0100, Zhou Wang wrote:
> Signed-off-by: Zhou Wang <wangzhou.bry@gmail.com>
> ---
> drivers/mtd/nand/Kconfig | 5 +
> drivers/mtd/nand/Makefile | 1 +
> drivers/mtd/nand/hisi_nand.c | 847 ++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 853 insertions(+)
> create mode 100644 drivers/mtd/nand/hisi_nand.c
[...]
> +struct hinfc_host {
> + struct nand_chip *chip;
> + struct mtd_info *mtd;
> + struct device *dev;
> + void __iomem *iobase;
> + struct completion cmd_complete;
> + unsigned int offset;
> + unsigned int command;
> + int chipselect;
> + unsigned int addr_cycle;
> + unsigned int addr_value[2];
> + unsigned int cache_addr_value[2];
> + char *buffer;
> + dma_addr_t dma_buffer;
> + dma_addr_t dma_oob;
> + int version;
> + unsigned int ecc_bits;
> + unsigned int irq_status; /* interrupt status */
> +
> + int (*send_cmd_pageprog)(struct hinfc_host *host);
> + int (*send_cmd_status)(struct hinfc_host *host);
> + int (*send_cmd_readstart)(struct hinfc_host *host);
> + int (*send_cmd_erase)(struct hinfc_host *host);
> + int (*send_cmd_readid)(struct hinfc_host *host);
> + int (*send_cmd_reset)(struct hinfc_host *host, int chipselect);
> +};
[...]
> +static int hisi_nfc_probe(struct platform_device *pdev)
> +{
> + int ret = 0, irq, buswidth, flag, max_chips = HINFC504_MAX_CHIP;
> + struct device *dev = &pdev->dev;
> + struct hinfc_host *host;
> + struct nand_chip *chip;
> + struct mtd_info *mtd;
> + struct resource *res;
> + struct device_node *np = dev->of_node;
> + struct mtd_part_parser_data ppdata;
> +
> + host = devm_kzalloc(dev, sizeof(*host) + sizeof(*chip) + sizeof(*mtd),
> + GFP_KERNEL);
> + if (!host)
> + return -ENOMEM;
> + host->dev = dev;
> +
> + platform_set_drvdata(pdev, host);
> + chip = (struct nand_chip *)&host[1];
> + mtd = (struct mtd_info *)&chip[1];
Why not embed the whole struct rather than pointers? Then you can
allocate just the host and extract pointers to the chip and mtd sub
structures.
Thanks,
Mark.
next prev parent reply other threads:[~2014-06-30 10:00 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-30 8:03 [PATCH 0/3] mtd: hisilicon: add a new driver for NAND controller of hisilicon hip04 Soc Zhou Wang
2014-06-30 8:03 ` [PATCH 1/3] mtd: hisilicon: add device tree node for nand controller Zhou Wang
2014-07-09 7:08 ` Jerome FORISSIER
2014-07-11 2:40 ` Zhou Wang
2014-06-30 8:03 ` [PATCH 2/3] mtd: hisilicon: add a new nand controller driver for hisilicon hip04 Soc Zhou Wang
2014-06-30 9:00 ` Arnd Bergmann
2014-06-30 9:59 ` Caizhiyong
2014-07-02 2:12 ` Zhou Wang
2014-07-02 2:07 ` Zhou Wang
2014-06-30 9:45 ` Ivan Khoronzhuk
2014-07-02 2:09 ` Zhou Wang
2014-06-30 10:00 ` Mark Rutland [this message]
2014-07-02 2:15 ` Zhou Wang
2014-06-30 8:03 ` [PATCH 3/3] mtd: hisilicon: add device tree binding documentation Zhou Wang
2014-06-30 9:52 ` Mark Rutland
2014-07-02 2:46 ` Zhou Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140630100025.GA7262@leverpostej \
--to=mark.rutland@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).