Re: [Patch V2 1/2] spi: imx: add lpspi bus driver

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

 



On Tue, Nov 15, 2016 at 09:33:50PM +0800, Gao Pan wrote:

> +static int
> +fsl_lpspi_prepare_message(struct spi_master *master, struct spi_message *msg)
> +{
> +	struct fsl_lpspi_data *fsl_lpspi = spi_master_get_devdata(master);
> +
> +	return clk_enable(fsl_lpspi->clk);
> +}

Why are we not also unpreparing the clock when the driver is idle?

> +static void fsl_lpspi_copy_to_buf(struct spi_message *m,
> +					struct fsl_lpspi_data *fsl_lpspi)
> +{
> +	struct spi_transfer *t;
> +	u8 *buf = fsl_lpspi->local_buf;
> +
> +	list_for_each_entry(t, &m->transfers, transfer_list) {
> +		if (t->tx_buf)
> +			memcpy(buf, t->tx_buf, t->len);
> +		else
> +			memset(buf, 0, t->len);
> +		buf += t->len;
> +	}
> +}

Why are we doing this linearization into a single buffer?

> +static int fsl_lpspi_check_message(struct spi_message *m)
> +{

If there's any checks in here that aren't done by the core then extend
the core to support them (or drop them).

> +static int fsl_lpspi_transfer_one_msg(struct spi_master *master,
> +					struct spi_message *m)
> +{

Why are we doing transfer_one_msg() and not transfer_one()?

> +	m->actual_length = ret ? 0 : trans.len;

Please write normal if statements, people should be able to read the
code.

> +out:
> +	if (m->status == -EINPROGRESS)
> +		m->status = ret;

Why not for other errors?

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux