[PATCH v2 2/4] mtd: nand: convert printk() to pr_*()

Dmitry Eremin-Solenikov dbaryshkov at gmail.com
Wed Jul 6 15:47:59 EDT 2011


On 7/6/11, Brian Norris <computersforpeace at gmail.com> wrote:
> On Wed, Jul 6, 2011 at 11:51 AM, Brian Norris
> <computersforpeace at gmail.com> wrote:
>> static inline struct device *mtd_to_dev(struct mtd_info *mtd)
>> {
>>        return mtd ? mtd->dev.parent : NULL;
>> }
>
> Second thought on this function; we may not even need to worry about
> the "mtd == NULL" case. But we might want to handle the case that
> mtd->dev actually *is* registered properly:
>
> static inline struct device *mtd_to_dev(struct mtd_info *mtd)
> {
>         if (device_is_registered(&mtd->dev))
>                 return &mtd->dev;
>         return mtd->dev.parent;

And what if mtd->dev.parent is NULL?


-- 
With best wishes
Dmitry



More information about the linux-mtd mailing list