devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zhou Wang <wangzhou.bry@gmail.com>
To: Mark Rutland <mark.rutland@arm.com>
Cc: Jussi Kivilinna <jussi.kivilinna@iki.fi>,
	"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
	Artem Bityutskiy <artem.bityutskiy@linux.intel.com>,
	"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
	Russell King <linux@arm.linux.org.uk>,
	Alexander Shiyan <shc_work@mail.ru>,
	Ezequiel Garcia <ezequiel.garcia@free-electrons.com>,
	"grant.likely@linaro.org" <grant.likely@linaro.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	Pawel Moll <Pawel.Moll@arm.com>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Joern Engel <joern@logfs.org>, Rob Herring <robh+dt@kernel.org>,
	Pekon Gupta <pekon@ti.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	Randy Dunlap <rdunlap@infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"wangzhou1@hisilicon.com" <wangzhou1@hisilicon.com>,
	Kumar Gala <galak>
Subject: Re: [PATCH 2/3] mtd: hisilicon: add a new nand controller driver for hisilicon hip04 Soc
Date: Wed, 02 Jul 2014 10:15:43 +0800	[thread overview]
Message-ID: <53B36B4F.90505@gmail.com> (raw)
In-Reply-To: <20140630100025.GA7262@leverpostej>

On 2014年06月30日 18:00, Mark Rutland wrote:
> 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.
>

I will change this as your comment, thanks.

> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2014-07-02  2:15 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
2014-07-02  2:15     ` Zhou Wang [this message]
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=53B36B4F.90505@gmail.com \
    --to=wangzhou.bry@gmail.com \
    --cc=Pawel.Moll@arm.com \
    --cc=artem.bityutskiy@linux.intel.com \
    --cc=devicetree@vger.kernel.org \
    --cc=ezequiel.garcia@free-electrons.com \
    --cc=grant.likely@linaro.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=joern@logfs.org \
    --cc=jussi.kivilinna@iki.fi \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mark.rutland@arm.com \
    --cc=pekon@ti.com \
    --cc=rdunlap@infradead.org \
    --cc=robh+dt@kernel.org \
    --cc=shc_work@mail.ru \
    --cc=wangzhou1@hisilicon.com \
    /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).