Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 156443
b: refs/heads/master
c: 6afc4fd
h: refs/heads/master
i:
  156441: f318081
  156439: 40c8ee4
v: v3
  • Loading branch information
Saeed Bishara authored and David Woodhouse committed Aug 3, 2009
1 parent 817f1d2 commit 1f87ed1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7699ad35ed06044c4fc1be162553880f98658616
refs/heads/master: 6afc4fdb3e94ba60cd566cb878b60c6c01979277
7 changes: 4 additions & 3 deletions trunk/drivers/mtd/mtdcore.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ static void mtd_release(struct device *dev)
static int mtd_cls_suspend(struct device *dev, pm_message_t state)
{
struct mtd_info *mtd = dev_to_mtd(dev);
if (mtd->suspend)

if (mtd && mtd->suspend)
return mtd->suspend(mtd);
else
return 0;
Expand All @@ -76,7 +76,7 @@ static int mtd_cls_resume(struct device *dev)
{
struct mtd_info *mtd = dev_to_mtd(dev);

if (mtd->resume)
if (mtd && mtd->resume)
mtd->resume(mtd);
return 0;
}
Expand Down Expand Up @@ -298,6 +298,7 @@ int add_mtd_device(struct mtd_info *mtd)
mtd->dev.class = &mtd_class;
mtd->dev.devt = MTD_DEVT(i);
dev_set_name(&mtd->dev, "mtd%d", i);
dev_set_drvdata(&mtd->dev, mtd);
if (device_register(&mtd->dev) != 0) {
mtd_table[i] = NULL;
break;
Expand Down
2 changes: 1 addition & 1 deletion trunk/include/linux/mtd/mtd.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ struct mtd_info {

static inline struct mtd_info *dev_to_mtd(struct device *dev)
{
return dev ? container_of(dev, struct mtd_info, dev) : NULL;
return dev ? dev_get_drvdata(dev) : NULL;
}

static inline uint32_t mtd_div_by_eb(uint64_t sz, struct mtd_info *mtd)
Expand Down

0 comments on commit 1f87ed1

Please sign in to comment.