From: Brian Norris <computersforpeace@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: dwmw2@infradead.org, boris.brezillon@free-electrons.com,
zajec5@gmail.com, linux-mtd@lists.infradead.org
Subject: Re: [patchv4] mtd: mchp23k256: Add driver for this SPI SRAM device
Date: Thu, 11 May 2017 10:15:51 -0700 [thread overview]
Message-ID: <20170511171551.GF70297@google.com> (raw)
In-Reply-To: <1492011271-15099-1-git-send-email-andrew@lunn.ch>
Hi,
On Wed, Apr 12, 2017 at 05:34:31PM +0200, Andrew Lunn wrote:
> The Microchip 23k256 is a 32K Byte SRAM connected via SPI.
>
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
I've applied this to l2-mtd.git/next, for 4.13, with one small tweak,
and some other small comments below.
> ---
> v4:
> Fix block comment format
> Fix parameter indentation
> Remove double blank line
> ---
> drivers/mtd/devices/Kconfig | 10 +++
> drivers/mtd/devices/Makefile | 1 +
> drivers/mtd/devices/mchp23k256.c | 182 +++++++++++++++++++++++++++++++++++++++
> 3 files changed, 193 insertions(+)
> create mode 100644 drivers/mtd/devices/mchp23k256.c
>
...
> diff --git a/drivers/mtd/devices/mchp23k256.c b/drivers/mtd/devices/mchp23k256.c
> new file mode 100644
> index 000000000000..ed3d1724e5de
> --- /dev/null
> +++ b/drivers/mtd/devices/mchp23k256.c
> @@ -0,0 +1,182 @@
> +/*
> + * mchp23k256.c
> + *
> + * Driver for Microchip 23k256 SPI RAM chips
> + *
> + * Copyright © 20016 Andrew Lunn <andrew@lunn.ch>
Whoa, you have a time machine, and you used it to write this driver??
I'm in awe!
I've deleted a zero from this :)
> + *
> + * This code is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + *
> + */
...
> +static int mchp23k256_read(struct mtd_info *mtd, loff_t from, size_t len,
> + size_t *retlen, unsigned char *buf)
> +{
> + struct mchp23k256_flash *flash = to_mchp23k256_flash(mtd);
> + struct spi_transfer transfer[2] = {};
> + struct spi_message message;
> + unsigned char command[3];
> +
> + spi_message_init(&message);
> +
> + memset(&transfer, 0, sizeof(transfer));
Isn't this memset redundant, since you're initialized the struct above?
(I haven't touched this when applying.)
> + command[0] = MCHP23K256_CMD_READ;
> + command[1] = from >> 8;
> + command[2] = from;
> +
> + transfer[0].tx_buf = command;
> + transfer[0].len = sizeof(command);
> + spi_message_add_tail(&transfer[0], &message);
> +
> + transfer[1].rx_buf = buf;
> + transfer[1].len = len;
> + spi_message_add_tail(&transfer[1], &message);
> +
> + mutex_lock(&flash->lock);
> +
> + spi_sync(flash->spi, &message);
> +
> + if (retlen && message.actual_length > sizeof(command))
> + *retlen += message.actual_length - sizeof(command);
> +
> + mutex_unlock(&flash->lock);
> + return 0;
> +}
...
Brian
next prev parent reply other threads:[~2017-05-11 17:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-12 15:34 [patchv4] mtd: mchp23k256: Add driver for this SPI SRAM device Andrew Lunn
2017-04-14 12:52 ` Cyrille Pitchen
2017-05-11 17:15 ` Brian Norris [this message]
2017-05-11 17:30 ` Andrew Lunn
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=20170511171551.GF70297@google.com \
--to=computersforpeace@gmail.com \
--cc=andrew@lunn.ch \
--cc=boris.brezillon@free-electrons.com \
--cc=dwmw2@infradead.org \
--cc=linux-mtd@lists.infradead.org \
--cc=zajec5@gmail.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.