Two changes for NAND/MTD refactoring. The mtd_to_nand() helper will allow us to

stop using mtd->priv for NAND drivers.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJWZkijAAoJEFySrpd9RFgtnYIP/0y43CeSvaeyDl51xfxrep5m
 ctbICUKLi0dtrIwtyUuFgx33BjrOvEoqxEpEd0TMF1wPILhUszaEnqB03LXzi1zh
 090w0jXi0B5lSZuDmc5pFJR7staFz+suX4Gqs35xWWxymO0PX4+MxBWX/SE5whiB
 fw+aHm5AsG4NxL2wGuoTKhHS7HcUHPKhOCdhoHv9tknV7i5b4WFoh4k4W2CAhHpY
 5xKpJ0YKRHbBFFCKEpfQx1kUTo8dEe6ZcVWtnpRw7dg21KO8yEKQDP2fJvW6wTsv
 zF6SYKEvFL76D8j+Po2lDr0X+R1RLibi8LehVx3EMfG8j80p20xbHtnW4G1R5L2G
 l3Y/DVqsDL9esxyhFUTiYxig5tlYTYbaG6MmQch2OlPrXK/6UEDI1xsZuUCGRa8y
 8xZlnvLyogV4bQapnTV38wfKD9d6GQVS599uz9bpFd3TloxsQf5o/OJEkl0wEnTM
 xmZzXXQLK3vQfdy3biD+DEViQopcGK0GlYXaQPhQgUoNRHJzC1E42gFM7NUCp699
 nOUIsADi3QYZdC6OAcmZnnSiVqgPQBlwphR9YE0UmU50GHpFsx4QGNs/hIIMzXBS
 16aIV641baRxIvdbVvb23q9vKgoLzVKj2ZLdIwt/P0guo/NujrMU33EmWfyX/hOF
 Y0qb0T2GtuhHxEPfKti3
 =03sV
 -----END PGP SIGNATURE-----

Merge tag 'arm-soc/for-4.5/cleanup' of git://git.infradead.org/linux-mtd into next/cleanup

Merge "MTD/NAND cleanups for v4.5" from Brian Norris:

Two changes for NAND/MTD refactoring. The mtd_to_nand() helper will allow us to
stop using mtd->priv for NAND drivers.

* tag 'arm-soc/for-4.5/cleanup' of git://git.infradead.org/linux-mtd:
  ARM: nand: make use of mtd_to_nand() where appropriate
  mtd: nand: add an mtd_to_nand() helper
This commit is contained in:
Arnd Bergmann 2015-12-15 17:39:53 +01:00
commit d7e4859100
10 changed files with 18 additions and 13 deletions

View File

@ -49,7 +49,7 @@
static void snappercl15_nand_cmd_ctrl(struct mtd_info *mtd, int cmd,
unsigned int ctrl)
{
struct nand_chip *chip = mtd->priv;
struct nand_chip *chip = mtd_to_nand(mtd);
static u16 nand_state = SNAPPERCL15_NAND_WPN;
u16 set;
@ -76,7 +76,7 @@ static void snappercl15_nand_cmd_ctrl(struct mtd_info *mtd, int cmd,
static int snappercl15_nand_dev_ready(struct mtd_info *mtd)
{
struct nand_chip *chip = mtd->priv;
struct nand_chip *chip = mtd_to_nand(mtd);
return !!(__raw_readw(NAND_CTRL_ADDR(chip)) & SNAPPERCL15_NAND_RDY);
}

View File

@ -74,7 +74,7 @@ static void __init ts72xx_map_io(void)
static void ts72xx_nand_hwcontrol(struct mtd_info *mtd,
int cmd, unsigned int ctrl)
{
struct nand_chip *chip = mtd->priv;
struct nand_chip *chip = mtd_to_nand(mtd);
if (ctrl & NAND_CTRL_CHANGE) {
void __iomem *addr = chip->IO_ADDR_R;
@ -96,7 +96,7 @@ static void ts72xx_nand_hwcontrol(struct mtd_info *mtd,
static int ts72xx_nand_device_ready(struct mtd_info *mtd)
{
struct nand_chip *chip = mtd->priv;
struct nand_chip *chip = mtd_to_nand(mtd);
void __iomem *addr = chip->IO_ADDR_R;
addr += (1 << TS72XX_NAND_BUSY_ADDR_LINE);

View File

@ -131,7 +131,7 @@ static void qong_init_nor_mtd(void)
*/
static void qong_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
{
struct nand_chip *nand_chip = mtd->priv;
struct nand_chip *nand_chip = mtd_to_nand(mtd);
if (cmd == NAND_CMD_NONE)
return;

View File

@ -76,7 +76,7 @@ static struct mtd_partition ixdp425_partitions[] = {
static void
ixdp425_flash_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
{
struct nand_chip *this = mtd->priv;
struct nand_chip *this = mtd_to_nand(mtd);
int offset = (int)this->priv;
if (ctrl & NAND_CTRL_CHANGE) {

View File

@ -22,7 +22,7 @@
void omap1_nand_cmd_ctl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
{
struct nand_chip *this = mtd->priv;
struct nand_chip *this = mtd_to_nand(mtd);
unsigned long mask;
if (cmd == NAND_CMD_NONE)

View File

@ -176,7 +176,7 @@ static void ts78xx_ts_rtc_unload(void)
static void ts78xx_ts_nand_cmd_ctrl(struct mtd_info *mtd, int cmd,
unsigned int ctrl)
{
struct nand_chip *this = mtd->priv;
struct nand_chip *this = mtd_to_nand(mtd);
if (ctrl & NAND_CTRL_CHANGE) {
unsigned char bits;
@ -200,7 +200,7 @@ static int ts78xx_ts_nand_dev_ready(struct mtd_info *mtd)
static void ts78xx_ts_nand_write_buf(struct mtd_info *mtd,
const uint8_t *buf, int len)
{
struct nand_chip *chip = mtd->priv;
struct nand_chip *chip = mtd_to_nand(mtd);
void __iomem *io_base = chip->IO_ADDR_W;
unsigned long off = ((unsigned long)buf & 3);
int sz;
@ -227,7 +227,7 @@ static void ts78xx_ts_nand_write_buf(struct mtd_info *mtd,
static void ts78xx_ts_nand_read_buf(struct mtd_info *mtd,
uint8_t *buf, int len)
{
struct nand_chip *chip = mtd->priv;
struct nand_chip *chip = mtd_to_nand(mtd);
void __iomem *io_base = chip->IO_ADDR_R;
unsigned long off = ((unsigned long)buf & 3);
int sz;

View File

@ -572,7 +572,7 @@ static inline void balloon3_i2c_init(void) {}
#if defined(CONFIG_MTD_NAND_PLATFORM)||defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
static void balloon3_nand_cmd_ctl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
{
struct nand_chip *this = mtd->priv;
struct nand_chip *this = mtd_to_nand(mtd);
uint8_t balloon3_ctl_set = 0, balloon3_ctl_clr = 0;
if (ctrl & NAND_CTRL_CHANGE) {

View File

@ -289,7 +289,7 @@ static void nand_cs_off(void)
static void em_x270_nand_cmd_ctl(struct mtd_info *mtd, int dat,
unsigned int ctrl)
{
struct nand_chip *this = mtd->priv;
struct nand_chip *this = mtd_to_nand(mtd);
unsigned long nandaddr = (unsigned long)this->IO_ADDR_W;
dsb();

View File

@ -250,7 +250,7 @@ static inline void palmtx_keys_init(void) {}
static void palmtx_nand_cmd_ctl(struct mtd_info *mtd, int cmd,
unsigned int ctrl)
{
struct nand_chip *this = mtd->priv;
struct nand_chip *this = mtd_to_nand(mtd);
char __iomem *nandaddr = this->IO_ADDR_W;
if (cmd == NAND_CMD_NONE)

View File

@ -719,6 +719,11 @@ struct nand_chip {
void *priv;
};
static inline struct nand_chip *mtd_to_nand(struct mtd_info *mtd)
{
return mtd->priv;
}
/*
* NAND Flash Manufacturer ID Codes
*/