[patchv4] mtd: mchp23k256: Add driver for this SPI SRAM device

Andrew Lunn andrew at lunn.ch
Thu May 11 10:30:22 PDT 2017


> > 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 at 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 :)

Great, thanks.

> > +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.)

I think was getting compiler warnings somewhere. Used but not set. I
could of been too liberal spreading around the memset's.

      Thanks
	Andrew



More information about the linux-mtd mailing list