diff options
author | Mike Frysinger <vapier@gentoo.org> | 2011-06-28 07:38:10 +0000 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2011-07-26 16:29:59 +0200 |
commit | b06afa75faeea2498447c56df1abaa23dbedb689 (patch) | |
tree | 4bc3eb8909e65e73cbaf5429866907225c5019ee /drivers/mtd/spi/spansion.c | |
parent | d4aa500913adf074ad85b1b74bf79e9abb104a70 (diff) | |
download | u-boot-imx-b06afa75faeea2498447c56df1abaa23dbedb689.zip u-boot-imx-b06afa75faeea2498447c56df1abaa23dbedb689.tar.gz u-boot-imx-b06afa75faeea2498447c56df1abaa23dbedb689.tar.bz2 |
sf: kill off now-unused local state
Now that the common spi_flash structure tracks all the info that these
drivers need, kill off their local state indirection and use just what
the common code provides.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'drivers/mtd/spi/spansion.c')
-rw-r--r-- | drivers/mtd/spi/spansion.c | 36 |
1 files changed, 12 insertions, 24 deletions
diff --git a/drivers/mtd/spi/spansion.c b/drivers/mtd/spi/spansion.c index b219b3c..28bb51a 100644 --- a/drivers/mtd/spi/spansion.c +++ b/drivers/mtd/spi/spansion.c @@ -63,17 +63,6 @@ struct spansion_spi_flash_params { const char *name; }; -struct spansion_spi_flash { - struct spi_flash flash; - const struct spansion_spi_flash_params *params; -}; - -static inline struct spansion_spi_flash *to_spansion_spi_flash(struct spi_flash - *flash) -{ - return container_of(flash, struct spansion_spi_flash, flash); -} - static const struct spansion_spi_flash_params spansion_spi_flash_table[] = { { .idcode1 = SPSN_ID_S25FL008A, @@ -141,7 +130,7 @@ static int spansion_erase(struct spi_flash *flash, u32 offset, size_t len) struct spi_flash *spi_flash_probe_spansion(struct spi_slave *spi, u8 *idcode) { const struct spansion_spi_flash_params *params; - struct spansion_spi_flash *spsn; + struct spi_flash *flash; unsigned int i; unsigned short jedec, ext_jedec; @@ -161,22 +150,21 @@ struct spi_flash *spi_flash_probe_spansion(struct spi_slave *spi, u8 *idcode) return NULL; } - spsn = malloc(sizeof(struct spansion_spi_flash)); - if (!spsn) { + flash = malloc(sizeof(*flash)); + if (!flash) { debug("SF: Failed to allocate memory\n"); return NULL; } - spsn->params = params; - spsn->flash.spi = spi; - spsn->flash.name = params->name; + flash->spi = spi; + flash->name = params->name; - spsn->flash.write = spi_flash_cmd_write_multi; - spsn->flash.erase = spansion_erase; - spsn->flash.read = spi_flash_cmd_read_fast; - spsn->flash.page_size = params->page_size; - spsn->flash.sector_size = params->page_size * params->pages_per_sector; - spsn->flash.size = spsn->flash.sector_size * params->nr_sectors; + flash->write = spi_flash_cmd_write_multi; + flash->erase = spansion_erase; + flash->read = spi_flash_cmd_read_fast; + flash->page_size = params->page_size; + flash->sector_size = params->page_size * params->pages_per_sector; + flash->size = flash->sector_size * params->nr_sectors; - return &spsn->flash; + return flash; } |