Message ID | 1417746968-28747-1-git-send-email-computersforpeace@gmail.com |
---|---|
State | Accepted |
Headers | show |
You need to change some spaces to tabs in the patch. Tested-by: Scott Branden <sbranden@broadcom.com> On 14-12-04 06:36 PM, Brian Norris wrote: > cfi_cmdset_000{1,2}.c already implement their own reboot notifiers, and > we're going to add one for NAND. Let's put the boilerplate in one place. > > Signed-off-by: Brian Norris <computersforpeace@gmail.com> > --- > drivers/mtd/mtdcore.c | 20 ++++++++++++++++++++ > include/linux/mtd/mtd.h | 1 + > 2 files changed, 21 insertions(+) > > diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c > index 4c611871d7e6..b80d44f9751d 100644 > --- a/drivers/mtd/mtdcore.c > +++ b/drivers/mtd/mtdcore.c > @@ -37,6 +37,7 @@ > #include <linux/backing-dev.h> > #include <linux/gfp.h> > #include <linux/slab.h> > +#include <linux/reboot.h> > > #include <linux/mtd/mtd.h> > #include <linux/mtd/partitions.h> > @@ -365,6 +366,17 @@ static struct device_type mtd_devtype = { > .release = mtd_release, > }; > > +static int mtd_reboot_notifier(struct notifier_block *n, unsigned long state, > + void *cmd) > +{ > + struct mtd_info *mtd; You need tabs here instead of spaces to pass checkpatch > + > + mtd = container_of(n, struct mtd_info, reboot_notifier); > + mtd->_reboot(mtd); > + > + return NOTIFY_DONE; > +} > + > /** > * add_mtd_device - register an MTD device > * @mtd: pointer to new MTD device info structure > @@ -565,6 +577,11 @@ int mtd_device_parse_register(struct mtd_info *mtd, const char * const *types, > err = -ENODEV; > } > > + if (mtd->_reboot) { > + mtd->reboot_notifier.notifier_call = mtd_reboot_notifier; > + register_reboot_notifier(&mtd->reboot_notifier); > + } You need tabs here instead of spaces to pass checkpatch > + > return err; > } > EXPORT_SYMBOL_GPL(mtd_device_parse_register); > @@ -579,6 +596,9 @@ int mtd_device_unregister(struct mtd_info *master) > { > int err; > > + if (master->_reboot) > + unregister_reboot_notifier(&master->reboot_notifier); > + > err = del_mtd_partitions(master); > if (err) > return err; > diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h > index 031ff3a9a0bd..c06f5373d870 100644 > --- a/include/linux/mtd/mtd.h > +++ b/include/linux/mtd/mtd.h > @@ -227,6 +227,7 @@ struct mtd_info { > int (*_block_markbad) (struct mtd_info *mtd, loff_t ofs); > int (*_suspend) (struct mtd_info *mtd); > void (*_resume) (struct mtd_info *mtd); > + void (*_reboot) (struct mtd_info *mtd); > /* > * If the driver is something smart, like UBI, it may need to maintain > * its own reference counting. The below functions are only for driver. >
On Thu, Dec 04, 2014 at 10:48:02PM -0800, Scott Branden wrote: > You need to change some spaces to tabs in the patch. Wow, sorry. I'm being very dense. I'll be sure to fix these up before applying. > Tested-by: Scott Branden <sbranden@broadcom.com> Thanks! I'll leave this for others to comment on, since this was seemingly controversial. Plus, I have plenty of other things to review for (maybe) 3.19 that have been around a lot longer than this, so these may delay until 3.20, given the nearness of the 3.19 merge window. Regards, Brian
Hi Brian, I guess I'll leave this in your hands now unless there's anything else you need help will. I don't see how this is controversial. It is simply adding a reboot notifier so the MTD devices are shut down gracefully. You already added it to NOR. We're now just adding it generically for NAND and NOR. Thanks, Scott On 14-12-05 10:07 AM, Brian Norris wrote: > On Thu, Dec 04, 2014 at 10:48:02PM -0800, Scott Branden wrote: >> You need to change some spaces to tabs in the patch. > > Wow, sorry. I'm being very dense. I'll be sure to fix these up before > applying. > >> Tested-by: Scott Branden <sbranden@broadcom.com> > > Thanks! I'll leave this for others to comment on, since this was > seemingly controversial. Plus, I have plenty of other things to review > for (maybe) 3.19 that have been around a lot longer than this, so these > may delay until 3.20, given the nearness of the 3.19 merge window. > > Regards, > Brian >
Am 10.12.2014 um 01:02 schrieb Scott Branden: > Hi Brian, > > I guess I'll leave this in your hands now unless there's anything else you need help will. > > I don't see how this is controversial. It is simply adding a reboot notifier so the MTD devices are shut down gracefully. You already added it to NOR. We're now just adding it > generically for NAND and NOR. FWIW, I'll not block this. If it can be done in a sane way in MTD core and the MTD maintainers are fine with it I'm fine too. :-) My concern was that David was against this a few yeas ago and I tend to agree with him. Thanks, //richard
On Thu, Dec 04, 2014 at 06:36:06PM -0800, Brian Norris wrote: > cfi_cmdset_000{1,2}.c already implement their own reboot notifiers, and > we're going to add one for NAND. Let's put the boilerplate in one place. > > Signed-off-by: Brian Norris <computersforpeace@gmail.com> Pushed the first 2 (with a whitespace fixup) to l2-mtd.git. The third patch could use some testing, but I don't have an applicable system on me at the moment. Brian
Thanks Brian. We only use NAND right now so don't have system to test NOR either. Regards, Scott On 15-01-07 05:58 PM, Brian Norris wrote: > On Thu, Dec 04, 2014 at 06:36:06PM -0800, Brian Norris wrote: >> cfi_cmdset_000{1,2}.c already implement their own reboot notifiers, and >> we're going to add one for NAND. Let's put the boilerplate in one place. >> >> Signed-off-by: Brian Norris <computersforpeace@gmail.com> > > Pushed the first 2 (with a whitespace fixup) to l2-mtd.git. The third > patch could use some testing, but I don't have an applicable system on > me at the moment. > > Brian >
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index 4c611871d7e6..b80d44f9751d 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c @@ -37,6 +37,7 @@ #include <linux/backing-dev.h> #include <linux/gfp.h> #include <linux/slab.h> +#include <linux/reboot.h> #include <linux/mtd/mtd.h> #include <linux/mtd/partitions.h> @@ -365,6 +366,17 @@ static struct device_type mtd_devtype = { .release = mtd_release, }; +static int mtd_reboot_notifier(struct notifier_block *n, unsigned long state, + void *cmd) +{ + struct mtd_info *mtd; + + mtd = container_of(n, struct mtd_info, reboot_notifier); + mtd->_reboot(mtd); + + return NOTIFY_DONE; +} + /** * add_mtd_device - register an MTD device * @mtd: pointer to new MTD device info structure @@ -565,6 +577,11 @@ int mtd_device_parse_register(struct mtd_info *mtd, const char * const *types, err = -ENODEV; } + if (mtd->_reboot) { + mtd->reboot_notifier.notifier_call = mtd_reboot_notifier; + register_reboot_notifier(&mtd->reboot_notifier); + } + return err; } EXPORT_SYMBOL_GPL(mtd_device_parse_register); @@ -579,6 +596,9 @@ int mtd_device_unregister(struct mtd_info *master) { int err; + if (master->_reboot) + unregister_reboot_notifier(&master->reboot_notifier); + err = del_mtd_partitions(master); if (err) return err; diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 031ff3a9a0bd..c06f5373d870 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h @@ -227,6 +227,7 @@ struct mtd_info { int (*_block_markbad) (struct mtd_info *mtd, loff_t ofs); int (*_suspend) (struct mtd_info *mtd); void (*_resume) (struct mtd_info *mtd); + void (*_reboot) (struct mtd_info *mtd); /* * If the driver is something smart, like UBI, it may need to maintain * its own reference counting. The below functions are only for driver.
cfi_cmdset_000{1,2}.c already implement their own reboot notifiers, and we're going to add one for NAND. Let's put the boilerplate in one place. Signed-off-by: Brian Norris <computersforpeace@gmail.com> --- drivers/mtd/mtdcore.c | 20 ++++++++++++++++++++ include/linux/mtd/mtd.h | 1 + 2 files changed, 21 insertions(+)