From: Sergei Shtylyov <sshtylyov@mvista.com>
To: Sudhakar Rajashekhara <sudhakar.raj@ti.com>
Cc: --cc=dwmw2@infradead.org,
davinci-linux-open-source@linux.davincidsp.com,
linux-mtd@lists.infradead.org
Subject: Re: [PATCH] m25p80: add support for a callback to platform code on successful device probe
Date: Tue, 10 Aug 2010 17:41:49 +0400 [thread overview]
Message-ID: <4C61571D.1030906@mvista.com> (raw)
In-Reply-To: <1281422578-20461-1-git-send-email-sudhakar.raj@ti.com>
Hello.
Sudhakar Rajashekhara wrote:
> On some platforms, MTD device can hold MAC address, calibration
> data, serial numbers etc.
> On TI's DA850/OMAP-L138/AM18xx EVM, MAC address is stored on
> the last sector of the SPI flash, which is exported as an MTD
> device.
> This patch adds two new members to the 'flash_platform_data'
> structure, a function handler which will be called after
> add_mtd_device() and an argument to be passed to this function,
> for example: offset to read from.
> Signed-off-by: Sudhakar Rajashekhara <sudhakar.raj@ti.com>
> ---
> drivers/mtd/devices/m25p80.c | 15 +++++++++++++--
> include/linux/spi/flash.h | 2 ++
> 2 files changed, 15 insertions(+), 2 deletions(-)
> diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
> index 81e49a9..b832091 100644
> --- a/drivers/mtd/devices/m25p80.c
> +++ b/drivers/mtd/devices/m25p80.c
[...]
> @@ -924,13 +925,23 @@ static int __devinit m25p_probe(struct spi_device *spi)
> (long long)(parts[i].size >> 10));
> }
> flash->partitioned = 1;
> - return add_mtd_partitions(&flash->mtd, parts, nr_parts);
> + ret = add_mtd_partitions(&flash->mtd, parts, nr_parts);
> + if (!ret)
> + goto out;
> +
> + return ret;
> }
> } else if (data && data->nr_parts)
> dev_warn(&spi->dev, "ignoring %d default partitions on %s\n",
> data->nr_parts, data->name);
>
> - return add_mtd_device(&flash->mtd) == 1 ? -ENODEV : 0;
> + ret = add_mtd_device(&flash->mtd);
> +
> +out:
> + if (data->setup && !ret)
> + (data->setup)(&flash->mtd, (void *)data->context);
Parens not necessary around 'data->setup'.
> diff --git a/include/linux/spi/flash.h b/include/linux/spi/flash.h
> index 3f22932..daa4875 100644
> --- a/include/linux/spi/flash.h
> +++ b/include/linux/spi/flash.h
> @@ -24,6 +24,8 @@ struct flash_platform_data {
> unsigned int nr_parts;
>
> char *type;
> + void (*setup)(struct mtd_info *, void *context);
> + void *context;
>
> /* we'll likely add more ... use JEDEC IDs, etc */
> };
Hm, is m25p80.c the only SPI flash driver using this structure? I guess
not -- I'm seeing at least sst25l.c and mtd_dataflash.c...
WBR, Sergei
prev parent reply other threads:[~2010-08-10 13:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-10 6:42 [PATCH] m25p80: add support for a callback to platform code on successful device probe Sudhakar Rajashekhara
2010-08-10 7:17 ` Mike Frysinger
2010-08-10 9:26 ` Sudhakar Rajashekhara
2010-08-10 13:07 ` David Brownell
2010-08-10 13:07 ` Sudhakar Rajashekhara
2010-08-10 19:02 ` Mike Frysinger
2010-08-11 11:56 ` Sudhakar Rajashekhara
[not found] ` <-1845909207770903949@unknownmsgid>
2010-08-11 17:27 ` Mike Frysinger
2010-08-10 13:41 ` Sergei Shtylyov [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=4C61571D.1030906@mvista.com \
--to=sshtylyov@mvista.com \
--cc=--cc=dwmw2@infradead.org \
--cc=davinci-linux-open-source@linux.davincidsp.com \
--cc=linux-mtd@lists.infradead.org \
--cc=sudhakar.raj@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).