All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Boris Brezillon <boris.brezillon@collabora.com>
Cc: Tudor Ambarus <tudor.ambarus@microchip.com>,
	Mark Brown <broonie@kernel.org>, Lee Jones <lee.jones@linaro.org>,
	Michael Walle <michael@walle.cc>, Pratyush Yadav <p.yadav@ti.com>,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	Jonathan Corbet <corbet@lwn.net>,
	Mauro Lima <mauro.lima@eclypsium.com>,
	Alexander Sverdlin <alexander.sverdlin@nokia.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Hans-Gert Dahmen <hans-gert.dahmen@immu.ne>,
	linux-mtd@lists.infradead.org, linux-spi@vger.kernel.org
Subject: Re: [PATCH v4 2/3] mtd: spi-nor: intel-spi: Convert to SPI MEM
Date: Thu, 16 Dec 2021 18:22:45 +0200	[thread overview]
Message-ID: <Ybtn1VTsspxdIeT8@lahna> (raw)
In-Reply-To: <20211216115100.448351e4@collabora.com>

Hi,

On Thu, Dec 16, 2021 at 11:51:00AM +0100, Boris Brezillon wrote:
> On Thu, 18 Nov 2021 16:05:42 +0300
> Mika Westerberg <mika.westerberg@linux.intel.com> wrote:
> 
> > +static bool intel_spi_cmp_mem_op(const struct intel_spi_mem_op *iop,
> > +				 const struct spi_mem_op *op)
> > +{
> > +	if (iop->mem_op.cmd.nbytes != op->cmd.nbytes ||
> > +	    iop->mem_op.cmd.buswidth != op->cmd.buswidth ||
> > +	    iop->mem_op.cmd.dtr != op->cmd.dtr ||
> > +	    iop->mem_op.cmd.opcode != op->cmd.opcode)
> > +		return false;
> > +
> > +	if (iop->mem_op.addr.nbytes) {
> > +		if (iop->mem_op.addr.nbytes != op->addr.nbytes ||
> > +		    iop->mem_op.addr.dtr != op->addr.dtr)
> > +			return false;
> > +	}
> 
> Hm, are you sure you want to allow op->addr.nbytes > 0 when
> iop->mem_op.addr.nbytes == 0? Feels like the command should be reported
> as unsupported in that case. Unless 0 is a wildcard meaning 'any', but
> that would be confusing, since operations with 0 address bytes are
> valid, and I actually expect the number of address cycles to be fixed 
> or bounded.

Indeed. I will change it to:

	if (iop->mem_op.addr.nbytes) {
		if (iop->mem_op.addr.nbytes != op->addr.nbytes ||
		    iop->mem_op.addr.dtr != op->addr.dtr)
			return false;
	} else if (op->addr.nbytes > 0) {
		return false;
	}

in v5 if that's what you meant.

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

WARNING: multiple messages have this Message-ID (diff)
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Boris Brezillon <boris.brezillon@collabora.com>
Cc: Tudor Ambarus <tudor.ambarus@microchip.com>,
	Mark Brown <broonie@kernel.org>, Lee Jones <lee.jones@linaro.org>,
	Michael Walle <michael@walle.cc>, Pratyush Yadav <p.yadav@ti.com>,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	Jonathan Corbet <corbet@lwn.net>,
	Mauro Lima <mauro.lima@eclypsium.com>,
	Alexander Sverdlin <alexander.sverdlin@nokia.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Hans-Gert Dahmen <hans-gert.dahmen@immu.ne>,
	linux-mtd@lists.infradead.org, linux-spi@vger.kernel.org
Subject: Re: [PATCH v4 2/3] mtd: spi-nor: intel-spi: Convert to SPI MEM
Date: Thu, 16 Dec 2021 18:22:45 +0200	[thread overview]
Message-ID: <Ybtn1VTsspxdIeT8@lahna> (raw)
In-Reply-To: <20211216115100.448351e4@collabora.com>

Hi,

On Thu, Dec 16, 2021 at 11:51:00AM +0100, Boris Brezillon wrote:
> On Thu, 18 Nov 2021 16:05:42 +0300
> Mika Westerberg <mika.westerberg@linux.intel.com> wrote:
> 
> > +static bool intel_spi_cmp_mem_op(const struct intel_spi_mem_op *iop,
> > +				 const struct spi_mem_op *op)
> > +{
> > +	if (iop->mem_op.cmd.nbytes != op->cmd.nbytes ||
> > +	    iop->mem_op.cmd.buswidth != op->cmd.buswidth ||
> > +	    iop->mem_op.cmd.dtr != op->cmd.dtr ||
> > +	    iop->mem_op.cmd.opcode != op->cmd.opcode)
> > +		return false;
> > +
> > +	if (iop->mem_op.addr.nbytes) {
> > +		if (iop->mem_op.addr.nbytes != op->addr.nbytes ||
> > +		    iop->mem_op.addr.dtr != op->addr.dtr)
> > +			return false;
> > +	}
> 
> Hm, are you sure you want to allow op->addr.nbytes > 0 when
> iop->mem_op.addr.nbytes == 0? Feels like the command should be reported
> as unsupported in that case. Unless 0 is a wildcard meaning 'any', but
> that would be confusing, since operations with 0 address bytes are
> valid, and I actually expect the number of address cycles to be fixed 
> or bounded.

Indeed. I will change it to:

	if (iop->mem_op.addr.nbytes) {
		if (iop->mem_op.addr.nbytes != op->addr.nbytes ||
		    iop->mem_op.addr.dtr != op->addr.dtr)
			return false;
	} else if (op->addr.nbytes > 0) {
		return false;
	}

in v5 if that's what you meant.

  reply	other threads:[~2021-12-16 16:38 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-18 13:05 [PATCH v4 0/3] mtd: spi-nor / spi / MFD: Convert intel-spi to SPI MEM Mika Westerberg
2021-11-18 13:05 ` Mika Westerberg
2021-11-18 13:05 ` [PATCH v4 1/3] mtd: spi-nor: intel-spi: Disable write protection only if asked Mika Westerberg
2021-11-18 13:05   ` Mika Westerberg
2021-11-18 13:05 ` [PATCH v4 2/3] mtd: spi-nor: intel-spi: Convert to SPI MEM Mika Westerberg
2021-11-18 13:05   ` Mika Westerberg
2021-12-16 10:51   ` Boris Brezillon
2021-12-16 10:51     ` Boris Brezillon
2021-12-16 16:22     ` Mika Westerberg [this message]
2021-12-16 16:22       ` Mika Westerberg
2021-12-16 16:43       ` Boris Brezillon
2021-12-16 16:43         ` Boris Brezillon
2021-12-17 10:38         ` Mika Westerberg
2021-12-17 10:38           ` Mika Westerberg
2021-12-17 10:52           ` Boris Brezillon
2021-12-17 10:52             ` Boris Brezillon
2021-12-17 11:05             ` Mika Westerberg
2021-12-17 11:05               ` Mika Westerberg
2021-11-18 13:05 ` [PATCH v4 3/3] Documentation / MTD: Rename the intel-spi driver Mika Westerberg
2021-11-18 13:05   ` Mika Westerberg
2021-12-16 10:39 ` [PATCH v4 0/3] mtd: spi-nor / spi / MFD: Convert intel-spi to SPI MEM Mika Westerberg
2021-12-16 10:39   ` Mika Westerberg

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=Ybtn1VTsspxdIeT8@lahna \
    --to=mika.westerberg@linux.intel.com \
    --cc=alexander.sverdlin@nokia.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=boris.brezillon@collabora.com \
    --cc=broonie@kernel.org \
    --cc=corbet@lwn.net \
    --cc=hans-gert.dahmen@immu.ne \
    --cc=lee.jones@linaro.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=mauro.lima@eclypsium.com \
    --cc=michael@walle.cc \
    --cc=miquel.raynal@bootlin.com \
    --cc=p.yadav@ti.com \
    --cc=richard@nod.at \
    --cc=tudor.ambarus@microchip.com \
    --cc=vigneshr@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 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.