public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Brian Norris <computersforpeace@gmail.com>
To: Heiner Kallweit <hkallweit1@gmail.com>
Cc: linux-mtd@lists.infradead.org
Subject: Re: [PATCH 1/2] spi-nor: add chip_name to struct spi_nor
Date: Mon, 2 Feb 2015 16:42:39 -0800	[thread overview]
Message-ID: <20150203004239.GE3992@ld-irv-0074> (raw)
In-Reply-To: <54CE5F98.1090704@gmail.com>

On Sun, Feb 01, 2015 at 06:17:12PM +0100, Heiner Kallweit wrote:
> The caller of spi_nor_scan might be interested in the exact chip type.
> This especially applies to these cases:
> - spi_nor_scan is called with a null name parameter and auto-detects the chip
> - spi_nor_scan detects a chipset which is different from the provided one
> 
> Therefore add chip_name to struct spi_nor.

I'll comment on patch 2, which demonstrates your alleged need for this,
but I don't think the users of spi-nor.c need to know exactly which
flash is being used.

Brian

> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
>  drivers/mtd/spi-nor/spi-nor.c | 1 +
>  include/linux/mtd/spi-nor.h   | 2 ++
>  2 files changed, 3 insertions(+)
> 
> diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
> index b6a5a0c..712b47b 100644
> --- a/drivers/mtd/spi-nor/spi-nor.c
> +++ b/drivers/mtd/spi-nor/spi-nor.c
> @@ -1160,6 +1160,7 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode)
>  	}
>  
>  	nor->read_dummy = spi_nor_read_dummy_cycles(nor);
> +	nor->chip_name = id->name;
>  
>  	dev_info(dev, "%s (%lld Kbytes)\n", id->name,
>  			(long long)mtd->size >> 10);
> diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h
> index 4720b86..468098a 100644
> --- a/include/linux/mtd/spi-nor.h
> +++ b/include/linux/mtd/spi-nor.h
> @@ -143,6 +143,7 @@ enum spi_nor_option_flags {
>   * @flags:		flag options for the current SPI-NOR (SNOR_F_*)
>   * @cfg:		used by the read_xfer/write_xfer
>   * @cmd_buf:		used by the write_reg
> + * @chip_name:		the name of the SPI NOR chip
>   * @prepare:		[OPTIONAL] do some preparations for the
>   *			read/write/erase/lock/unlock operations
>   * @unprepare:		[OPTIONAL] do some post work after the
> @@ -172,6 +173,7 @@ struct spi_nor {
>  	u32			flags;
>  	struct spi_nor_xfer_cfg	cfg;
>  	u8			cmd_buf[SPI_NOR_MAX_CMD_SIZE];
> +	const char		*chip_name;
>  
>  	int (*prepare)(struct spi_nor *nor, enum spi_nor_ops ops);
>  	void (*unprepare)(struct spi_nor *nor, enum spi_nor_ops ops);

      reply	other threads:[~2015-02-03  0:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-01 17:17 [PATCH 1/2] spi-nor: add chip_name to struct spi_nor Heiner Kallweit
2015-02-03  0:42 ` Brian Norris [this message]

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=20150203004239.GE3992@ld-irv-0074 \
    --to=computersforpeace@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox