All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@bootlin.com>
To: Yogesh Gaur <yogeshnarayan.gaur@nxp.com>
Cc: linux-mtd@lists.infradead.org,
	boris.brezillon@free-electrons.com, cyrille.pitchen@wedev4u.fr,
	computersforpeace@gmail.com, han.xu@nxp.com, festevam@gmail.com,
	marek.vasut@gmail.com, frieder.schrempf@exceet.de,
	prabhakar.kushwaha@nxp.com, suresh.gupta@nxp.com
Subject: Re: [PATCH v8 1/2] mtd: fsl-quadspi: add support to create dynamic LUT entry
Date: Fri, 23 Mar 2018 08:56:56 +0100	[thread overview]
Message-ID: <20180323085656.2eb56a19@bbrezillon> (raw)
In-Reply-To: <1521788544-17950-2-git-send-email-yogeshnarayan.gaur@nxp.com>

Hi Yogesh,

On Fri, 23 Mar 2018 12:32:23 +0530
Yogesh Gaur <yogeshnarayan.gaur@nxp.com> wrote:

> @@ -916,6 +1025,23 @@ static int fsl_qspi_erase(struct spi_nor *nor, loff_t offs)
>  {
>  	struct fsl_qspi *q = nor->priv;
>  	int ret;
> +	struct fsl_qspi_mem_op *op = q->op_data;
> +
> +	fsl_clr_qspi_mem_data(op);
> +
> +	/*
> +	 * Fill required entry of struct fsl_qspi_mem_op to prepare
> +	 * LUT for requested cmd.
> +	 * Erase operation works on single pad.
> +	 */
> +	op->cmd.opcode = nor->erase_opcode;
> +	op->cmd.pad = 1;
> +
> +	op->addr.addrlen = (nor->addr_width == 3) ? ADDR24BIT : ADDR32BIT;
> +	op->addr.pad = 1;
> +
> +	/* Dummy and Data info not required for Erase cmd */
> +	fsl_qspi_prepare_lut(nor, op);
>  
>  	dev_dbg(nor->dev, "%dKiB at 0x%08x:0x%08x\n",
>  		nor->mtd.erasesize / 1024, q->chip_base_addr, (u32)offs);
> @@ -967,12 +1093,18 @@ static int fsl_qspi_probe(struct platform_device *pdev)
>  	struct resource *res;
>  	struct spi_nor *nor;
>  	struct mtd_info *mtd;
> +	struct fsl_qspi_mem_op *mem_op_data;
>  	int ret, i = 0;
>  
>  	q = devm_kzalloc(dev, sizeof(*q), GFP_KERNEL);
>  	if (!q)
>  		return -ENOMEM;
>  
> +	mem_op_data = kmalloc(sizeof(struct fsl_qspi_mem_op), GFP_KERNEL);
> +	if (!mem_op_data)
> +		return -ENOMEM;
> +	q->op_data = mem_op_data;
> +

Why do you need to dynamically allocate this object? Actually, it's not
even needed to embed it in fsl_qspi, just put a fsl_qspi_mem_op object
on the stack when you need one.

Regards,

Boris

-- 
Boris Brezillon, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

  reply	other threads:[~2018-03-23  7:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-23  7:02 [PATCH v8 0/2] mtd: fsl-quadspi: add support to create dynamic LUT entry Yogesh Gaur
2018-03-23  7:02 ` [PATCH v8 1/2] " Yogesh Gaur
2018-03-23  7:56   ` Boris Brezillon [this message]
2018-03-23  7:02 ` [PATCH v8 2/2] mtd: fsl-quadspi: fix init AHB read in fsl_qspi_nor_setup() Yogesh Gaur

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=20180323085656.2eb56a19@bbrezillon \
    --to=boris.brezillon@bootlin.com \
    --cc=boris.brezillon@free-electrons.com \
    --cc=computersforpeace@gmail.com \
    --cc=cyrille.pitchen@wedev4u.fr \
    --cc=festevam@gmail.com \
    --cc=frieder.schrempf@exceet.de \
    --cc=han.xu@nxp.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=prabhakar.kushwaha@nxp.com \
    --cc=suresh.gupta@nxp.com \
    --cc=yogeshnarayan.gaur@nxp.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.