Linux-mtd Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] mtd: rawnand: au1550nd: Fix au_read_buf16() prototype
@ 2019-10-04 18:38 Paul Burton
  2019-10-04 18:41 ` [PATCH v2] " Paul Burton
  2019-10-04 18:42 ` [PATCH] " Boris Brezillon
  0 siblings, 2 replies; 3+ messages in thread
From: Paul Burton @ 2019-10-04 18:38 UTC (permalink / raw)
  To: linux-mtd
  Cc: Paul Burton, Vignesh Raghavendra, Boris Brezillon, linux-kernel,
	stable, linux-mips, Marek Vasut, Miquel Raynal, Brian Norris,
	David Woodhouse

Commit 7e534323c416 ("mtd: rawnand: Pass a nand_chip object to
chip->read_xxx() hooks") modified the prototype of the struct nand_chip
read_buf function pointer. In the au1550nd driver we have 2
implementations of read_buf. The previously mentioned commit modified
the au_read_buf() implementation to match the function pointer, but not
au_read_buf16(). This results in a compiler warning for MIPS
db1xxx_defconfig builds:

  drivers/mtd/nand/raw/au1550nd.c:443:57:
    warning: pointer type mismatch in conditional expression

Fix this by updating the prototype of au_read_buf16() to take a struct
nand_chip pointer as its first argument, as is expected after commit
7e534323c416 ("mtd: rawnand: Pass a nand_chip object to chip->read_xxx()
hooks").

Note that this shouldn't have caused any functional issues at runtime,
since the offset of the struct mtd_info within struct nand_chip is 0
making mtd_to_nand() effectively a type-cast.

Signed-off-by: Paul Burton <paul.burton@mips.com>
Fixes: 7e534323c416 ("mtd: rawnand: Pass a nand_chip object to chip->read_xxx() hooks")
Cc: Boris Brezillon <bbrezillon@kernel.org>
Cc: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Brian Norris <computersforpeace@gmail.com>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Vignesh Raghavendra <vigneshr@ti.com>
Cc: linux-mtd@lists.infradead.org
Cc: linux-mips@vger.kernel.org
Cc: stable@vger.kernel.org # v4.20+

---

 drivers/mtd/nand/raw/au1550nd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/raw/au1550nd.c b/drivers/mtd/nand/raw/au1550nd.c
index 97a97a9ccc36..2bc818dea2a8 100644
--- a/drivers/mtd/nand/raw/au1550nd.c
+++ b/drivers/mtd/nand/raw/au1550nd.c
@@ -140,10 +140,9 @@ static void au_write_buf16(struct nand_chip *this, const u_char *buf, int len)
  *
  * read function for 16bit buswidth
  */
-static void au_read_buf16(struct mtd_info *mtd, u_char *buf, int len)
+static void au_read_buf16(struct nand_chip *this, u_char *buf, int len)
 {
 	int i;
-	struct nand_chip *this = mtd_to_nand(mtd);
 	u16 *p = (u16 *) buf;
 	len >>= 1;
 
-- 
2.23.0


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2] mtd: rawnand: au1550nd: Fix au_read_buf16() prototype
  2019-10-04 18:38 [PATCH] mtd: rawnand: au1550nd: Fix au_read_buf16() prototype Paul Burton
@ 2019-10-04 18:41 ` " Paul Burton
  2019-10-04 18:42 ` [PATCH] " Boris Brezillon
  1 sibling, 0 replies; 3+ messages in thread
From: Paul Burton @ 2019-10-04 18:41 UTC (permalink / raw)
  To: linux-mtd
  Cc: Paul Burton, Vignesh Raghavendra, Boris Brezillon, linux-kernel,
	stable, linux-mips, Marek Vasut, Miquel Raynal, Brian Norris,
	David Woodhouse

Commit 7e534323c416 ("mtd: rawnand: Pass a nand_chip object to
chip->read_xxx() hooks") modified the prototype of the struct nand_chip
read_buf function pointer. In the au1550nd driver we have 2
implementations of read_buf. The previously mentioned commit modified
the au_read_buf() implementation to match the function pointer, but not
au_read_buf16(). This results in a compiler warning for MIPS
db1xxx_defconfig builds:

  drivers/mtd/nand/raw/au1550nd.c:443:57:
    warning: pointer type mismatch in conditional expression

Fix this by updating the prototype of au_read_buf16() to take a struct
nand_chip pointer as its first argument, as is expected after commit
7e534323c416 ("mtd: rawnand: Pass a nand_chip object to chip->read_xxx()
hooks").

Note that this shouldn't have caused any functional issues at runtime,
since the offset of the struct mtd_info within struct nand_chip is 0
making mtd_to_nand() effectively a type-cast.

Signed-off-by: Paul Burton <paul.burton@mips.com>
Fixes: 7e534323c416 ("mtd: rawnand: Pass a nand_chip object to chip->read_xxx() hooks")
Cc: Boris Brezillon <bbrezillon@kernel.org>
Cc: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Brian Norris <computersforpeace@gmail.com>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Vignesh Raghavendra <vigneshr@ti.com>
Cc: linux-mtd@lists.infradead.org
Cc: linux-mips@vger.kernel.org
Cc: stable@vger.kernel.org # v4.20+

---

Changes in v2:
- Update kerneldoc comment too...

 drivers/mtd/nand/raw/au1550nd.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/nand/raw/au1550nd.c b/drivers/mtd/nand/raw/au1550nd.c
index 97a97a9ccc36..e10b76089048 100644
--- a/drivers/mtd/nand/raw/au1550nd.c
+++ b/drivers/mtd/nand/raw/au1550nd.c
@@ -134,16 +134,15 @@ static void au_write_buf16(struct nand_chip *this, const u_char *buf, int len)
 
 /**
  * au_read_buf16 -  read chip data into buffer
- * @mtd:	MTD device structure
+ * @this:	NAND chip object
  * @buf:	buffer to store date
  * @len:	number of bytes to read
  *
  * read function for 16bit buswidth
  */
-static void au_read_buf16(struct mtd_info *mtd, u_char *buf, int len)
+static void au_read_buf16(struct nand_chip *this, u_char *buf, int len)
 {
 	int i;
-	struct nand_chip *this = mtd_to_nand(mtd);
 	u16 *p = (u16 *) buf;
 	len >>= 1;
 
-- 
2.23.0


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mtd: rawnand: au1550nd: Fix au_read_buf16() prototype
  2019-10-04 18:38 [PATCH] mtd: rawnand: au1550nd: Fix au_read_buf16() prototype Paul Burton
  2019-10-04 18:41 ` [PATCH v2] " Paul Burton
@ 2019-10-04 18:42 ` " Boris Brezillon
  1 sibling, 0 replies; 3+ messages in thread
From: Boris Brezillon @ 2019-10-04 18:42 UTC (permalink / raw)
  To: Paul Burton
  Cc: Paul Burton, Vignesh Raghavendra, Boris Brezillon, linux-kernel,
	stable, linux-mips, Marek Vasut, linux-mtd, Miquel Raynal,
	Brian Norris, David Woodhouse

On Fri, 4 Oct 2019 18:38:33 +0000
Paul Burton <paul.burton@mips.com> wrote:

> Commit 7e534323c416 ("mtd: rawnand: Pass a nand_chip object to
> chip->read_xxx() hooks") modified the prototype of the struct nand_chip
> read_buf function pointer. In the au1550nd driver we have 2
> implementations of read_buf. The previously mentioned commit modified
> the au_read_buf() implementation to match the function pointer, but not
> au_read_buf16(). This results in a compiler warning for MIPS
> db1xxx_defconfig builds:
> 
>   drivers/mtd/nand/raw/au1550nd.c:443:57:
>     warning: pointer type mismatch in conditional expression
> 
> Fix this by updating the prototype of au_read_buf16() to take a struct
> nand_chip pointer as its first argument, as is expected after commit
> 7e534323c416 ("mtd: rawnand: Pass a nand_chip object to chip->read_xxx()
> hooks").
> 
> Note that this shouldn't have caused any functional issues at runtime,
> since the offset of the struct mtd_info within struct nand_chip is 0
> making mtd_to_nand() effectively a type-cast.
> 
> Signed-off-by: Paul Burton <paul.burton@mips.com>
> Fixes: 7e534323c416 ("mtd: rawnand: Pass a nand_chip object to chip->read_xxx() hooks")
> Cc: Boris Brezillon <bbrezillon@kernel.org>

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>

> Cc: Miquel Raynal <miquel.raynal@bootlin.com>
> Cc: David Woodhouse <dwmw2@infradead.org>
> Cc: Brian Norris <computersforpeace@gmail.com>
> Cc: Marek Vasut <marek.vasut@gmail.com>
> Cc: Vignesh Raghavendra <vigneshr@ti.com>
> Cc: linux-mtd@lists.infradead.org
> Cc: linux-mips@vger.kernel.org
> Cc: stable@vger.kernel.org # v4.20+
> 
> ---
> 
>  drivers/mtd/nand/raw/au1550nd.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/mtd/nand/raw/au1550nd.c b/drivers/mtd/nand/raw/au1550nd.c
> index 97a97a9ccc36..2bc818dea2a8 100644
> --- a/drivers/mtd/nand/raw/au1550nd.c
> +++ b/drivers/mtd/nand/raw/au1550nd.c
> @@ -140,10 +140,9 @@ static void au_write_buf16(struct nand_chip *this, const u_char *buf, int len)
>   *
>   * read function for 16bit buswidth
>   */
> -static void au_read_buf16(struct mtd_info *mtd, u_char *buf, int len)
> +static void au_read_buf16(struct nand_chip *this, u_char *buf, int len)
>  {
>  	int i;
> -	struct nand_chip *this = mtd_to_nand(mtd);
>  	u16 *p = (u16 *) buf;
>  	len >>= 1;
>  


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-04 18:38 [PATCH] mtd: rawnand: au1550nd: Fix au_read_buf16() prototype Paul Burton
2019-10-04 18:41 ` [PATCH v2] " Paul Burton
2019-10-04 18:42 ` [PATCH] " Boris Brezillon

Linux-mtd Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-mtd/0 linux-mtd/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-mtd linux-mtd/ https://lore.kernel.org/linux-mtd \
		linux-mtd@lists.infradead.org linux-mtd@archiver.kernel.org
	public-inbox-index linux-mtd

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-mtd


AGPL code for this site: git clone https://public-inbox.org/ public-inbox