All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
To: Alexander Steffen
	<Alexander.Steffen-d0qZbvYSIPpWk0Htik3J/w@public.gmane.org>
Cc: tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] tpm_tis_spi: Use DMA-safe memory for SPI transfers
Date: Sun, 9 Jul 2017 15:11:50 -0600	[thread overview]
Message-ID: <20170709211150.GA19327@obsidianresearch.com> (raw)
In-Reply-To: <20170704135609.5064-1-Alexander.Steffen-d0qZbvYSIPpWk0Htik3J/w@public.gmane.org>

On Tue, Jul 04, 2017 at 03:56:09PM +0200, Alexander Steffen wrote:
>  struct tpm_tis_spi_phy {
>  	struct tpm_tis_data priv;
>  	struct spi_device *spi_device;
> -
> -	u8 tx_buf[4];
> -	u8 rx_buf[4];
> +	u8 *iobuf;

tpm_tis_spi_phy is already devm_kzalloc'd, why embed another kalloc
pointer inside it?

> +	phy->iobuf = devm_kmalloc(&dev->dev, MAX_SPI_FRAMESIZE, GFP_KERNEL);
> +	if (!phy->iobuf)
> +		return -ENOMEM;

Just do:

  struct tpm_tis_spi_phy {
  	struct tpm_tis_data priv;
  	struct spi_device *spi_device;
        u64 iobuf[MAX_SPI_FRAMESIZE/8];

Jason

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

WARNING: multiple messages have this Message-ID (diff)
From: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
To: Alexander Steffen <Alexander.Steffen@infineon.com>
Cc: tpmdd-devel@lists.sourceforge.net, stable@vger.kernel.org
Subject: Re: [tpmdd-devel] [PATCH] tpm_tis_spi: Use DMA-safe memory for SPI transfers
Date: Sun, 9 Jul 2017 15:11:50 -0600	[thread overview]
Message-ID: <20170709211150.GA19327@obsidianresearch.com> (raw)
In-Reply-To: <20170704135609.5064-1-Alexander.Steffen@infineon.com>

On Tue, Jul 04, 2017 at 03:56:09PM +0200, Alexander Steffen wrote:
>  struct tpm_tis_spi_phy {
>  	struct tpm_tis_data priv;
>  	struct spi_device *spi_device;
> -
> -	u8 tx_buf[4];
> -	u8 rx_buf[4];
> +	u8 *iobuf;

tpm_tis_spi_phy is already devm_kzalloc'd, why embed another kalloc
pointer inside it?

> +	phy->iobuf = devm_kmalloc(&dev->dev, MAX_SPI_FRAMESIZE, GFP_KERNEL);
> +	if (!phy->iobuf)
> +		return -ENOMEM;

Just do:

  struct tpm_tis_spi_phy {
  	struct tpm_tis_data priv;
  	struct spi_device *spi_device;
        u64 iobuf[MAX_SPI_FRAMESIZE/8];

Jason

  parent reply	other threads:[~2017-07-09 21:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-04 13:56 [PATCH] tpm_tis_spi: Use DMA-safe memory for SPI transfers Alexander Steffen
2017-07-04 13:56 ` Alexander Steffen
     [not found] ` <20170704135609.5064-1-Alexander.Steffen-d0qZbvYSIPpWk0Htik3J/w@public.gmane.org>
2017-07-09 21:11   ` Jason Gunthorpe [this message]
2017-07-09 21:11     ` [tpmdd-devel] " Jason Gunthorpe
2017-07-27 13:38     ` Alexander.Steffen
2017-07-27 13:38       ` Alexander.Steffen
2017-07-16 11:41 ` Jarkko Sakkinen

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=20170709211150.GA19327@obsidianresearch.com \
    --to=jgunthorpe-epgobjl8dl3ta4ec/59zmfatqe2ktcn/@public.gmane.org \
    --cc=Alexander.Steffen-d0qZbvYSIPpWk0Htik3J/w@public.gmane.org \
    --cc=stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.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 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.