[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y/2iCn6M/+HWsjZD@ye-NUC7i7DNHE>
Date: Tue, 28 Feb 2023 14:41:14 +0800
From: "Ye, Xiang" <xiang.ye@...el.com>
To: Mark Brown <broonie@...nel.org>
CC: Lee Jones <lee@...nel.org>, Wolfram Sang <wsa@...nel.org>,
Tyrone Ting <kfting@...oton.com>,
Linus Walleij <linus.walleij@...aro.org>,
"Bartosz Golaszewski" <brgl@...ev.pl>,
"linux-i2c@...r.kernel.org" <linux-i2c@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-spi@...r.kernel.org" <linux-spi@...r.kernel.org>,
"linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
"Pandruvada, Srinivas" <srinivas.pandruvada@...el.com>,
"heikki.krogerus@...ux.intel.com" <heikki.krogerus@...ux.intel.com>,
"andriy.shevchenko@...ux.intel.com"
<andriy.shevchenko@...ux.intel.com>,
"sakari.ailus@...ux.intel.com" <sakari.ailus@...ux.intel.com>,
"Wang, Zhifeng" <zhifeng.wang@...el.com>,
"Wu, Wentong" <Wentong.Wu@...el.com>,
"Zhang, Lixu" <Lixu.Zhang@...el.com>
Subject: Re: [PATCH v2 4/5] spi: Add support for Intel LJCA USB SPI driver
Hi Mark,
Thanks for the review.
On Tue, Feb 28, 2023 at 01:23:09AM +0800, Mark Brown wrote:
> On Sat, Feb 25, 2023 at 10:01:17PM +0800, Ye Xiang wrote:
>
> > +struct spi_xfer_packet {
> > + u8 indicator;
> > + s8 len;
> > + u8 data[];
> > +} __packed;
>
> > +static int ljca_spi_read_write(struct ljca_spi_dev *ljca_spi, const u8 *w_data, u8 *r_data, int len,
> > + int id, int complete, int cmd)
> > +{
> > + struct spi_xfer_packet *w_packet = (struct spi_xfer_packet *)ljca_spi->obuf;
> > + struct spi_xfer_packet *r_packet = (struct spi_xfer_packet *)ljca_spi->ibuf;
> > + unsigned int ibuf_len = LJCA_SPI_BUF_SIZE;
> > + int ret;
> > +
> > + w_packet->indicator = FIELD_PREP(LJCA_SPI_XFER_INDICATOR_ID, id) |
> > + FIELD_PREP(LJCA_SPI_XFER_INDICATOR_CMPL, complete) |
> > + FIELD_PREP(LJCA_SPI_XFER_INDICATOR_INDEX,
> > + ljca_spi->spi_info->id);
> > +
> > + if (cmd == LJCA_SPI_READ) {
> > + w_packet->len = sizeof(u16);
> > + *(u16 *)&w_packet->data[0] = len;
>
> Are there no endianness considerations here?
Yes, it should be little endian. Will address this.
>
> > +static int ljca_spi_transfer(struct ljca_spi_dev *ljca_spi, const u8 *tx_data,
> > + u8 *rx_data, u16 len)
> > +{
>
> This function has one caller with barely anything in it - perhaps just
> inline it?
Agree. Will make this function inline.
--
Thanks
Ye Xiang
Powered by blists - more mailing lists