Skip to content

Commit c993e09

Browse files
Boris BREZILLONcomputersforpeace
authored andcommitted
ARM: nand: make use of mtd_to_nand() where appropriate
mtd_to_nand() was recently introduced to avoid direct accesses to the mtd->priv field. Update all ARM specific implementations to use this helper. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
1 parent 9eba47d commit c993e09

9 files changed

Lines changed: 13 additions & 13 deletions

File tree

‎arch/arm/mach-ep93xx/snappercl15.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
static void snappercl15_nand_cmd_ctrl(struct mtd_info *mtd, int cmd,
5050
unsigned int ctrl)
5151
{
52-
struct nand_chip *chip = mtd->priv;
52+
struct nand_chip *chip = mtd_to_nand(mtd);
5353
static u16 nand_state = SNAPPERCL15_NAND_WPN;
5454
u16 set;
5555

@@ -76,7 +76,7 @@ static void snappercl15_nand_cmd_ctrl(struct mtd_info *mtd, int cmd,
7676

7777
static int snappercl15_nand_dev_ready(struct mtd_info *mtd)
7878
{
79-
struct nand_chip *chip = mtd->priv;
79+
struct nand_chip *chip = mtd_to_nand(mtd);
8080

8181
return !!(__raw_readw(NAND_CTRL_ADDR(chip)) & SNAPPERCL15_NAND_RDY);
8282
}

‎arch/arm/mach-ep93xx/ts72xx.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ static void __init ts72xx_map_io(void)
7474
static void ts72xx_nand_hwcontrol(struct mtd_info *mtd,
7575
int cmd, unsigned int ctrl)
7676
{
77-
struct nand_chip *chip = mtd->priv;
77+
struct nand_chip *chip = mtd_to_nand(mtd);
7878

7979
if (ctrl & NAND_CTRL_CHANGE) {
8080
void __iomem *addr = chip->IO_ADDR_R;
@@ -96,7 +96,7 @@ static void ts72xx_nand_hwcontrol(struct mtd_info *mtd,
9696

9797
static int ts72xx_nand_device_ready(struct mtd_info *mtd)
9898
{
99-
struct nand_chip *chip = mtd->priv;
99+
struct nand_chip *chip = mtd_to_nand(mtd);
100100
void __iomem *addr = chip->IO_ADDR_R;
101101

102102
addr += (1 << TS72XX_NAND_BUSY_ADDR_LINE);

‎arch/arm/mach-imx/mach-qong.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ static void qong_init_nor_mtd(void)
131131
*/
132132
static void qong_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
133133
{
134-
struct nand_chip *nand_chip = mtd->priv;
134+
struct nand_chip *nand_chip = mtd_to_nand(mtd);
135135

136136
if (cmd == NAND_CMD_NONE)
137137
return;

‎arch/arm/mach-ixp4xx/ixdp425-setup.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ static struct mtd_partition ixdp425_partitions[] = {
7676
static void
7777
ixdp425_flash_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
7878
{
79-
struct nand_chip *this = mtd->priv;
79+
struct nand_chip *this = mtd_to_nand(mtd);
8080
int offset = (int)this->priv;
8181

8282
if (ctrl & NAND_CTRL_CHANGE) {

‎arch/arm/mach-omap1/board-nand.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
void omap1_nand_cmd_ctl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
2424
{
25-
struct nand_chip *this = mtd->priv;
25+
struct nand_chip *this = mtd_to_nand(mtd);
2626
unsigned long mask;
2727

2828
if (cmd == NAND_CMD_NONE)

‎arch/arm/mach-orion5x/ts78xx-setup.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ static void ts78xx_ts_rtc_unload(void)
176176
static void ts78xx_ts_nand_cmd_ctrl(struct mtd_info *mtd, int cmd,
177177
unsigned int ctrl)
178178
{
179-
struct nand_chip *this = mtd->priv;
179+
struct nand_chip *this = mtd_to_nand(mtd);
180180

181181
if (ctrl & NAND_CTRL_CHANGE) {
182182
unsigned char bits;
@@ -200,7 +200,7 @@ static int ts78xx_ts_nand_dev_ready(struct mtd_info *mtd)
200200
static void ts78xx_ts_nand_write_buf(struct mtd_info *mtd,
201201
const uint8_t *buf, int len)
202202
{
203-
struct nand_chip *chip = mtd->priv;
203+
struct nand_chip *chip = mtd_to_nand(mtd);
204204
void __iomem *io_base = chip->IO_ADDR_W;
205205
unsigned long off = ((unsigned long)buf & 3);
206206
int sz;
@@ -227,7 +227,7 @@ static void ts78xx_ts_nand_write_buf(struct mtd_info *mtd,
227227
static void ts78xx_ts_nand_read_buf(struct mtd_info *mtd,
228228
uint8_t *buf, int len)
229229
{
230-
struct nand_chip *chip = mtd->priv;
230+
struct nand_chip *chip = mtd_to_nand(mtd);
231231
void __iomem *io_base = chip->IO_ADDR_R;
232232
unsigned long off = ((unsigned long)buf & 3);
233233
int sz;

‎arch/arm/mach-pxa/balloon3.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ static inline void balloon3_i2c_init(void) {}
572572
#if defined(CONFIG_MTD_NAND_PLATFORM)||defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
573573
static void balloon3_nand_cmd_ctl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
574574
{
575-
struct nand_chip *this = mtd->priv;
575+
struct nand_chip *this = mtd_to_nand(mtd);
576576
uint8_t balloon3_ctl_set = 0, balloon3_ctl_clr = 0;
577577

578578
if (ctrl & NAND_CTRL_CHANGE) {

‎arch/arm/mach-pxa/em-x270.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ static void nand_cs_off(void)
289289
static void em_x270_nand_cmd_ctl(struct mtd_info *mtd, int dat,
290290
unsigned int ctrl)
291291
{
292-
struct nand_chip *this = mtd->priv;
292+
struct nand_chip *this = mtd_to_nand(mtd);
293293
unsigned long nandaddr = (unsigned long)this->IO_ADDR_W;
294294

295295
dsb();

‎arch/arm/mach-pxa/palmtx.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ static inline void palmtx_keys_init(void) {}
250250
static void palmtx_nand_cmd_ctl(struct mtd_info *mtd, int cmd,
251251
unsigned int ctrl)
252252
{
253-
struct nand_chip *this = mtd->priv;
253+
struct nand_chip *this = mtd_to_nand(mtd);
254254
char __iomem *nandaddr = this->IO_ADDR_W;
255255

256256
if (cmd == NAND_CMD_NONE)

0 commit comments

Comments
 (0)