mtd: denali_dt: Use devm_ioremap_resource()
Dinh Nguyen
Tested-byQuoted 31 lines · Jingoo Han
Quoted 30 lines · Brian Norris
Quoted 29 lines · Jingoo Han
Use
devm_ioremap_resource()in order to make the code simpler, and remove redundant return value check ofplatform_get_resource_byname()because the value is checked bydevm_ioremap_resource().Signed-off-by Jingoo Han <[email protected]>--- drivers/mtd/nand/denali_dt.c | 39 ++++++++------------------------------- 1 file changed, 8 insertions(+), 31 deletions(-)drivers/mtd/nand/denali_dt.c +0
-11@@ -30,24 +30,6 @@ struct denali_dt {struct clk *clk; }; -static void __iomem *request_and_map (struct device *dev, -const struct resource *res) -{ -void __iomem *ptr; - -if (!devm_request_mem_region (dev, res->start,resource_size (res), -"denali-dt" )) { -dev_err (dev,"unable to request %s\n" , res->name); -return NULL ; - } -
Quoted 9 lines
Quoted 8 lines
drivers/mtd/nand/denali_dt.c struct denali_dt { · line 44
Quoted 1 line
drivers/mtd/nand/denali_dt.c +0
-1- ptr =devm_ioremap_nocache (dev, res->start,resource_size (res));Your code here is not a direct replacement; Dinh originally used the
_nocachevariant of ioremap, but you are replacing it with the standard one. There is no difference between the two on several ARCH's, but I can't guarantee that your patch is safe without confirmation/testing. So I will not take this without an Ack or Tested-by from someone knowledgeable about denali.
Sorry that it took a while to get around to this. But I was able to test the patch and it looks fine.
Thanks,
Dinh
Quoted 19 lines
(+cc Lars-Peter Clausen, Thierry Reding)
According to the comment of
devm_ioremap_resource(), 'devm_ioremap_resource()' ioremaps it either as cacheable or as non-cacheable memory depending on the resource's flags Thus,devm_ioremap_nocache()will be called automatically.
./lib/devres.c
void__iomem*devm_ioremap_resource(struct device *dev, struct resource *res){ .... if (res->flags & IORESOURCE_CACHEABLE) dest_ptr = devm_ioremap(dev, res->start, size); else dest_ptr = devm_ioremap_nocache(dev, res->start, size);Best regards,
Jingoo Han
Quoted 42 lines · Dinh Nguyen
Quoted 31 lines · Jingoo Han
Quoted 30 lines · Brian Norris
Quoted 29 lines · Jingoo Han
Use
devm_ioremap_resource()in order to make the code simpler, and remove redundant return value check ofplatform_get_resource_byname()because the value is checked bydevm_ioremap_resource().Signed-off-by Jingoo Han <[email protected]>--- drivers/mtd/nand/denali_dt.c | 39 ++++++++------------------------------- 1 file changed, 8 insertions(+), 31 deletions(-)drivers/mtd/nand/denali_dt.c +0
-11@@ -30,24 +30,6 @@ struct denali_dt {struct clk *clk; }; -static void __iomem *request_and_map (struct device *dev, -const struct resource *res) -{ -void __iomem *ptr; - -if (!devm_request_mem_region (dev, res->start,resource_size (res), -"denali-dt" )) { -dev_err (dev,"unable to request %s\n" , res->name); -return NULL ; - } -Quoted 9 lines
Quoted 8 lines
drivers/mtd/nand/denali_dt.c struct denali_dt { · line 44
Quoted 1 line
drivers/mtd/nand/denali_dt.c +0
-1- ptr =devm_ioremap_nocache (dev, res->start,resource_size (res));Your code here is not a direct replacement; Dinh originally used the
_nocachevariant of ioremap, but you are replacing it with the standard one. There is no difference between the two on several ARCH's, but I can't guarantee that your patch is safe without confirmation/testing. So I will not take this without an Ack or Tested-by from someone knowledgeable about denali.
Quoted 4 lines
Sorry that it took a while to get around to this. But I was able to test the patch and it looks fine.
Tested-by Dinh Nguyen <[email protected]>
Hi Dinh Nguyen,
I really appreciate your tested-by. :-)
Thank you a lot.
Best regards,
Jingoo Han
Quoted 22 lines
Thanks,
DinhQuoted 19 lines
(+cc Lars-Peter Clausen, Thierry Reding)
According to the comment of
devm_ioremap_resource(), 'devm_ioremap_resource()' ioremaps it either as cacheable or as non-cacheable memory depending on the resource's flags Thus,devm_ioremap_nocache()will be called automatically.
./lib/devres.c
void__iomem*devm_ioremap_resource(struct device *dev, struct resource *res){ .... if (res->flags & IORESOURCE_CACHEABLE) dest_ptr = devm_ioremap(dev, res->start, size); else dest_ptr = devm_ioremap_nocache(dev, res->start, size);Best regards,
Jingoo Han
Quoted 10 lines · Jingoo Han
Quoted 9 lines · Dinh Nguyen
Quoted 7 lines · Jingoo Han
Quoted 6 lines · Brian Norris
Your code here is not a direct replacement; Dinh originally used the
_nocachevariant of ioremap, but you are replacing it with the standard one. There is no difference between the two on several ARCH's, but I can't guarantee that your patch is safe without confirmation/testing. So I will not take this without an Ack or Tested-by from someone knowledgeable about denali.
Quoted 7 lines
Quoted 4 lines
Sorry that it took a while to get around to this. But I was able to test the patch and it looks fine.
Tested-by Dinh Nguyen <[email protected]>I really appreciate your tested-by. :-)
Thank you a lot.
Yes, thanks Dinh!
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
According to the comment of
devm_ioremap_resource(), 'devm_ioremap_resource()' ioremaps it either as cacheable or as non-cacheable memory depending on the resource's flags Thus,devm_ioremap_nocache()will be called automatically.
I see. Thanks for pointing that out. Pushed to l2-mtd.git!
Brian