Re: [tpmdd-devel] [PATCH] tpm_tis_spi: Use DMA-safe memory for SPI transfers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]