Skip to content

Commit 3fe4bae

Browse files
dedekindDavid Woodhouse
authored andcommitted
mtd: introduce mtd_suspend interface
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
1 parent e95e978 commit 3fe4bae

10 files changed

Lines changed: 15 additions & 10 deletions

File tree

‎drivers/mtd/maps/physmap.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ static void physmap_flash_shutdown(struct platform_device *dev)
191191

192192
for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++)
193193
if (info->mtd[i]->suspend && info->mtd[i]->resume)
194-
if (info->mtd[i]->suspend(info->mtd[i]) == 0)
194+
if (mtd_suspend(info->mtd[i]) == 0)
195195
info->mtd[i]->resume(info->mtd[i]);
196196
}
197197
#else

‎drivers/mtd/maps/pxa2xx-flash.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ static void pxa2xx_flash_shutdown(struct platform_device *dev)
125125
{
126126
struct pxa2xx_flash_info *info = platform_get_drvdata(dev);
127127

128-
if (info && info->mtd->suspend(info->mtd) == 0)
128+
if (info && mtd_suspend(info->mtd) == 0)
129129
info->mtd->resume(info->mtd);
130130
}
131131
#else

‎drivers/mtd/maps/rbtx4939-flash.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ static void rbtx4939_flash_shutdown(struct platform_device *dev)
120120
struct rbtx4939_flash_info *info = platform_get_drvdata(dev);
121121

122122
if (info->mtd->suspend && info->mtd->resume)
123-
if (info->mtd->suspend(info->mtd) == 0)
123+
if (mtd_suspend(info->mtd) == 0)
124124
info->mtd->resume(info->mtd);
125125
}
126126
#else

‎drivers/mtd/maps/sa1100-flash.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ static int __exit sa1100_mtd_remove(struct platform_device *pdev)
377377
static void sa1100_mtd_shutdown(struct platform_device *dev)
378378
{
379379
struct sa_info *info = platform_get_drvdata(dev);
380-
if (info && info->mtd->suspend(info->mtd) == 0)
380+
if (info && mtd_suspend(info->mtd) == 0)
381381
info->mtd->resume(info->mtd);
382382
}
383383
#else

‎drivers/mtd/mtdconcat.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ static int concat_suspend(struct mtd_info *mtd)
631631

632632
for (i = 0; i < concat->num_subdev; i++) {
633633
struct mtd_info *subdev = concat->subdev[i];
634-
if ((rc = subdev->suspend(subdev)) < 0)
634+
if ((rc = mtd_suspend(subdev)) < 0)
635635
return rc;
636636
}
637637
return rc;

‎drivers/mtd/mtdcore.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ static int mtd_cls_suspend(struct device *dev, pm_message_t state)
119119
struct mtd_info *mtd = dev_to_mtd(dev);
120120

121121
if (mtd && mtd->suspend)
122-
return mtd->suspend(mtd);
122+
return mtd_suspend(mtd);
123123
else
124124
return 0;
125125
}

‎drivers/mtd/mtdpart.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ static void part_sync(struct mtd_info *mtd)
307307
static int part_suspend(struct mtd_info *mtd)
308308
{
309309
struct mtd_part *part = PART(mtd);
310-
return part->master->suspend(part->master);
310+
return mtd_suspend(part->master);
311311
}
312312

313313
static void part_resume(struct mtd_info *mtd)

‎drivers/mtd/nand/nomadik_nand.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ static int nomadik_nand_suspend(struct device *dev)
201201
struct nomadik_nand_host *host = dev_get_drvdata(dev);
202202
int ret = 0;
203203
if (host)
204-
ret = host->mtd.suspend(&host->mtd);
204+
ret = mtd_suspend(&host->mtd);
205205
return ret;
206206
}
207207

‎drivers/mtd/nand/pxa3xx_nand.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1258,7 +1258,7 @@ static int pxa3xx_nand_suspend(struct platform_device *pdev, pm_message_t state)
12581258

12591259
for (cs = 0; cs < pdata->num_cs; cs++) {
12601260
mtd = info->host[cs]->mtd;
1261-
mtd->suspend(mtd);
1261+
mtd_suspend(mtd);
12621262
}
12631263

12641264
return 0;

‎include/linux/mtd/mtd.h‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,14 +210,14 @@ struct mtd_info {
210210
int (*lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
211211
int (*unlock) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
212212
int (*is_locked) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
213+
int (*suspend) (struct mtd_info *mtd);
213214

214215
/* Backing device capabilities for this device
215216
* - provides mmap capabilities
216217
*/
217218
struct backing_dev_info *backing_dev_info;
218219

219220
/* Power Management functions */
220-
int (*suspend) (struct mtd_info *mtd);
221221
void (*resume) (struct mtd_info *mtd);
222222

223223
/* Bad block management functions */
@@ -398,6 +398,11 @@ static inline int mtd_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len)
398398
return mtd->is_locked(mtd, ofs, len);
399399
}
400400

401+
static inline int mtd_suspend(struct mtd_info *mtd)
402+
{
403+
return mtd->suspend(mtd);
404+
}
405+
401406
static inline struct mtd_info *dev_to_mtd(struct device *dev)
402407
{
403408
return dev ? dev_get_drvdata(dev) : NULL;

0 commit comments

Comments
 (0)