> > Create master device without partition when > > CONFIG_MTD_PARTITIONED_MASTER flag is unset. > > > > This streamlines device tree and allows to anchor > > runtime power management on master device in all cases. > > Please explain in more detail why this is needed. > If this change makes the overall situation better and breaks > no userspace, I'm happy. :-) > The rest of the series is a driver that need runtime power management. Absence of the master device breaks power management logic, as kernel automatically propagates state from children to parent. I initially hooked runtime_pm on chip auxiliary device, but this is a hack, not a solution. > From skimming over the patch I think the mtd_master device completely > useless for userspace, right? > As of today, yes. In future we can add curated sysfs with common parameters for all partitions, so user-space can query master device instead of one of the partitions. > > int add_mtd_device(struct mtd_info *mtd) > > { > > struct device_node *np = mtd_get_of_node(mtd); > > struct mtd_info *master = mtd_get_master(mtd); > > struct mtd_notifier *not; > > + bool partitioned = true; > > int i, error, ofidx; > > > > /* > > @@ -655,6 +678,11 @@ int add_mtd_device(struct mtd_info *mtd) > > if (WARN_ONCE(mtd->dev.type, "MTD already registered\n")) > > return -EEXIST; > > > > + if ((master == mtd) && > !IS_ENABLED(CONFIG_MTD_PARTITIONED_MASTER)) { > > + partitioned = false; > > + pr_debug("mtd: unpartitioned master %s\n", mtd->name); > > + } > > So, when CONFIG_MTD_PARTITIONED_MASTER is not set and a driver like > MTDRAM > does mtd_device_register(mtd, NULL, 0) we end up here with partitioned = > false, > and allocate just a master device but no real mtd because with zero > parts the mtd_device_parse_register() function will not call add_mtd_device(). > :-( Yep, missed this. I think that we can create master after partitions and condition it on master not created in partition phase. > > Thanks, > //Richard - - Thanks, Sasha