linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sekhar Nori <nsekhar@ti.com>
To: Franklin S Cooper Jr <fcooper@ti.com>, <david.s.gordon@intel.com>,
	<axboe@fb.com>, <akpm@linux-foundation.org>,
	<ming.l@ssi.samsung.com>, <linux-kernel@vger.kernel.org>,
	<broonie@kernel.org>, <linux-spi@vger.kernel.org>,
	<peter.ujfalusi@ti.com>
Subject: Re: [RFC] [PATCH v2 1/3] scatterlist: Add support to clone scatterlist
Date: Wed, 6 Jul 2016 15:45:33 +0530	[thread overview]
Message-ID: <577CDA45.80408@ti.com> (raw)
In-Reply-To: <1467039249-7816-2-git-send-email-fcooper@ti.com>

On Monday 27 June 2016 08:24 PM, Franklin S Cooper Jr wrote:

> +/*
> + * sg_table_clone - Duplicate an existing sg_table including chained sgl

This function should probably be called sg_clone_table() to be
consistent with sg_alloc_table(), sg_free_table() etc.

> + * @orig_table:     Original sg_table to be duplicated
> + * @len:            Total length of sg while taking chaining into account
> + * @gfp_mask:       GFP allocation mask
> + *
> + * Description:
> + *   Clone a sg_table along with chained sgl. This cloned copy may be
> + *   modified in some ways while keeping the original table and sgl in tact.
> + *   Also allow the cloned sgl copy to have a smaller length than the original
> + *   which may reduce the sgl total sg entries.
> + *
> + * Returns:
> + *   Pointer to new kmalloced sg_table, ERR_PTR() on error
> + *
> + */
> +struct sg_table *sg_table_clone(struct sg_table *orig_table, u64 len,
> +				gfp_t gfp_mask)
> +{
> +	struct sg_table	*table;
> +
> +	table = kmalloc(sizeof(struct sg_table), gfp_mask);

Can you use sg_alloc_table() to allocate the new table? The way you have
it now, it looks like users will need to use kfree() to free a cloned
table and use sg_free_table() otherwise. It will be nice if
sg_free_table() can be used consistently.

Regards,
Sekhar

  parent reply	other threads:[~2016-07-06 10:15 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-27 14:54 [RFC] [PATCH v2 0/3] scatterlist: Add support to clone sg_table Franklin S Cooper Jr
2016-06-27 14:54 ` [RFC] [PATCH v2 1/3] scatterlist: Add support to clone scatterlist Franklin S Cooper Jr
2016-07-05 14:49   ` Mark Brown
2016-07-05 16:47     ` Andy Shevchenko
2016-07-05 17:10   ` Andy Shevchenko
2016-07-06 17:09     ` Franklin S Cooper Jr.
2016-07-06 17:46       ` Andy Shevchenko
2016-07-06 19:39         ` Franklin S Cooper Jr.
2016-07-06 22:04           ` Robert Jarzmik
2016-07-07  8:02             ` Mark Brown
2016-07-07 17:43               ` Robert Jarzmik
2016-07-08  8:18                 ` Mark Brown
2016-07-12 17:14                   ` Robert Jarzmik
2016-07-07 15:58             ` Franklin S Cooper Jr.
2016-07-06 10:15   ` Sekhar Nori [this message]
2016-07-06 17:20     ` Franklin S Cooper Jr.
2016-06-27 14:54 ` [RFC] [PATCH v2 2/3] spi: omap2-mcspi: Add comments for RX only DMA buffer workaround Franklin S Cooper Jr
2016-06-27 14:54 ` [RFC] [PATCH v2 3/3] spi: omap2-mcspi: Use the SPI framework to handle DMA mapping Franklin S Cooper Jr

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=577CDA45.80408@ti.com \
    --to=nsekhar@ti.com \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@fb.com \
    --cc=broonie@kernel.org \
    --cc=david.s.gordon@intel.com \
    --cc=fcooper@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=ming.l@ssi.samsung.com \
    --cc=peter.ujfalusi@ti.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).